C4 TIMER
#1

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;
}
Reply
#2

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

WeeDarr
Reply
#3

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...
Reply
#4

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

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

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

Andf doesnt work...
Reply
#7

We need to see the timer function too.

WeeDarr
Reply
#8

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


Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)