SA-MP Forums Archive
[Help]Pickup - 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: [Help]Pickup (/showthread.php?tid=118796)



[Help]Pickup - zilvernex - 05.01.2010

Hi, I'm trying to create a pickup in front of the player but its not working I'm using this..

Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
pickup = CreatePickup(1550, 1, x, y+3, z);
and sometimes it appears on the left or the right, I also did x+3 and same thing. How do I make it so it always spawns in front of the user no matter what position the users is in? Please help, thank you in advance



Re: [Help]Pickup - Calon - 05.01.2010

pawn Код:
/*Somewhere near the top (not in the command)*/
forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    else GetPlayerFacingAngle(playerid, a);
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
    return a;
}

// In the command, or whatever it's supposed to be in.
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
GetXYInFrontOfPlayer(playerid, X, Y, 3);
pickup = CreatePickup(1550, 1, X, Y, Z);



Re: [Help]Pickup - zilvernex - 05.01.2010

Awesome thank you it works