From 6038cf0a59fcb53a01bf043a262a76eb1dc8c12c Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 7 Jun 2024 22:56:29 +0800 Subject: [PATCH] [bot] Implement `ScrSetPlayerPos(...)` --- bot/net/scriptrpc.cpp | 17 ++++++++++++----- raknet/SAMPRPC.h | 2 +- saco/net/scriptrpc.cpp | 6 +++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bot/net/scriptrpc.cpp b/bot/net/scriptrpc.cpp index 11c0efa..9565923 100644 --- a/bot/net/scriptrpc.cpp +++ b/bot/net/scriptrpc.cpp @@ -3,6 +3,7 @@ using namespace RakNet; extern CNetGame* pNetGame; +extern ONFOOT_SYNC_DATA ofSync; //---------------------------------------------------- @@ -37,9 +38,16 @@ void ScrUnk99(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk0C(RPCParameters *rpcParams) +void ScrSetPlayerPos(RPCParameters *rpcParams) { - // TODO: ScrUnk0C + PCHAR Data = reinterpret_cast(rpcParams->input); + int iBitLength = rpcParams->numberOfBitsOfData; + PlayerID sender = rpcParams->sender; + RakNet::BitStream bsData(Data,(iBitLength/8)+1,false); + + bsData.Read(ofSync.vecPos.X); + bsData.Read(ofSync.vecPos.Y); + bsData.Read(ofSync.vecPos.Z); } //---------------------------------------------------- @@ -188,7 +196,6 @@ void ScrSetPlayerFacingAngle(RPCParameters *rpcParams) //---------------------------------------------------- - void ScrUnk14(RPCParameters *rpcParams) { } @@ -459,7 +466,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) REGISTER_STATIC_RPC(pRakClient, ScrUnk45); REGISTER_STATIC_RPC(pRakClient, ScrUnk99); REGISTER_STATIC_RPC(pRakClient, ScrUnk0B); - REGISTER_STATIC_RPC(pRakClient, ScrUnk0C); + REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); REGISTER_STATIC_RPC(pRakClient, ScrUnk0D); REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); REGISTER_STATIC_RPC(pRakClient, ScrUnk46); @@ -533,7 +540,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient) UNREGISTER_STATIC_RPC(pRakClient, ScrUnk45); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0B); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0C); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0D); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk46); diff --git a/raknet/SAMPRPC.h b/raknet/SAMPRPC.h index ce68b10..c40b771 100644 --- a/raknet/SAMPRPC.h +++ b/raknet/SAMPRPC.h @@ -127,7 +127,7 @@ #define RPC_ScrUnk45 "\x45" #define RPC_ScrUnk99 "\x99" #define RPC_ScrUnk0B "\x0B" -#define RPC_ScrUnk0C "\x0C" +#define RPC_ScrSetPlayerPos "\x0C" #define RPC_ScrUnk0D "\x0D" #define RPC_ScrUnk0E "\x0E" #define RPC_ScrUnk46 "\x46" diff --git a/saco/net/scriptrpc.cpp b/saco/net/scriptrpc.cpp index 9ab8cf4..1c04343 100644 --- a/saco/net/scriptrpc.cpp +++ b/saco/net/scriptrpc.cpp @@ -54,7 +54,7 @@ void ScrSetSpawnInfo(RPCParameters *rpcParams) {} void ScrUnk45(RPCParameters *rpcParams) {} void ScrUnk99(RPCParameters *rpcParams) {} void ScrUnk0B(RPCParameters *rpcParams) {} -void ScrUnk0C(RPCParameters *rpcParams) {} +void ScrSetPlayerPos(RPCParameters *rpcParams) {} void ScrUnk0D(RPCParameters *rpcParams) {} void ScrUnk0E(RPCParameters *rpcParams) {} void ScrUnk46(RPCParameters *rpcParams) {} @@ -154,7 +154,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) REGISTER_STATIC_RPC(pRakClient, ScrUnk45); REGISTER_STATIC_RPC(pRakClient, ScrUnk99); REGISTER_STATIC_RPC(pRakClient, ScrUnk0B); - REGISTER_STATIC_RPC(pRakClient, ScrUnk0C); + REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); REGISTER_STATIC_RPC(pRakClient, ScrUnk0D); REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); REGISTER_STATIC_RPC(pRakClient, ScrUnk46); @@ -262,7 +262,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient) UNREGISTER_STATIC_RPC(pRakClient, ScrUnk45); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0B); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0C); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0D); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk46);