Blockland Forums > Suggestions & Requests
Command ClearTools
(1/1)
hodototman:
Hello. Could someone teach me how to do a simple script for my server - a command that clears your tools?

/cleartools would be the command. I wanna learn how to make script functions and stuff.

I mean, I know you start with

function serverCmdCleartools(%this)
{
   something
}

I'm just wondering where to go from there.
hodototman:
Erm, hello?
hodototman:
Seriously.
Greek2me:
You would do something like this:


--- Code: ---function serverCmdClearTools(%client)
{
%player = %client.player; //ok, we've found their player

if(isObject(%player)) //let's check to make sure that the player actually exists
%player.clearTools(); //clear their tools

messageClient(%client,'',"Your tools were cleared."); //tell them what happened
}
--- End code ---

Fyi, post questions about coding in the Coding Help board next time. :)
hodototman:

--- Quote from: Greek2me on August 13, 2012, 06:54:19 PM ---You would do something like this:


--- Code: ---function serverCmdClearTools(%client)
{
%player = %client.player; //ok, we've found their player

if(isObject(%player)) //let's check to make sure that the player actually exists
%player.clearTools(); //clear their tools

messageClient(%client,'',"Your tools were cleared."); //tell them what happened
}
--- End code ---

Fyi, post questions about coding in the Coding Help board next time. :)

--- End quote ---

K, thx.
Navigation
Message Index

Go to full version