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

* Rename `field_84D0` to `m_bVehicleSlotState`
* Implement/match `CNetGame::IsVehicleAdded(...)`
This commit is contained in:
RD42 2024-07-05 22:43:08 +08:00
parent 86473c8272
commit 71204c1c49
5 changed files with 22 additions and 4 deletions

View File

@ -197,6 +197,14 @@ BOOL CNetGame::IsPlayerAdded(PLAYERID playerId)
return bPlayerSlotState[playerId] != FALSE; return bPlayerSlotState[playerId] != FALSE;
} }
//----------------------------------------------------
BOOL CNetGame::IsVehicleAdded(VEHICLEID VehicleID)
{
if(VehicleID >= MAX_VEHICLES) return FALSE;
return bVehicleSlotState[VehicleID] != FALSE;
}
//---------------------------------------------------- //----------------------------------------------------
// MATCH // MATCH
void CNetGame::SetMyZAngle(float fAngle) void CNetGame::SetMyZAngle(float fAngle)

View File

@ -113,6 +113,7 @@ public:
BYTE GetPlayerArmedWeapon(PLAYERID playerId); BYTE GetPlayerArmedWeapon(PLAYERID playerId);
BYTE GetPlayerHealth(PLAYERID playerId); BYTE GetPlayerHealth(PLAYERID playerId);
BYTE GetPlayerArmour(PLAYERID playerId); BYTE GetPlayerArmour(PLAYERID playerId);
BOOL IsVehicleAdded(VEHICLEID VehicleID);
void StopRecordingPlayback(); void StopRecordingPlayback();
void PauseRecordingPlayback(); void PauseRecordingPlayback();

View File

@ -8,7 +8,7 @@ CVehiclePool::CVehiclePool()
{ {
// loop through and initialize all net players to null and slot states to false // loop through and initialize all net players to null and slot states to false
for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) { for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) {
field_84D0[VehicleID] = 0; m_bVehicleSlotState[VehicleID] = FALSE;
} }
} }

View File

@ -40,7 +40,7 @@ class CVehiclePool // size: 114000
{ {
private: private:
char _gap0[34000]; char _gap0[34000];
int field_84D0[2000]; BOOL m_bVehicleSlotState[MAX_VEHICLES];
VEHICLE_SPAWN_INFO m_SpawnInfo[MAX_VEHICLES]; VEHICLE_SPAWN_INFO m_SpawnInfo[MAX_VEHICLES];
public: public:
@ -51,4 +51,10 @@ public:
BOOL New(NEW_VEHICLE *pNewVehicle); BOOL New(NEW_VEHICLE *pNewVehicle);
BOOL Delete(VEHICLEID VehicleID); BOOL Delete(VEHICLEID VehicleID);
// Find out if the slot is inuse.
BOOL GetSlotState(VEHICLEID VehicleID) {
if(VehicleID >= MAX_VEHICLES) { return FALSE; }
return m_bVehicleSlotState[VehicleID];
};
}; };

View File

@ -221,7 +221,10 @@ static cell AMX_NATIVE_CALL n_IsPlayerStreamedIn(AMX *amx, cell *params)
// native IsVehicleStreamedIn(vehicleid) // native IsVehicleStreamedIn(vehicleid)
static cell AMX_NATIVE_CALL n_IsVehicleStreamedIn(AMX *amx, cell *params) static cell AMX_NATIVE_CALL n_IsVehicleStreamedIn(AMX *amx, cell *params)
{ {
// TODO: n_IsVehicleStreamedIn if(pNetGame->GetVehiclePool()->GetSlotState((VEHICLEID)params[1]))
{
return pNetGame->IsVehicleAdded((VEHICLEID)params[1]);
}
return 0; return 0;
} }