Saving a timer
#4

Maybe this code can inspire you:
pawn Код:
//On top of your script
new Inspire[MAX_PLAYERS]
    Inspiring[MAX_PLAYERS];
forward Inspiration(playerid);

//Somewhere you want to start the timer
Inspiring[playerid] = 30;//It mean 30 minutes
Inspire[playerid] = SetTimerEx("Inspiration",60000,1,"d",playerid);

//Whereever you want
public Inspiration(playerid)
{
    if(Inspiring[playerid] == 0)
    {
        KillTimer(Inspiring[playerid]);
        //Your code here if the timer is ended/finished
        return 1;
    }
    return Inspiring[playerid] -= 1;
}
You have to save Inspiring[playerid] into file or database in OnPlayerDisconnect and load it in OnPlayerConnect if you want it to be like that.
Reply


Messages In This Thread
Saving a timer - by Vero - 18.07.2011, 22:31
Re: Saving a timer - by DRIFT_HUNTER - 18.07.2011, 22:57
Re: Saving a timer - by Vero - 18.07.2011, 23:06
Re: Saving a timer - by =WoR=Varth - 19.07.2011, 02:48

Forum Jump:


Users browsing this thread: 1 Guest(s)