Blockland Forums > Modification Help
Client Variables
(1/4) > >>
tyler0:
How can i set up a sub-variable under a client? Kinda like this:

%client < normal client variable

%client.cash < client's cash?
MegaScientifical:

--- Code: ---%client.cash = 0;
if(%client.cash == 0)
   messageClient(%client, '', "Lol, you poor bastard");
else if(%client.cash > 0)
   messageClient(%client, '', "Wait, where'd you get that money?");
else
   messageClient(%client, '', "You owe me some money.");
--- End code ---
tyler0:
k thanks. What if it was used in a function. Would you have to call it?


--- Code: ---function ServerCmdcommand(%client,%client.cash) {
--- End code ---
MegaScientifical:

--- Quote from: tyler0 on June 06, 2011, 04:30:11 PM ---k thanks. What if it was used in a function. Would you have to call it?


--- Code: ---function ServerCmdcommand(%client,%client.cash) {
--- End code ---

--- End quote ---


--- Code: ---function serverCmdannounceMoney(%client) {
   if(%client.isAdmin) {
      chatMessageAll(%client, '', "\c6%1 has $%2!", %client.getPlayerName(), %client.cash);
   }
}
--- End code ---
Red_Guy:

--- Quote from: tyler0 on June 06, 2011, 04:30:11 PM ---k thanks. What if it was used in a function. Would you have to call it?


--- Code: ---function ServerCmdcommand(%client,%client.cash) {
--- End code ---

--- End quote ---

something like this:

--- Code: ---function serverCmdSetCash(%client, %someValue)
  {
   %client.cash = %someValue
  }

--- End code ---

-- However --
creating a server cmd that lets clients set something like that is a BAD IDEA because they can easily hack in any amount of $$ they want:
~  (opens console)
commandToServer('setCash', 999999999999999999999999);
~ (close console)
*gloat*

your better off just using: %client.cash = <stuff>  inside your script
Navigation
Message Index
Next page

Go to full version