[server] Implement/match CPlayer::SetPlayerColor(...)

This commit is contained in:
RD42 2024-09-20 23:35:31 +08:00
parent cace251a9d
commit fe626fdce5
5 changed files with 22 additions and 8 deletions

View File

@ -104,7 +104,7 @@ void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams)
//---------------------------------------------------- //----------------------------------------------------
void ScrUnk48(RPCParameters *rpcParams) void ScrSetPlayerColor(RPCParameters *rpcParams)
{ {
} }
@ -497,7 +497,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient)
REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); REGISTER_STATIC_RPC(pRakClient, ScrUnk0E);
REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrUnk48); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);
REGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); REGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText);
REGISTER_STATIC_RPC(pRakClient, ScrUnk9C); REGISTER_STATIC_RPC(pRakClient, ScrUnk9C);
REGISTER_STATIC_RPC(pRakClient, ScrUnk9D); REGISTER_STATIC_RPC(pRakClient, ScrUnk9D);
@ -571,7 +571,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient)
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E);
UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk48); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);
UNREGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); UNREGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9C); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9C);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9D); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9D);

View File

@ -132,7 +132,7 @@
#define RPC_ScrUnk0E "\x0E" #define RPC_ScrUnk0E "\x0E"
#define RPC_ScrPutPlayerInVehicle "\x46" #define RPC_ScrPutPlayerInVehicle "\x46"
#define RPC_ScrRemovePlayerFromVehicle "\x47" #define RPC_ScrRemovePlayerFromVehicle "\x47"
#define RPC_ScrUnk48 "\x48" #define RPC_ScrSetPlayerColor "\x48"
#define RPC_ScrDisplayGameText "\x49" #define RPC_ScrDisplayGameText "\x49"
#define RPC_ScrUnk9C "\x9C" #define RPC_ScrUnk9C "\x9C"
#define RPC_ScrSetCameraPos "\x9D" #define RPC_ScrSetCameraPos "\x9D"

View File

@ -59,7 +59,7 @@ void ScrUnk0D(RPCParameters *rpcParams) {}
void ScrUnk0E(RPCParameters *rpcParams) {} void ScrUnk0E(RPCParameters *rpcParams) {}
void ScrPutPlayerInVehicle(RPCParameters *rpcParams) {} void ScrPutPlayerInVehicle(RPCParameters *rpcParams) {}
void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams) {} void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams) {}
void ScrUnk48(RPCParameters *rpcParams) {} void ScrSetPlayerColor(RPCParameters *rpcParams) {}
void ScrDisplayGameText(RPCParameters *rpcParams) {} void ScrDisplayGameText(RPCParameters *rpcParams) {}
void ScrUnk9C(RPCParameters *rpcParams) {} void ScrUnk9C(RPCParameters *rpcParams) {}
void ScrUnk9D(RPCParameters *rpcParams) {} void ScrUnk9D(RPCParameters *rpcParams) {}
@ -159,7 +159,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient)
REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); REGISTER_STATIC_RPC(pRakClient, ScrUnk0E);
REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
REGISTER_STATIC_RPC(pRakClient, ScrUnk48); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);
REGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); REGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText);
REGISTER_STATIC_RPC(pRakClient, ScrUnk9C); REGISTER_STATIC_RPC(pRakClient, ScrUnk9C);
REGISTER_STATIC_RPC(pRakClient, ScrUnk9D); REGISTER_STATIC_RPC(pRakClient, ScrUnk9D);
@ -267,7 +267,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient)
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E);
UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk48); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor);
UNREGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); UNREGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9C); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9C);
UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9D); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9D);

View File

@ -23,7 +23,19 @@ void CPlayer::SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn)
//----------------------------------------------------
void CPlayer::SetPlayerColor(DWORD dwColor)
{
RakNet::BitStream bsColor;
m_dwColor = dwColor;
bsColor.Write(m_PlayerID);
bsColor.Write(dwColor);
pNetGame->BroadcastData(RPC_ScrSetPlayerColor, &bsColor, INVALID_PLAYER_ID, 2);
}
//---------------------------------------------------- //----------------------------------------------------

View File

@ -184,7 +184,7 @@ public:
char field_2C30; char field_2C30;
char field_2C31; char field_2C31;
VEHICLEID m_VehicleID; VEHICLEID m_VehicleID;
int field_2C34; DWORD m_dwColor;
BOOL m_bCheckpointEnabled; BOOL m_bCheckpointEnabled;
BOOL m_bRaceCheckpointEnabled; BOOL m_bRaceCheckpointEnabled;
int m_iInteriorId; int m_iInteriorId;
@ -223,6 +223,8 @@ public:
void SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn); void SetSpawnInfo(PLAYER_SPAWN_INFO *pSpawn);
void SetPlayerColor(DWORD dwColor);
void SetCheckpoint(float fX, float fY, float fZ, float fSize); void SetCheckpoint(float fX, float fY, float fZ, float fSize);
void ToggleCheckpoint(BOOL bEnabled); void ToggleCheckpoint(BOOL bEnabled);
void SetRaceCheckpoint(int iType, float fX, float fY, float fZ, float fNX, float fNY, float fNZ, float fSize); void SetRaceCheckpoint(int iType, float fX, float fY, float fZ, float fNX, float fNY, float fNZ, float fSize);