SA-MP Forums Archive
Timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer (/showthread.php?tid=329458)



Timer - Gooday - 28.03.2012

Hello i need a CMD whith:

/fire ---> CreateExplosion here no probs but i would like to repeat the explosion every 10 secons Until i write
/Stopfire +REP


Re: Timer - Kindred - 28.03.2012

Shouldn't post command requests as a thread, but in the thread "Script Request Thread #5".

Then again, here's an example (NOTICE: Untested)

pawn Код:
// Somewhere at the top, preferably near the defines and such.
forward firetimer();
new firetimer2;

//Somewhere else

CMD:fire(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateExplosion(x, y, z, 9, 10.0);
    firetimer2 = SetTimer("firetimer", 10000, true);
    return 1;
}
CMD:stopfire(playerid, params[])
{
    KillTimer(firetimer2);
    return 1;
}

public firetimer()
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateExplosion(x, y, z, 9, 10.0);
}
Also, realize i'm using ZCMD, just incase you need a different command processor, please tell me which one you use and I will switch it, or if you actually know some scripting, do it yourself.

Like I said, just an example, you didn't specify much that you wanted.