From 05e65e3d17d95986c6b3f4ded85cfa6fa75b4212 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:36:16 +0800 Subject: [PATCH] [bot] Implement `ScrSetSpawnInfo(...)` --- bot/main.h | 8 ++++++++ bot/net/scriptrpc.cpp | 21 +++++++++++++++++---- raknet/SAMPRPC.h | 2 +- saco/net/scriptrpc.cpp | 6 +++--- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/bot/main.h b/bot/main.h index 31f5375..469116b 100644 --- a/bot/main.h +++ b/bot/main.h @@ -61,3 +61,11 @@ void SignalHandler(int sig); long GetTickCount(); char* strlwr(char* str); #endif + +#pragma pack(1) +typedef struct _PLAYER_SPAWN_INFO +{ + char _gap0[46]; + +} PLAYER_SPAWN_INFO; + diff --git a/bot/net/scriptrpc.cpp b/bot/net/scriptrpc.cpp index 0cbba99..95f16a3 100644 --- a/bot/net/scriptrpc.cpp +++ b/bot/net/scriptrpc.cpp @@ -1,11 +1,24 @@ #include "../main.h" -void ScrUnk44(RPCParameters *rpcParams) +using namespace RakNet; +extern CNetGame* pNetGame; + +//---------------------------------------------------- + +void ScrSetSpawnInfo(RPCParameters *rpcParams) { - // TODO: ScrUnk44 + PCHAR Data = reinterpret_cast(rpcParams->input); + int iBitLength = rpcParams->numberOfBitsOfData; + PlayerID sender = rpcParams->sender; + PLAYER_SPAWN_INFO SpawnInfo; + RakNet::BitStream bsData(Data,(iBitLength/8)+1,false); + CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool(); + bsData.Read((PCHAR)&SpawnInfo, sizeof(PLAYER_SPAWN_INFO)); } +//---------------------------------------------------- + void ScrUnk45(RPCParameters *rpcParams) {} void ScrUnk99(RPCParameters *rpcParams) {} void ScrUnk0B(RPCParameters *rpcParams) {} @@ -121,7 +134,7 @@ void ScrUnk58(RPCParameters *rpcParams) {} void RegisterScriptRPCs(RakClientInterface* pRakClient) { - REGISTER_STATIC_RPC(pRakClient, ScrUnk44); + REGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); REGISTER_STATIC_RPC(pRakClient, ScrUnk45); REGISTER_STATIC_RPC(pRakClient, ScrUnk99); REGISTER_STATIC_RPC(pRakClient, ScrUnk0B); @@ -195,7 +208,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) void UnRegisterScriptRPCs(RakClientInterface* pRakClient) { - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk44); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk45); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0B); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99); diff --git a/raknet/SAMPRPC.h b/raknet/SAMPRPC.h index 06369a0..d7ff222 100644 --- a/raknet/SAMPRPC.h +++ b/raknet/SAMPRPC.h @@ -123,7 +123,7 @@ #define RPC_ScrUnk5C "\x5C" #define RPC_ScrUnk96 "\x96" #define RPC_ScrUnk70 "\x70" -#define RPC_ScrUnk44 "\x44" +#define RPC_ScrSetSpawnInfo "\x44" #define RPC_ScrUnk45 "\x45" #define RPC_ScrUnk99 "\x99" #define RPC_ScrUnk0B "\x0B" diff --git a/saco/net/scriptrpc.cpp b/saco/net/scriptrpc.cpp index a54c1fd..8a17951 100644 --- a/saco/net/scriptrpc.cpp +++ b/saco/net/scriptrpc.cpp @@ -50,7 +50,7 @@ void ScrUnk62(RPCParameters *rpcParams) {} void ScrUnk5C(RPCParameters *rpcParams) {} void ScrUnk96(RPCParameters *rpcParams) {} void ScrUnk70(RPCParameters *rpcParams) {} -void ScrUnk44(RPCParameters *rpcParams) {} +void ScrSetSpawnInfo(RPCParameters *rpcParams) {} void ScrUnk45(RPCParameters *rpcParams) {} void ScrUnk99(RPCParameters *rpcParams) {} void ScrUnk0B(RPCParameters *rpcParams) {} @@ -150,7 +150,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) REGISTER_STATIC_RPC(pRakClient, ScrUnk5C); REGISTER_STATIC_RPC(pRakClient, ScrUnk96); REGISTER_STATIC_RPC(pRakClient, ScrUnk70); - REGISTER_STATIC_RPC(pRakClient, ScrUnk44); + REGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); REGISTER_STATIC_RPC(pRakClient, ScrUnk45); REGISTER_STATIC_RPC(pRakClient, ScrUnk99); REGISTER_STATIC_RPC(pRakClient, ScrUnk0B); @@ -258,7 +258,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient) UNREGISTER_STATIC_RPC(pRakClient, ScrUnk29); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk2A); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk2B); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk44); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk45); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0B); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99);