Blockland Welcome, Guest. Please login or register.
Did you miss your activation email?
November 17, 2017, 11:21:26 AM

Home Help Login Register
+  Blockland Forum
|-+  Blockland Forums
| |-+  Modification Help
| | |-+  Disabling Item Dropping for Playertypes
Pages: [1]
Author Topic: Disabling Item Dropping for Playertypes  (Read 268 times)
Font

« September 10, 2017, 10:04:10 PM »

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.
Logged
Ad Bot

Full members do not see ads

PhantOS

« September 10, 2017, 10:53:44 PM »

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

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

something like this, might be a bit wrong
Logged
Font

« September 10, 2017, 11:42:26 PM »

Neat, thanks.
Logged
Kyuande

« September 11, 2017, 09:37:24 PM »

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)
Logged
Swollow

« September 12, 2017, 09:55:54 AM »

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);

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
Logged
Kyuande

« September 12, 2017, 09:59:06 AM »

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.
Logged
Pages: [1]  


Login with username, password and session length

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Page created in 0.016 seconds with 19 queries.