That appears to be way too advanced for my skills and the purpose of it. How would i increment, decrement, check and display code?
Well if you're doing the score variable it'll be
%client.score+=%number to increment, and
%client.score-=%number to decrement, so you could have an admin only command to add or subtract ones score like
function serverCmdPlayerScore(%client,%name,%amount)
{
if(!%client.isSuperAdmin)
{
messageClient(%client,'',"\c6You must be a \c3SuperAdmin\c6 to use this command.");
return;
}
%target=findclientbyname(%name);
if(!isObject(%target))
{
messageClient(%client,'',"\c3" @ %name SPC "\c6 is not a valid target.");
return;
}
if(%amount<=-1 && %amount >= -9999)
{
%amount=mFloor(%amount);
%target.score-=%amount;
messageClient(%client,'',"\c6You lowered\c3" SPC %target.name @ "\c6's score by\c3" SPC %amount);
}
else if(%amount>=1 && %amount <= 9999)
{
%amount=mFloor(%amount);
%target.score+=%amount;
messageClient(%client,'',"\c6You raised\c3" SPC %target.name @ "\c6's score by\c3" SPC %amount);
}
else
{
messageClient(%client,'',"\c3" @ %amount SPC "is not a valid value.");
}
}
There may be syntax errors, sorry if there are any.This will take
/PlayerScore name amount obviously to alter ones score, there is a command already for this though, but if you wanted to do your own variable, like
%client.money instead of score, you can do it with this. Using
mFloor it will make sure that no decimals are used, and obviously trying to change it by 0, or something that is not a number wont work.
\c6 is colour code for white, and
\c3 iirc is for yellow.
To check that
%amount is in fact a valid number this uses two different values and uses
&& to make sure
%amount is in fact between them.
&& means
and, and
|| means or.
The two if statements with returns after them are made to check if you can actually target the player you wish, or if the client is a super admin. The
! means not, so
if(!%client.isSuperAdmin) means if the client is not a Super Admin. The
return; will stop the function right then and there, so if the client isn't super admin it'll message them then stop instead of trying to continue on. Same with check if
%client exists or not.
display SCORE, to use that to check money
Lol wrote a wall of text before you edited it.
For score you can use
%client.incScore(%number); instead of all that BS up there, so something simple like
function servercmdPlayerScore(%client,%name,%amount)
{
if(!%client.isSuperAdmin)
{
messageClient(%client,'',"\c6You must be a \c3SuperAdmin\c6 to use this command.");
return;
}
%target=findclientbyname(%name);
if(!isObject(%target))
{
messageClient(%client,'',"\c3" @ %name SPC "\c6 is not a valid target.");
return;
}
%target.incScore(%amount);
}
Will work just fine.
To display it you can use
commandToClient(%client,'bottomPrint', "\c6Score:\c4" SPC %client.score);