mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement/match ScrSetPlayerColor(...)
This commit is contained in:
parent
1ff45278eb
commit
5e46ec5702
@ -1,5 +1,6 @@
|
||||
|
||||
#include "../main.h"
|
||||
#include "../game/util.h"
|
||||
|
||||
extern CGame *pGame;
|
||||
|
||||
@ -84,3 +85,10 @@ void CLocalPlayer::Say(PCHAR szText)
|
||||
|
||||
//----------------------------------------------------------
|
||||
|
||||
void CLocalPlayer::SetPlayerColor(DWORD dwColor)
|
||||
{
|
||||
SetRadarColor(pNetGame->GetPlayerPool()->GetLocalPlayerID(),dwColor);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
|
||||
void Say(PCHAR szText);
|
||||
|
||||
void SetPlayerColor(DWORD dwColor);
|
||||
BOOL IsSpectating() { return m_bIsSpectating; };
|
||||
|
||||
void ReturnToClassSelection() { m_bWantsAnotherClass = TRUE; };
|
||||
|
@ -13,7 +13,7 @@ CPlayerPool::CPlayerPool()
|
||||
m_pLocalPlayer = new CLocalPlayer();
|
||||
field_0 = 0;
|
||||
field_22 = 0;
|
||||
field_4 = 0;
|
||||
m_LocalPlayerID = 0;
|
||||
field_2F3A = 0;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@
|
||||
class CPlayerPool
|
||||
{
|
||||
private:
|
||||
|
||||
int field_0;
|
||||
short field_4;
|
||||
PLAYERID m_LocalPlayerID;
|
||||
std::string field_6;
|
||||
int field_22;
|
||||
CLocalPlayer *m_pLocalPlayer;
|
||||
@ -33,6 +34,15 @@ public:
|
||||
|
||||
CLocalPlayer * GetLocalPlayer() { return m_pLocalPlayer; };
|
||||
|
||||
CRemotePlayer* GetAt(PLAYERID playerId) {
|
||||
if(playerId > MAX_PLAYERS) { return NULL; }
|
||||
CNetPlayer *pNetPlayer = m_pPlayers[playerId];
|
||||
if(pNetPlayer) return pNetPlayer->m_pRemotePlayer;
|
||||
return NULL;
|
||||
};
|
||||
|
||||
PLAYERID GetLocalPlayerID() { return m_LocalPlayerID; };
|
||||
|
||||
CPlayerPool();
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include "../main.h"
|
||||
#include "../game/util.h"
|
||||
|
||||
extern CGame *pGame;
|
||||
|
||||
@ -61,3 +62,11 @@ void CRemotePlayer::ResetAllSyncAttributes()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void CRemotePlayer::SetPlayerColor(DWORD dwColor)
|
||||
{
|
||||
SetRadarColor(m_PlayerID,dwColor);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
|
||||
void ResetAllSyncAttributes();
|
||||
|
||||
void SetPlayerColor(DWORD dwColor);
|
||||
};
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -60,7 +60,6 @@ void ScrSetPlayerPos(RPCParameters *rpcParams) {}
|
||||
void ScrUnk0D(RPCParameters *rpcParams) {}
|
||||
void ScrPutPlayerInVehicle(RPCParameters *rpcParams) {}
|
||||
void ScrRemovePlayerFromVehicle(RPCParameters *rpcParams) {}
|
||||
void ScrSetPlayerColor(RPCParameters *rpcParams) {}
|
||||
void ScrDisplayGameText(RPCParameters *rpcParams) {}
|
||||
void ScrSetInterior(RPCParameters *rpcParams) {}
|
||||
void ScrUnk9F(RPCParameters *rpcParams) {}
|
||||
@ -149,6 +148,31 @@ void ScrSetPlayerHealth(RPCParameters *rpcParams)
|
||||
pLocalPlayer->GetPlayerPed()->SetHealth(fHealth);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ScrSetPlayerColor(RPCParameters *rpcParams)
|
||||
{
|
||||
PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
|
||||
int iBitLength = rpcParams->numberOfBitsOfData;
|
||||
PlayerID sender = rpcParams->sender;
|
||||
|
||||
RakNet::BitStream bsData(Data,(iBitLength/8)+1,false);
|
||||
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
|
||||
PLAYERID playerId;
|
||||
DWORD dwColor;
|
||||
|
||||
bsData.Read(playerId);
|
||||
bsData.Read(dwColor);
|
||||
|
||||
if(playerId == pPlayerPool->GetLocalPlayerID()) {
|
||||
pPlayerPool->GetLocalPlayer()->SetPlayerColor(dwColor);
|
||||
} else {
|
||||
CRemotePlayer *pPlayer = pPlayerPool->GetAt(playerId);
|
||||
if(pPlayer) pPlayer->SetPlayerColor(dwColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ScrSetCameraPos(RPCParameters *rpcParams)
|
||||
|
Loading…
Reference in New Issue
Block a user