跳至主要内容

GetPlayerObjectPos

Description

Get the position of a player object (CreatePlayerObject).

NameDescription
playeridThe ID of the player whose player object to get the position of.
objectidThe object's id of which you want the current location.
&Float:xA float variable in which to store the X coordinate, passed by reference.
&Float:yA float variable in which to store the Y coordinate, passed by reference.
&Float:zA float variable in which to store the Z coordinate, passed by reference.

Returns

true - The function executed successfully.

false - The function failed to execute. The player and/or the object don't exist.

The object's position is stored in the specified variables.

Examples

new gPlayerObject[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);

new Float:x, Float:y, Float:z;
GetPlayerObjectPos(playerid, gPlayerObject[playerid], x, y, z);
// x = 2001.195679
// y = 1547.113892
// z = 14.283400,
return 1;
}