Author Topic: Disabling Item Dropping for Playertypes  (Read 1238 times)

So, small question here.
How can I set it so players with a certain playertype cannot drop their items? I'm trying to make it so you can't give other people weapons in my game so they're forced to have whatever they pick up or start with.

Thanks in advance.

Code: [Select]
function servercmddroptools(%this,%slot)
{
     if(%this.player.getDatablock().getClassname() $= "YourPlayertypeArmor")
               return;

    parent::servercmddroptools(%this,%slot);
}

something like this, might be a bit wrong


Note that the code above will create a bunch of spam if the player does not exist.

You are very close @Phant, it is serverCmdDropTool(%client, %toolID)

it also needs to be in a package


Code: [Select]
datablock PlayerData(noButterFingers : playerStandardArmor)
{
disableToolDrop = 1;
};
package playertypeNoDropTool
{
function serverCmdDropTool(%cl,%slot)
{
if(isObject(%cl.player) && %cl.player.getDatablock().disableToolDrop)
return;
parent::serverCmdDropTool(%cl,%slot);
}
};
activatePackage(playertypeNoDropTool);

I prefer this more modular approach, this way you can easily set the variable disableToolDrop on any number of playertypes instead of typing out a list inside your drop code, keep in mind this code and package only needs to be executed once for any number of playertypes you have

I prefer this more modular approach, this way you can easily set the variable disableToolDrop on any number of playertypes instead of typing out a list inside your drop code, keep in mind this code and package only needs to be executed once for any number of playertypes you have
This reminds me of the cordax armor - the armor for each if statement is a check for each type of image which is insane and slows down the code by a good chunk.