diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 0e0b66b..96438ee 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -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) diff --git a/bot/net/netgame.h b/bot/net/netgame.h index c5f40e1..28ed34d 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -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(); diff --git a/bot/scrcustom.cpp b/bot/scrcustom.cpp index d0fc51a..f180240 100644 --- a/bot/scrcustom.cpp +++ b/bot/scrcustom.cpp @@ -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; }