[bot] Implement/match n_GetPlayerVehicleID(...)

* Implement/match `CNetGame::GetPlayerVehicleID(...)`
This commit is contained in:
RD42 2024-07-01 23:01:21 +08:00
parent 3930e321c9
commit c264951e74
3 changed files with 24 additions and 1 deletions

View File

@ -100,6 +100,25 @@ BOOL CNetGame::GetPlayerPos(PLAYERID playerId, PVECTOR Vector)
return FALSE;
}
VEHICLEID CNetGame::GetPlayerVehicleID(PLAYERID playerId)
{
if(playerId >= MAX_PLAYERS) return INVALID_VEHICLE_ID;
if(bPlayerSlotState[playerId] == FALSE) return INVALID_VEHICLE_ID;
if(bytePlayerState[playerId] == PLAYER_STATE_DRIVER)
{
return unnamed_4[playerId].VehicleID;
}
else if(bytePlayerState[playerId] == PLAYER_STATE_PASSENGER)
{
return unnamed_5[playerId].VehicleID;
}
else
{
return INVALID_VEHICLE_ID;
}
}
//----------------------------------------------------
// MATCH
BOOL CNetGame::IsPlayerAdded(PLAYERID playerId)

View File

@ -109,6 +109,7 @@ public:
void SetPlayerState(PLAYERID playerId, BYTE byteState);
BYTE GetPlayerState(PLAYERID playerId);
BOOL GetPlayerPos(PLAYERID playerId, PVECTOR Vector);
VEHICLEID GetPlayerVehicleID(PLAYERID playerId);
void StopRecordingPlayback();
void PauseRecordingPlayback();
void ResumeRecordingPlayback();

View File

@ -166,7 +166,10 @@ static cell AMX_NATIVE_CALL n_GetPlayerPos(AMX *amx, cell *params)
// native GetPlayerVehicleID(playerid)
static cell AMX_NATIVE_CALL n_GetPlayerVehicleID(AMX *amx, cell *params)
{
// TODO: n_GetPlayerVehicleID
if(pNetGame->GetPlayerPool()->GetSlotState((PLAYERID)params[1]))
{
return pNetGame->GetPlayerVehicleID((PLAYERID)params[1]);
}
return 0;
}