Blockland Forums > Modification Help
Client Variables
<< < (4/4)
MegaScientifical:

--- Quote from: tyler0 on June 06, 2011, 05:24:17 PM ---umm why doesn't this work???


--- Code: ---function serverCmdsetCash(%client, %n) {
   if(%client.isAdmin && %n !$= mFloatLength(%n, 0) && %n <= 0) {
      %client.cash += %n;
 commandToClient(%client, 'centerPrint', "You currently have $" @ %client.cash,3);
   }
}
--- End code ---

--- End quote ---


--- Code: ---function serverCmdsetCash(%client, %n) {
if(%client.isAdmin && %n !$= mFloatLength(%n, 0) && %n <= 0) {
%client.cash += %n;
%client.centerPrint("You currently have $" @ %client.cash, 3);
}
}
--- End code ---

Isn't centerPrint(); local? AKA, whenever someone does that command, the host would get centerprint...?

Another example is: commandtoclient(%this,'CenterPrint',"\c6You're in the \c0SWAT\c6.",3,3,5000);
lordician:
Wups, forgot the %client in front. >_<
tyler0:

--- Quote from: lordician on June 06, 2011, 05:43:10 PM ---Does the console give any error?
Otherwise, place an echo to find out where it goes wrong.
echo("Hello i am an echo lol");

--- End quote ---

Ok looks like i found the problem. Here is the function and result:

--- Code: ---function serverCmdsetCash(%client, %n) {
echo("Hello i am an echo lol1");
   if(%client.isAdmin && %n !$= mFloatLength(%n, 0) && %n <= 0) {
   echo("Hello i am an echo lol2");
      %client.cash += %n;
  echo("Hello i am an echo lol3");
  centerPrint("You currently have $" @ %client.cash,3);
  echo("Hello i am an echo lol4");
   }
   echo("Hello i am an echo lol5");
}
--- End code ---

result

--- Code: ---Blockhead spawned.
Hello i am an echo lol1
Hello i am an echo lol5
%
--- End code ---

so this line has to be messing it up:

--- Code: ---&& %n !$= mFloatLength(%n, 0) && %n <= 0
--- End code ---

what does && %n !$= mFloatLength(%n, 0) mean?
tyler0:

--- Quote from: lordician on June 06, 2011, 05:45:30 PM ---Wups, forgot the %client in front. >_<

--- End quote ---
oh one sec

edit: thanks but still have the same problem
MegaScientifical:

--- Code: ---function serverCmdsetCash(%client, %n) {
if(%client.isAdmin && %n $= mFloatLength(%n, 0) && %n >= 0) {
%client.cash += %n;
%client.centerPrint("You currently have $" @ %client.cash, 3);
}
}
--- End code ---

There.
Navigation
Message Index
Previous page

Go to full version