[saco] Implement/match ScrSetPlayerHealth(...)

This commit is contained in:
RD42 2024-10-17 17:25:56 +08:00
parent 694b02e99a
commit 1ff45278eb
2 changed files with 20 additions and 4 deletions

View File

@ -129,7 +129,7 @@
#define RPC_ScrSetPlayerName "\x0B" #define RPC_ScrSetPlayerName "\x0B"
#define RPC_ScrSetPlayerPos "\x0C" #define RPC_ScrSetPlayerPos "\x0C"
#define RPC_ScrUnk0D "\x0D" #define RPC_ScrUnk0D "\x0D"
#define RPC_ScrUnk0E "\x0E" #define RPC_ScrSetPlayerHealth "\x0E"
#define RPC_ScrPutPlayerInVehicle "\x46" #define RPC_ScrPutPlayerInVehicle "\x46"
#define RPC_ScrRemovePlayerFromVehicle "\x47" #define RPC_ScrRemovePlayerFromVehicle "\x47"
#define RPC_ScrSetPlayerColor "\x48" #define RPC_ScrSetPlayerColor "\x48"

View File

@ -58,7 +58,6 @@ void ScrUnk45(RPCParameters *rpcParams) {}
void ScrUnk99(RPCParameters *rpcParams) {} void ScrUnk99(RPCParameters *rpcParams) {}
void ScrSetPlayerPos(RPCParameters *rpcParams) {} void ScrSetPlayerPos(RPCParameters *rpcParams) {}
void ScrUnk0D(RPCParameters *rpcParams) {} void ScrUnk0D(RPCParameters *rpcParams) {}
void ScrUnk0E(RPCParameters *rpcParams) {}
void ScrPutPlayerInVehicle(RPCParameters *rpcParams) {} void ScrPutPlayerInVehicle(RPCParameters *rpcParams) {}
void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams) {} void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams) {}
void ScrSetPlayerColor(RPCParameters *rpcParams) {} void ScrSetPlayerColor(RPCParameters *rpcParams) {}
@ -135,6 +134,23 @@ void ScrSetPlayerName(RPCParameters *rpcParams)
//---------------------------------------------------- //----------------------------------------------------
void ScrSetPlayerHealth(RPCParameters *rpcParams)
{
PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
int iBitLength = rpcParams->numberOfBitsOfData;
PlayerID sender = rpcParams->sender;
CLocalPlayer *pLocalPlayer = pNetGame->GetPlayerPool()->GetLocalPlayer();
float fHealth;
RakNet::BitStream bsData(Data,(iBitLength/8)+1,false);
bsData.Read(fHealth);
pLocalPlayer->GetPlayerPed()->SetHealth(fHealth);
}
//----------------------------------------------------
void ScrSetCameraPos(RPCParameters *rpcParams) void ScrSetCameraPos(RPCParameters *rpcParams)
{ {
PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input); PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
@ -312,7 +328,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient)
REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerName); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerName);
REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos);
REGISTER_STATIC_RPC(pRakClient, ScrUnk0D); REGISTER_STATIC_RPC(pRakClient, ScrUnk0D);
REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerHealth);
REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);
@ -420,7 +436,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient)
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99);
UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0D); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0D);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerHealth);
UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);