13.12.2012, 11:37
How can i cap a variables value? E.g make the variables limit 5, For example
This command will increase the pLSPD variable to whatever was entered in the command params, I want it so if they type /finvitelspd 1 3
And their rank is already 4, they cant because it will exceed the variable value of 5? If that makes sense...
If need more details please comment
Thanks in advance
pawn Код:
COMMAND:finvitelspd(playerid, params[])
{
if(PlayerInfo[pLSPD][playerid] != 5)
{
new toplayerid, // the player we want to make SA-PD
rank; // extracting player's ID and rank from params
if (!sscanf(params, "ui", toplayerid, rank))
{
if (toplayerid != INVALID_PLAYER_ID)
{
PlayerInfo[pLSPD][toplayerid] = rank;
new
message[40];
format(message, sizeof(message), "You were set rank %i By the SA-PD Leader.!", rank);
SendClientMessage(toplayerid, 0x00FF00FF, message);
}
else SendClientMessage(playerid, 0xFF0000FF, "That player is not connected");
}
else SendClientMessage(playerid, 0xFF0000FF, "Usage: /finvite <playerid> <rank>");
}
else SendClientMessage(playerid, 0xFF0000FF, "Only the SA-PD Leader can use this command!");
return 1;
}
And their rank is already 4, they cant because it will exceed the variable value of 5? If that makes sense...
If need more details please comment
Thanks in advance