Bombing Countdowns - 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: Bombing Countdowns (
/showthread.php?tid=113624)
Bombing Countdowns -
Tigerbeast11 - 14.12.2009
How can i make bombing countdowns? If the player is in check point then he is bombing. How can I make a countdown saying: "7 secs left" then "6 secs left" etc.? and if it gets to 0, it triggers another countdown which countsdown from 30 seconds saying: "30 secs left 'till factory blows up"?
Re: Bombing Countdowns -
LarzI - 14.12.2009
pawn Код:
//global
new
timer1 = 7,
timer2 = 30,
gBombTimer1,
gBombTimer2;
forward BombTimer1(playerid);
forward BombTimer2(playerid);
//wherever you want the countdown
gBombTimer1 = SetTimerEx( "BombTimer1", 1000, true, "i", playerid );
pawn Код:
//first timer
public BombTimer1(playerid)
{
while( timer1 > 0 )
timer1--;
if( timer1 == 0 )
{
SetTimer( "BombTimer2", 1000, true );
KillTimer( gBombTimer1 );
}
new
szTimer[ 128 ];
format( szTimer, sizeof( szTimer ), "%d secs left", timer1 );
SendClientMessage( playerid, 0xFFFFFFFF, szTimer );
return true;
}
pawn Код:
//second timer
public BombTimer1(playerid)
{
while( timer2 > 0 )
timer2--;
if( timer2 == 0 )
{
//Here is where you add explosions and stuff
KillTimer( gBombTimer2 );
}
new
szTimer[ 128 ];
format( szTimer, sizeof( szTimer ), "%d secs left", timer2 );
SendClientMessage( playerid, 0xFFFFFFFF, szTimer );
return true;
}
I hope this works out for you, good luck!
Re: Bombing Countdowns -
Tigerbeast11 - 14.12.2009
its too good for a noobie like me

, i dont understand a thing and where to put it
Re: Bombing Countdowns -
LarzI - 14.12.2009
The first code, put it under your includes
pawn Код:
#include <a_samp> //this is an include
Then the two other codes, just copy and paste at bottom of your script.
Add your explosions and such where I told you (as a comment in the second bomb code)
Good luck :]
Re: Bombing Countdowns -
Tigerbeast11 - 14.12.2009
thnx
Re: Bombing Countdowns -
LarzI - 14.12.2009
No problem.
Re: Bombing Countdowns -
Tigerbeast11 - 14.12.2009
wait, what happens if I wanna trigger it when a player eneters a checkpoint.
P.S Sorry for annoying u... Its for my gm
Re: Bombing Countdowns -
LarzI - 14.12.2009
You're not annoying me, I'm happy to help you :]
Delete this part from your script
pawn Код:
gBombTimer1 = SetTimerEx( "BombTimer1", 1000, true, "i", playerid );
And put that line
pawn Код:
gBombTimer1 = SetTimerEx( "BombTimer1", 1000, true, "i", playerid );
inside OnPlayerEnterCheckpoint
Re: Bombing Countdowns -
Tigerbeast11 - 14.12.2009
Quote:
Originally Posted by lrZ^ aka LarzI
You're not annoying me, I'm happy to help you :]
Delete this part from your script
pawn Код:
gBombTimer1 = SetTimerEx( "BombTimer1", 1000, true, "i", playerid );
And put that line
pawn Код:
gBombTimer1 = SetTimerEx( "BombTimer1", 1000, true, "i", playerid );
inside OnPlayerEnterCheckpoint 
|
K, thnx dude! I added u to my buddy list and msn!
Re: Bombing Countdowns -
LarzI - 14.12.2009
No problem ^^
Cool :>