RPC errors when crafting car key or key for door lockFixed
Hi, ive spent days messing about trying to find out whats causing this error and im pretty sure its this plugin. players with instant craft are being kicked with an RPC error. i have tried excluding car.key from instant crafting but it is still happening. car keys are also ccoming up with an id of 0 whenever a lock is crafted on a car. unloading this plugin stops the issue entirely. disabling instant craft for admins stopped the issue for me (as an admin) if that helps any 

This is a patch that seems to be working on our test servers. For anyone that wants it.     

The only issue that remains that I have not patched yet! is when your inventory is full it will kick you if you try and craft another car key.  But adding car locks and crafting keys all works just fine now from our testing. :) 

unknown.png

This is another attempt at patching the last error issue... ( Untested )

Moderator edit: Please do not post random versions of plugins in forum posts, thanks. For sharing suggested changes, please use code blocks and show the relevant changes.

Can you please share the code changes?
I blocked the creation of keys on the solo server. When trying to create a key, the player is thrown from the game.
"BlockedItems": [
"Door Key

NullReferenceException: Object reference not set to an instance of an object
36.77.2.374:53477/76566193316296022/Test kicked: RPC Error in RPC_CreateKey
Any chance of an update to the plugin or the code changes provided?  
//On line 550 something updates it to this to fix key/lock issues. 

        private void OnItemCraftFinished(ItemCraftTask task, Item item)
        {
            if (task.instanceData != null)  //Added this to replace the workaround I did... ( This = perm fix )
                item.instanceData = task.instanceData;
            if (task.owner.net.connection.authLevel == 0) return;
            var crafter = task.owner.inventory.crafting;
            if (crafter.queue.Count == 0) return;
            crafter.queue.First().endTime = 1f;
        }


//On line 663 something update it to this to fix msg issues...  was -1,    correct way is 2, 0,

private void SendChatMessage(BasePlayer player, string message, params object[] args) => player?.SendConsoleCommand("chat.add", 2, 0, string.Format($"<color={ChatPrefixColor}>{ChatPrefix}</color>: {message}", args), 1.0);

Dear admins pls don't delete this... I am posting just the edits this time... nothing more nothing less... 

5e7f3953f15bd.png khan

Dear admins pls don't delete this... I am posting just the edits this time... nothing more nothing less... 

That is fine, random versions of the entire plugin is what we don't allow in forum posts. ;)

You can also share privately, but the users would need to keep in mind that those versions won't receive any support generally.

This fix posted above does create issues between ZlevelsRemastered and CraftingController... Both use OnItemCraft.
The only option is to Gut out a section from ZlevelsRemastered or have craft levels disabled in config... 

Greatly appreciate you sharing the changes.  Not using ZLevels so no problem here on that part.  Thank you!

Merged post

I applied those 2 code changes and still get kicked trying to craft a lock key

Merged post

If anyone needs an alternative, I just went with https://umod.org/plugins/no-craft
It got the job done
Ill have a big update out in the next day which addresses this :P
Locked automatically