06.02.2010, 02:05
Use a global variable:
pawn Код:
new Available[MAX_PLAYERS]; // 0 if it is and 1 if it is not available
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/heal", true) == 0)
{
if(Available[playerid] == 0) // we check if the commad is available
{
// this is the command effect (if the command is available)
Available[playerid] = 1; // this is one of the most important lines (we set the command unavailable)
}
else
{
SendClientMessage(playerid, COLOR, "You'll have to wait to use this command"); // this is what happen if it is not available
}
return 1;
}
return 0;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
Available[playerid] = 0; // we reset the variable, setting it back to available or "0"
return 1;
}