Question about timer!
#1

Look i want add a vip command that they can use /varmor every 30 mins but i dont know how to work with timers can someone help me ?



Quote:

CMD:varmor(playerid,params[]) {
if(Player[playerid][VipRank] >= 2) {
SetPlayerArmour(playerid, 100);
}
}

Reply
#2

pawn Код:
CMD:varmor(playerid, params[])
{
    new string[128], armor;
    if(sscanf(params, "d", armor))
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /varmor [health]");
        return 1;
    }
    if(Player[playerid][VipRank] >= 2)
    {
        SetPlayerArmour(playerid, armor);
        format(string, sizeof(string), "You have set your armor to %d.", armor);
        SendClientMessageEx(playerid, COLOR_WHITE, string);
    }
    return 1;
}
Reply
#3

Where's the timer?

I want it to work every 30 mins if you type command if you type command in that time You have to wait "" mins more to use this command
Reply
#4

If so, you have to use
pawn Код:
new viparmortimer
pawn Код:
new string[128];
    if(Player[playerid][VipRank] >= 2)
    {
        format(string, sizeof(string), "You must wait 30 minutes to use this command. ");
        SendClientMessageEx(playerid, COLOR_GREY, string);
        return 1;
    }
at first then
make a condition within the above script like

pawn Код:
if(Player[playerid][VipRank] >= 2)
    {
        viparmortimer[playerid] = 108000;
    }
Reply
#5

Can you maby put the last code in my code it wont work .. there is nothing what let the timer going down, None thing to start timer?
Reply
#6

hold on


Put
pawn Код:
new viparmortimer = 108000;
instead of

pawn Код:
new viparmortimer ;
Reply
#7

And again errors and nothing that trigger the timer..
Reply
#8

pawn Код:
new bool:ArmourUsed[MAX_PLAYERS]; // Create bool..

// OnPlayerConnect
// ArmourUsed[playerid] = false;

CMD:varmor(playerid,params[])
{
   if(ArmourUsed[playerid] == false)
   {
      if(Player[playerid][VipRank] >= 2)
      {
         SetPlayerArmour(playerid, 100.0);
         ArmourUsed[playerid] = true;
         SetTimerEx("WaitTime", 60000*30, false, "i", playerid);
      }
   }
   else return SendClientMessage(playerid, -1, " Wait 30 min ");// you text
   return 1;
}

forward WaitTime(playerid);
public WaitTime(playerid)
{
    ArmourUsed[playerid] = false;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)