Explosion Timer
#1

Im making a plant c4 command for gangs on my rp,
And when they say the command it plants explosive,
But i dont know how to get the timer to pickup the playerspos when they type the command,

pawn Код:
if (strcmp("/plantc4", cmdtext, true) == 0)
    {
      new Float:BX, Float:BY, Float:BZ;
      GetPlayerPos(playerid,BX,BY,BZ);
      ApplyAnimation(playerid,"BOMBER","BOMB_PLANT",4.1,1,1,1,1,1);
        SetTimer("C4",10000,false);
        return 1;
    }

public C4(playerid)
{
    CreateExplosion(playerid,BX,BY,BZ);
}
Any help?
Reply
#2

You're trying to do it so when a player gets on those coords, the bomb will go off?
Reply
#3

No,

The player goes anywhere they want,
And when they type /plantc4
It retrieves there coordinates,
And starts a timer for 10 seconds,
Once that 10 seconds is up,
An explosion goes off where they typed that command,
But im getting undefined symbol BX,
Because its in a timer
Reply
#4

pawn Код:
//top of script
new Float:bx, Float:by, Float:bz;
//onplayercommandtext
if(strcmp(cmdtext, "/plantc4", true) == 0)
{
  GetPlayerPos(playerid, bx, by, bz);
  ApplyAnimation(playerid,"BOMBER","BOMB_PLANT",4.1,1,1,1,1,1);
  SetTimer("C4", 10000, false);
}
//
public c4()
{
  CreateExplosion(bx, by, bz, 7, 10);
}
Not, you only made the floats local variables and not global!

Also, they way you did CreateExplosion is incorrect, this is what it is.
pawn Код:
CreateExplosion(Float:x, Float:y, Float:z, type, Float:radius);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)