/heal once
#2

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;
}
Reply


Messages In This Thread
/heal once - by John Rockie - 06.02.2010, 01:45
Re: /heal once - by Miguel - 06.02.2010, 02:05
Re: /heal once - by John Rockie - 06.02.2010, 02:08

Forum Jump:


Users browsing this thread: 2 Guest(s)