From 6ead220db3e0fbccccae76e2b2c466aa6830c71b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:01:38 +0800 Subject: [PATCH] [bot] Implement/match `n_GetPlayerSpecialAction(...)` * Implement/match `CNetGame::GetPlayerSpecialAction(...)` --- bot/main.h | 2 ++ bot/net/netgame.cpp | 12 ++++++++++++ bot/net/netgame.h | 1 + bot/scrcustom.cpp | 7 +++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bot/main.h b/bot/main.h index 610061f..a72927a 100644 --- a/bot/main.h +++ b/bot/main.h @@ -63,6 +63,8 @@ long GetTickCount(); char* strlwr(char* str); #endif +#define SPECIAL_ACTION_NONE 0 + #pragma pack(1) typedef struct _PLAYER_SPAWN_INFO { diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 22ca0c2..b2a0322 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -220,6 +220,18 @@ BOOL CNetGame::GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, } } +BYTE CNetGame::GetPlayerSpecialAction(PLAYERID playerId) +{ + if(playerId >= MAX_PLAYERS) return SPECIAL_ACTION_NONE; + if(bPlayerSlotState[playerId] == FALSE) return SPECIAL_ACTION_NONE; + + if(bytePlayerState[playerId] == PLAYER_STATE_ONFOOT) + { + return unnamed_3[playerId].byteSpecialAction; + } + return SPECIAL_ACTION_NONE; +} + //---------------------------------------------------- // MATCH BOOL CNetGame::IsPlayerAdded(PLAYERID playerId) diff --git a/bot/net/netgame.h b/bot/net/netgame.h index 83b66af..616d686 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -111,6 +111,7 @@ public: BYTE GetPlayerHealth(PLAYERID playerId); BYTE GetPlayerArmour(PLAYERID playerId); BOOL GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, WORD *wKeys); + BYTE GetPlayerSpecialAction(PLAYERID playerId); BOOL IsPlayerAdded(PLAYERID playerId); BOOL IsVehicleAdded(VEHICLEID VehicleID); PVECTOR GetMyPos(PVECTOR Vector); diff --git a/bot/scrcustom.cpp b/bot/scrcustom.cpp index 01fa993..c8a9de9 100644 --- a/bot/scrcustom.cpp +++ b/bot/scrcustom.cpp @@ -206,8 +206,11 @@ static cell AMX_NATIVE_CALL n_GetPlayerArmour(AMX *amx, cell *params) // native GetPlayerSpecialAction(playerid) static cell AMX_NATIVE_CALL n_GetPlayerSpecialAction(AMX *amx, cell *params) { - // TODO: n_GetPlayerSpecialAction - return 0; + if (pNetGame->GetPlayerPool()->GetSlotState((PLAYERID)params[1])) + { + return (cell)pNetGame->GetPlayerSpecialAction((PLAYERID)params[1]); + } + return SPECIAL_ACTION_NONE; } // native IsPlayerStreamedIn(playerid)