Blockland Forums > Modification Help
Client Variables
tyler0:
so if i change the name for the cash variable to like "cats" then they wouldn't know what variable to set it as right?
lordician:
--- Quote from: tyler0 on June 06, 2011, 04:48:45 PM ---so if i change the name for the cash variable to like "cats" then they wouldn't know what variable to set it as right?
--- End quote ---
People would still find that out if they want.
MegaScientifical:
function serverCmdsetCash(%client, %n) {
if(%client.isAdmin && %n !$= mFloatLength(%n, 0) && %n <= 0) {
%client.cash += mFloatLength(%n, 2);
chatMessageAll(%client, '', "\c6%1 gained $%2 ($%3)!", %client.getPlayerName(), mFloatLength(%n, 2), %client.cash);
}
}
I didn't realize until just now that I forgot about scripts for checking if it's just numbers and how to add to a variable a specific amount simply... Argh...
lordician:
--- Quote from: MegaScientifical on June 06, 2011, 04:59:07 PM ---function serverCmdsetCash(%client, %n) {
if(%client.isAdmin && %n !$= mFloatLength(%n, 0) && %n <= 0) {
%client.cash = +%n;
}
}
I didn't realize until just now that I forgot about scripts for checking if it's just numbers and how to add to a variable a specific amount simply... Argh...
--- End quote ---
Instead of "%client.cash = +%n;" isn't it better to do: "%client.cash += %n;"?
MegaScientifical:
--- Quote from: lordician on June 06, 2011, 05:02:45 PM ---Instead of "%client.cash = +%n;" isn't it better to do: "%client.cash += %n;"?
--- End quote ---
THAT'S it. I was trying to remember how to do that, and was thinking "forget, did I really forget so much?" Thank you, that's what I wanted. That's why I made my stuff tiny. I'll edit it just in case, though. Again, thank you.
Still need to remember the simplest way to check if a string has more than just numbers in it. Someone remind us? I have my old crap method in there, couldn't find the good method someone told me once in my code...