Przejdź do głównej zawartości

IsValidPlayerObject

Description

Checks if the given object ID is valid for the given player.

NameDescription
playeridThe ID of the player whose player-object to validate.
objectidThe ID of the object to validate.

Returns

true if the object exists, false if not.

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

public OnPlayerDisconnect(playerid, reason)
{
// Check if an object is valid (exists) before we delete it
if (IsValidPlayerObject(playerid, gPlayerObject[playerid]))
{
DestroyPlayerObject(playerid, gPlayerObject[playerid]);
}
return 1;
}