[Help]Pickup
#1

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
Reply
#2

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);
Reply
#3

Awesome thank you it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)