#1

*I am not so good with timers,so don't laugh at me O.o

I wanted to ask - how can I create a timer that after it will be finished something will happen?
Reply
#2

pawn Код:
SetTimer("test",5000,false);
pawn Код:
public test()
{
    SendClientMessageToAll(COLOR_COLOR, "5 seconds passed");
}
Theres an example, if you dont understand ill explain
Reply
#3

You can also do this;

Example;
pawn Код:
new TimerVar;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/timer", cmdtext, true, 6) == 0)
    {
        SetPVarInt(playerid, "Timing", gettime());
        TimerVar = SetTimerEx("Timer", 1000, true, "i", playerid);
        return 1;
    }
    return 0;
}

forward Timer(playerid);
public Timer(playerid)
{
    if(gettime()-GetPVarInt(playerid, "Timing") < 5) // The time... in seconds. (five seconds)
    {
        /* Do here whatever you want after five seconds */
        KillTimer(TimerVar); // kills the timer when it's done
    }
}
Reply
#4

Quote:
Originally Posted by Anthonyx3'
Посмотреть сообщение
pawn Код:
SetTimer("test",5000,false);
pawn Код:
public test()
{
    SendClientMessageToAll(COLOR_COLOR, "5 seconds passed");
}
Theres an example, if you dont understand ill explain
Thats it?
Its easy.. thanks dude!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)