How i can create pickup infront of player
#1

Код:
COMMAND:pickup(playerid, params[])
{
	new szString[128];
	if(sscanf(params, "d", pickupids)) return SendClientMessage(playerid, COLOR_RED, "You have to insert the pickup id.");
	new Float:X, Float:Y, Float:Z, Float:Angle;
	GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
	pickup = CreatePickup(pickupids, 2, Float:X, Float:Y, Float:Z, GetPlayerVirtualWorld(playerid));
	return 1;
}
how to make the pickup infront of player?
I already add Float:Y+2 but when I'm facing to south it spawn on my back
Reply
#2

You could try this stock function
Cr.Forum https://sampforum.blast.hk/showthread.php?tid=344951
Cr.******
pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    // Created by ******

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

Quote:
Originally Posted by colonel-top
Посмотреть сообщение
You could try this stock function
Cr.Forum https://sampforum.blast.hk/showthread.php?tid=344951
Cr.******
pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    // Created by ******

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


Forum Jump:


Users browsing this thread: 1 Guest(s)