Blockland Forums > Modification Help
Disabling Item Dropping for Playertypes
(1/2) > >>
Font:
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.
PhantOS:

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

    parent::servercmddroptools(%this,%slot);
}
--- End code ---

something like this, might be a bit wrong
Font:
Neat, thanks.
Kyuande:
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)
Swollow:
it also needs to be in a package



--- Code: ---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);
--- End code ---

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
Navigation
Message Index
Next page

Go to full version