SA-MP Forums Archive
Tiny timer help! - 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: Tiny timer help! (/showthread.php?tid=253245)



Tiny timer help! - Swiftz - 05.05.2011

Ok i made this command,
Quote:

if(strcmp(cmdtext, "/activatebomb", true) == 0) // car bomb
{
new playa[128];
GetPlayerName(playerid, playa, 24);
if (Cbomb[playerid] == 1)
{
new Float:X,Float:Y,Float:Z;
GetVehiclePos(carbomb[playerid],X,Y,Z);
SetVehicleHealth(carbomb[playerid],-999);
CreateExplosion(X+1,Y+1,Z+1, 7, 7);
CreateExplosion(X+1,Y+1,Z+1, 7, 7);
}
return 1;
}

I want to add more createexplosion to it, But that explosion should happen 1 sec after the previous explosion, I hope you understand


Re: Tiny timer help! - MadeMan - 05.05.2011

pawn Код:
public NewExplosion(vehicleid)
{
    new Float:X,Float:Y,Float:Z;
    GetVehiclePos(vehicleid,X,Y,Z);
    CreateExplosion(X+1,Y+1,Z+1, 7, 7);
}
/activatebomb
pawn Код:
SetTimerEx("NewExplosion", 1000, false, "d", carbomb[playerid]); // 1000 ms = 1 sec



Re: Tiny timer help! - Swiftz - 05.05.2011

Erm.. Sorry for this noob question Will it work like this?
SetTimerEx("NewExplosion", 1000, false, "d", carbomb[playerid]);
SetTimerEx("NewExplosion", 2000, false, "d", carbomb[playerid]);
SetTimerEx("NewExplosion", 3000, false, "d", carbomb[playerid]);
Like three bombs simultaneosly in 3 seconds?


Re: Tiny timer help! - MadeMan - 05.05.2011

Quote:
Originally Posted by Swiftz
Посмотреть сообщение
Erm.. Sorry for this noob question Will it work like this?
SetTimerEx("NewExplosion", 1000, false, "d", carbomb[playerid]);
SetTimerEx("NewExplosion", 2000, false, "d", carbomb[playerid]);
SetTimerEx("NewExplosion", 3000, false, "d", carbomb[playerid]);
Like three bombs simultaneosly in 3 seconds?
Yes, all bombs explode 1 sec after the last one.


Re: Tiny timer help! - Swiftz - 05.05.2011

Ok thanks Mademan P.S:- Another think should i forward as "NewExplosion(Max_Vehicles)?


Re: Tiny timer help! - Swiftz - 05.05.2011

Ok i did this i made these timers
Код:
           SetTimerEx("Cexplosion", 500, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 800, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 1000, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 1300, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 1600, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 1800, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 2000, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 2400, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 2700, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 2800, false, "d", carbomb[playerid]);
           SetTimerEx("Cexplosion", 3000, false, "d", carbomb[playerid]);
But all explosions take place at the same time, But i need it to explode one after the other, like time gap half a sec , So please tell what do do, Thnx
And
Код:
public Cexplosion(vehicleid)
{
	for(new i; i < MAX_PLAYERS; i++)
	{
       new Float:X,Float:Y,Float:Z;
       GetVehiclePos(carbomb[i],X,Y,Z);
       CreateExplosion(X+1,Y+1,Z+1, 7, 7);
       CreateExplosion(X+2,Y+2,Z+2, 7, 10);
       CreateExplosion(X+4,Y+4,Z+4, 7, 10);
	}
	return 1;
}