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

This commit is contained in:
RD42 2024-09-18 23:40:57 +08:00
parent d60dc61013
commit c972dd0ade
2 changed files with 18 additions and 3 deletions

View File

@ -28,7 +28,12 @@ typedef struct _PLAYER_SPAWN_INFO
#pragma pack(1)
typedef struct _ONFOOT_SYNC_DATA
{
char _pad0[68];
char _pad0[62];
WORD wSurfInfo;
char _pad40[4];
// TODO: _ONFOOT_SYNC_DATA
} ONFOOT_SYNC_DATA;
@ -210,6 +215,7 @@ public:
int field_2CDA;
ONFOOT_SYNC_DATA* GetOnFootSyncData() { return &m_ofSync; }
BYTE GetState() { return m_byteState; };

View File

@ -955,8 +955,17 @@ static cell AMX_NATIVE_CALL n_GetPlayerVehicleSeat(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL n_GetPlayerSurfingVehicleID(AMX *amx, cell *params)
{
// TODO: GetPlayerSurfingVehicleID
return 0;
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
if(!pPlayerPool) return 0xFFFF;
CPlayer *pPlayer = pPlayerPool->GetAt((PLAYERID)params[1]);
if(pPlayer && pPlayer->GetState() == PLAYER_STATE_ONFOOT) {
WORD wSurfInfo = pPlayer->GetOnFootSyncData()->wSurfInfo;
if(wSurfInfo != 0 && wSurfInfo < 2000) {
return wSurfInfo;
}
}
return 0xFFFF;
}
static cell AMX_NATIVE_CALL n_GetPlayerSurfingObjectID(AMX *amx, cell *params)