Author Topic: Client Variables  (Read 906 times)

umm why doesn't this work???

Code: [Select]
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);
   }
}

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

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

Wups, forgot the %client in front. >_<

Does the console give any error?
Otherwise, place an echo to find out where it goes wrong.
echo("Hello i am an echo lol");

Ok looks like i found the problem. Here is the function and result:
Code: [Select]
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");
}

result
Code: [Select]
Blockhead spawned.
Hello i am an echo lol1
Hello i am an echo lol5
%

so this line has to be messing it up:
Code: [Select]
&& %n !$= mFloatLength(%n, 0) && %n <= 0
what does && %n !$= mFloatLength(%n, 0) mean?

Wups, forgot the %client in front. >_<
oh one sec

edit: thanks but still have the same problem

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

There.