From aca41ed816bf8459b63e750d7a234c8984e66c92 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:55:46 +0800 Subject: [PATCH] [bot] Implement `ServerQuit(...)` --- bot/net/netrpc.cpp | 21 +++++++++++++++++---- raknet/SAMPRPC.h | 2 +- saco/net/netrpc.cpp | 6 +++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/bot/net/netrpc.cpp b/bot/net/netrpc.cpp index e52863b..2ef8816 100644 --- a/bot/net/netrpc.cpp +++ b/bot/net/netrpc.cpp @@ -83,9 +83,22 @@ void Unk89(RPCParameters *rpcParams) // TODO: Unk89 } -void Unk8A(RPCParameters *rpcParams) +void ServerQuit(RPCParameters *rpcParams) { - // TODO: Unk8A + PCHAR Data = reinterpret_cast(rpcParams->input); + int iBitLength = rpcParams->numberOfBitsOfData; + PlayerID sender = rpcParams->sender; + + RakNet::BitStream bsData(Data,(iBitLength/8)+1,false); + CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool(); + PLAYERID playerId; + BYTE byteReason; + + bsData.Read(playerId); + bsData.Read(byteReason); + + // Delete this client from the player pool. + pPlayerPool->Delete(playerId,byteReason); } void Unk8B(RPCParameters *rpcParams) @@ -173,7 +186,7 @@ void RegisterRPCs(RakClientInterface * pRakClient) REGISTER_STATIC_RPC(pRakClient,Unk1D); REGISTER_STATIC_RPC(pRakClient,Unk1E); REGISTER_STATIC_RPC(pRakClient,Unk89); - REGISTER_STATIC_RPC(pRakClient,Unk8A); + REGISTER_STATIC_RPC(pRakClient,ServerQuit); REGISTER_STATIC_RPC(pRakClient,Unk8B); REGISTER_STATIC_RPC(pRakClient,Chat); REGISTER_STATIC_RPC(pRakClient,RequestClass); @@ -214,7 +227,7 @@ void UnRegisterRPCs(RakClientInterface * pRakClient) UNREGISTER_STATIC_RPC(pRakClient,UnkA4); UNREGISTER_STATIC_RPC(pRakClient,UnkA5); UNREGISTER_STATIC_RPC(pRakClient,Unk89); - UNREGISTER_STATIC_RPC(pRakClient,Unk8A); + UNREGISTER_STATIC_RPC(pRakClient,ServerQuit); UNREGISTER_STATIC_RPC(pRakClient,Unk8B); UNREGISTER_STATIC_RPC(pRakClient,Chat); UNREGISTER_STATIC_RPC(pRakClient,RequestClass); diff --git a/raknet/SAMPRPC.h b/raknet/SAMPRPC.h index d7ff222..46d9b2f 100644 --- a/raknet/SAMPRPC.h +++ b/raknet/SAMPRPC.h @@ -46,8 +46,8 @@ #define RPC_EnterVehicle "\x1A" #define RPC_ExitVehicle "\x9A" #define RPC_Unk89 "\x89" -#define RPC_Unk8A "\x8A" #define RPC_Unk8B "\x8B" +#define RPC_ServerQuit "\x8A" #define RPC_Chat "\x65" #define RPC_RequestClass "\x80" #define RPC_RequestSpawn "\x81" diff --git a/saco/net/netrpc.cpp b/saco/net/netrpc.cpp index 6489da6..db8b114 100644 --- a/saco/net/netrpc.cpp +++ b/saco/net/netrpc.cpp @@ -35,8 +35,8 @@ void Unk18(RPCParameters *rpcParams) {} void EnterVehicle(RPCParameters *rpcParams) {} void ExitVehicle(RPCParameters *rpcParams) {} void Unk89(RPCParameters *rpcParams) {} -void Unk8A(RPCParameters *rpcParams) {} void Unk8B(RPCParameters *rpcParams) {} +void ServerQuit(RPCParameters *rpcParams) {} void Chat(RPCParameters *rpcParams) {} void RequestClass(RPCParameters *rpcParams) {} void RequestSpawn(RPCParameters *rpcParams) {} @@ -86,8 +86,8 @@ void RegisterRPCs(RakClientInterface * pRakClient) REGISTER_STATIC_RPC(pRakClient,EnterVehicle); REGISTER_STATIC_RPC(pRakClient,ExitVehicle); REGISTER_STATIC_RPC(pRakClient,Unk89); - REGISTER_STATIC_RPC(pRakClient,Unk8A); REGISTER_STATIC_RPC(pRakClient,Unk8B); + REGISTER_STATIC_RPC(pRakClient,ServerQuit); REGISTER_STATIC_RPC(pRakClient,Chat); REGISTER_STATIC_RPC(pRakClient,RequestClass); REGISTER_STATIC_RPC(pRakClient,RequestSpawn); @@ -123,8 +123,8 @@ void UnRegisterRPCs(RakClientInterface * pRakClient) UNREGISTER_STATIC_RPC(pRakClient,Unk3B); UNREGISTER_STATIC_RPC(pRakClient,Unk3D); UNREGISTER_STATIC_RPC(pRakClient,Unk89); - UNREGISTER_STATIC_RPC(pRakClient,Unk8A); UNREGISTER_STATIC_RPC(pRakClient,Unk8B); + UNREGISTER_STATIC_RPC(pRakClient,ServerQuit); UNREGISTER_STATIC_RPC(pRakClient,Chat); UNREGISTER_STATIC_RPC(pRakClient,Unk6B); UNREGISTER_STATIC_RPC(pRakClient,Unk25);