SA-MP Forums Archive
create object from x+3.0 y+3.0 z+3.0 of the 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: create object from x+3.0 y+3.0 z+3.0 of the player (/showthread.php?tid=487813)



create object from x+3.0 y+3.0 z+3.0 of the player - HitterHitman - 15.01.2014

i want to create an object near the player how can i do this?


Re: create object from x+3.0 y+3.0 z+3.0 of the player - Pottus - 15.01.2014

pawn Код:
.....

new Float:x, Float:y, Floatz;
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, 3.0);
z+= 3.0;


....

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



Re: create object from x+3.0 y+3.0 z+3.0 of the player - HitterHitman - 15.01.2014

Thanks