SA-MP Forums Archive
Explosion Timer - 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: Explosion Timer (/showthread.php?tid=81854)



Explosion Timer - JoeDaDude - 14.06.2009

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?


Re: Explosion Timer - Grim_ - 14.06.2009

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


Re: Explosion Timer - JoeDaDude - 14.06.2009

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


Re: Explosion Timer - Grim_ - 14.06.2009

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);