SA-MP Forums Archive
/createExplosion toward a player - 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)
+--- Thread: /createExplosion toward a player (/showthread.php?tid=343425)



/createExplosion toward a player - [D]ry[D]esert - 17.05.2012

Hi i tried to make /createexplosion .
like this
pawn Код:
COMMAND:test(playerid, params[])
        {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateExplosion(x,y + 1,z,11,10);
        SetTimerEx("First",300,false,"i",playerid);
        }
        forward First(playerid);
        public First(playerid)
        {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateExplosion(x,y + 5,z,11,10);
        SetTimerEx("Secand",300,false,"i",playerid);
        }
        forward Secand(playerid);
        public Secand(playerid)
        {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateExplosion(x,y + 10,z,11,10);
        SetTimerEx("Thired",300,false,"i",playerid);
        }
        forward Thired(playerid);
        public Thired(playerid)
        {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateExplosion(x,y + 15,z,11,10);
        }
The Problem that the Explosion move y + 1 and y + 5 ect ..
so that mean i need to make the explosion Get Player Facing Angle and Move into Player face .


Re: /createExplosion toward a player - [D]ry[D]esert - 17.05.2012

Anyone please ?


Re: /createExplosion toward a player - rscaerzx - 13.07.2012

maybe you should use this:

pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
      GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}