Cooldown
#9

Delete:
pawn Код:
DownSweeper[playerid] = 1;
SetTimer("CoolSweeper", 3600000, false);
and replace it with this:
pawn Код:
DownSweeper[playerid] = GetTickCount()+3600000;
Put this in the /sweepagain command you was talking about:
pawn Код:
if(DownSweeper[playerid] > GetTickCount())
{
    new string[60], time=DownSweeper[playerid]-GetTickCount();
    time/=1000, time/=60;
    if(time > 1)
        format(string,sizeof(string),"Please wait %d minutes before using this command again!", time);
    else if(time == 1)
        format(string,sizeof(string),"Please wait 1 minute before using this command again!");
    else
        format(string,sizeof(string),"Please wait a few seconds before using this command again!");
    SendClientMessage(playerid, 0xFF0000FF, string);
    return 1;
}
Also, you no longer need:
pawn Код:
public CoolSweeper()
{
    DownSweeper[playerid] = 0;
}
If you need to check if the cooldown is over or not, use this:
pawn Код:
if(DownSweeper[playerid] > GetTickCount())
Sorry if I made things confusing, but this way you don't need to use a timer, and can also see how long of the cooldown is remaining.
Reply


Messages In This Thread
Cooldown - by Alex.Cone - 02.08.2012, 22:47
Re: Cooldown - by Ranama - 02.08.2012, 22:53
Respuesta: Cooldown - by HydraX - 02.08.2012, 22:54
Respuesta: Re: Cooldown - by Alex.Cone - 02.08.2012, 23:17
Re: Cooldown - by NeverKnow - 02.08.2012, 23:26
Re: Cooldown - by nickdodd25 - 02.08.2012, 23:32
Respuesta: Re: Cooldown - by Alex.Cone - 02.08.2012, 23:37
Re: Cooldown - by Vince - 03.08.2012, 00:15
Re: Cooldown - by Catalyst- - 03.08.2012, 00:17

Forum Jump:


Users browsing this thread: 4 Guest(s)