SA-MP Forums Archive
C4 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: C4 TIMER (/showthread.php?tid=85723)



C4 TIMER - Frankox - 09.07.2009

I made something like a bomb which needs to explode, and its explodes but i dont know how to set timer that she(the bomb) explodes after 10 seconds after i type /c4 so pls if someone can add it here?

public C4(playerid, cmdtext[])
{
//-------------------------------[C4]-------------------------------------------
if(strcmp(cmdtext, "/c4", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{

ApplyAnimation(playerid,"ped","bomber",4.1,0,1,1,1 ,1);
SendClientMessage(playerid, COLOR_ROB, "C4 set, in 10 seconds it will explode");
new Floatcx, Floatcy, Floatcz;
GetPlayerPos(playerid,scx, scy, scz);
CreateExplosion(scx+1,scy+1,scz+1,7,100);
}
return 1;
}
return 0;
}


Re: C4 TIMER - weedarr - 09.07.2009

Search the samp wiki for "SetTimerEx". It will tell you how to add a timer.

WeeDarr


Re: C4 TIMER - Frankox - 09.07.2009

Quote:
Originally Posted by WeeDarr
Search the samp wiki for "SetTimerEx". It will tell you how to add a timer.

WeeDarr
Yea but i tryed to add timer one time but it didnt work...


Re: C4 TIMER - yom - 09.07.2009

Try again, then if it still doesn't work, post your code.


Re: C4 TIMER - Frankox - 09.07.2009

Quote:
Originally Posted by 0rb
Try again, then if it still doesn't work, post your code.
Ok


Re: C4 TIMER - Frankox - 09.07.2009

SetTimerEx("C4",10000,false,"is",1,"C4 has exploded");

Andf doesnt work...


Re: C4 TIMER - weedarr - 09.07.2009

We need to see the timer function too.

WeeDarr


Re: C4 TIMER - Frankox - 09.07.2009

SetTimerEx("C4",10000,false,"is",1,"C4 has exploded");


public C4(playerid, cmdtext[])
{
//-------------------------------[C4]-------------------------------------------
if(strcmp(cmdtext, "/c4", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{

ApplyAnimation(playerid,"ped","bomber",4.1,0,1,1,1 ,1);
SendClientMessage(playerid, COLOR_ROB, "C4 set, in 10 seconds it will explode");
new Floatcx, Floatcy, Floatcz;
GetPlayerPos(playerid,scx, scy, scz);
CreateExplosion(scx+1,scy+1,scz+1,7,100);
}
return 1;
}
return 0;
}


THats all i made





Re: C4 TIMER - Correlli - 09.07.2009

SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...);

And you can't use the command in first post just like that, all the commands must go to OnPlayerCommandText.


Re: C4 TIMER - weedarr - 09.07.2009

https://sampwiki.blast.hk/wiki/Random_Messages

Read that, it shows you how to add a simple timer. Then test it, get it working and build on what you now know.

WeeDarr

Edit: Don Correlli's link is probably more useful.