Bombing Countdowns
#1

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"?
Reply
#2

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!
Reply
#3

its too good for a noobie like me , i dont understand a thing and where to put it
Reply
#4

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 :]
Reply
#5

thnx
Reply
#6

No problem.
Reply
#7

wait, what happens if I wanna trigger it when a player eneters a checkpoint.

P.S Sorry for annoying u... Its for my gm
Reply
#8

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
Reply
#9

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

No problem ^^
Cool :>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)