[server] Implement/match n_IsPlayerInVehicle(...)

This commit is contained in:
RD42
2024-09-18 23:37:30 +08:00
parent caf15b5742
commit 0afe0a4965
2 changed files with 28 additions and 3 deletions
+12 -1
View File
@@ -977,9 +977,20 @@ static cell AMX_NATIVE_CALL n_RemovePlayerFromVehicle(AMX *amx, cell *params)
return 0;
}
// native IsPlayerInVehicle(playerid, vehicleid)
static cell AMX_NATIVE_CALL n_IsPlayerInVehicle(AMX *amx, cell *params)
{
// TODO: IsPlayerInVehicle
CPlayer* pPlayer = pNetGame->GetPlayerPool()->GetAt((PLAYERID)params[1]);
if (!pPlayer) return 0;
BYTE byteState = pPlayer->GetState();
if ((byteState == PLAYER_STATE_DRIVER) || (byteState == PLAYER_STATE_PASSENGER))
{
if (pPlayer->m_VehicleID == params[2])
{
return 1;
}
}
return 0;
}