Admin ammunition every 10 mins.
#1

I have a problem I want to do command which give for admins weapons,armour and health But admin can use this command every 10mins how I can do this? I think there need to be SetTimer
My code under OnPlayerCommandText:

Код:
    if (strcmp("/adminammunition, cmdtext, true, 10) == 0)
   {
   if(isPlayerAnAdmin(playerid,2))
   {
      SetPlayerHealth(playerid,100);
      SetPlayerArmour(playerid,100);
      GivePlayerWeapon(playerid,31,100);
      GivePlayerWeapon(playerid,41,500);
      SendClientMessage(playerid,0xFF66FFAA," You get admin ammunition.");
      return 1;
   }
   else
   {
      SendClientMessage(playerid,0x4B00B0AA,"You are not an admin...");
      return 1;
   }
  }
}
Plesae correct my code... I need this.
Reply
#2

pawn Код:
if (strcmp("/adminammunition", cmdtext, true) == 0)
    {
        if(isPlayerAnAdmin(playerid,2))
        {
            new ammun = GetPVarInt(playerid, "ammunition");
            if (ammun) return 1;
            SetPVarInt(playerid, "ammunition", 1);
            SetTimerEx("resetammun", 600 * 1000, false, "i", playerid);
            SetPlayerHealth(playerid,100);
            SetPlayerArmour(playerid,100);
            GivePlayerWeapon(playerid,31,100);
            GivePlayerWeapon(playerid,41,500);
            SendClientMessage(playerid,0xFF66FFAA," You get admin ammunition.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid,0x4B00B0AA,"You are not an admin...");
        }
        return 1;
    }

// Put this code at the end of your script:
public resetammun(playerid)
{
    SetPVarInt(playerid, "ammunition", 0);
    return 1;
}
Reply
#3

Thank you very much respect for you...
Reply
#4

You could use GetTickCount
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)