Skip to content

Commit

Permalink
Merge pull request #1 from ziggi/ResetPlayerMarkerForPlayer
Browse files Browse the repository at this point in the history
ResetPlayerMarkerForPlayer function
  • Loading branch information
IS4Code authored Jul 11, 2016
2 parents 655f9b9 + 2ca563d commit ed6e459
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions pawno/include/YSF.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ native HidePlayerForPlayer(forplayerid, playerid);
native AddPlayerForPlayer(forplayerid, playerid, isnpc = 0);
native RemovePlayerForPlayer(forplayerid, playerid);
native SetPlayerChatBubbleForPlayer(forplayerid, playerid, const text[], color, Float:drawdistance, expiretime);
native ResetPlayerMarkerForPlayer(playerid, resetplayerid);
native SetPlayerVersion(playerid, const version[]);
native IsPlayerSpawned(playerid);
native IsPlayerControllable(playerid);
Expand Down
11 changes: 11 additions & 0 deletions src/src/CPlayerData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ CPlayerData::~CPlayerData( void )

}

bool CPlayerData::ResetPlayerMarkerForPlayer(WORD resetplayerid)
{
CPlayer *p = pNetGame->pPlayerPool->pPlayer[resetplayerid];

RakNet::BitStream bs;
bs.Write(resetplayerid);
bs.Write(p->dwNickNameColor);
pRakServer->RPC(&RPC_SetPlayerColor, &bs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, pRakServer->GetPlayerIDFromIndex(wPlayerID), 0, 0);
return true;
}

bool CPlayerData::SetPlayerTeamForPlayer(WORD teamplayerid, int team)
{
m_iTeams[teamplayerid] = team;
Expand Down
2 changes: 2 additions & 0 deletions src/src/CPlayerData.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class CPlayerData
CPlayerData(WORD playerid);
~CPlayerData(void);

bool ResetPlayerMarkerForPlayer(WORD resetplayerid);

bool SetPlayerTeamForPlayer(WORD teamplayerid, int team);
int GetPlayerTeamForPlayer(WORD teamplayerid);
inline void ResetPlayerTeam(WORD playerid) { m_iTeams[playerid] = -1; }
Expand Down
1 change: 1 addition & 0 deletions src/src/RPCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ int RPC_WorldPlayerRemove = 163;
int RPC_ChatBubble = 0x3B;
int RPC_SetPlayerSkin = 0x99;
int RPC_SetPlayerName = 0x0B;
int RPC_SetPlayerColor = 72;
int RPC_SetFightingStyle = 0x59;
int RPC_ScrApplyAnimation = 0x56;
int RPC_ClientMessage = 0x5D;
Expand Down
1 change: 1 addition & 0 deletions src/src/RPCs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern int RPC_WorldPlayerRemove;
extern int RPC_ChatBubble;
extern int RPC_SetPlayerSkin;
extern int RPC_SetPlayerName;
extern int RPC_SetPlayerColor;
extern int RPC_SetFightingStyle;
extern int RPC_ScrApplyAnimation;
extern int RPC_ClientMessage;
Expand Down
20 changes: 19 additions & 1 deletion src/src/Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,23 @@ static cell AMX_NATIVE_CALL Natives::SetPlayerChatBubbleForPlayer( AMX* amx, cel
return 0;
}

// native ResetPlayerMarkerForPlayer(playerid, resetplayerid)
static cell AMX_NATIVE_CALL Natives::ResetPlayerMarkerForPlayer(AMX* amx, cell* params)
{
// If unknown server version
if (!pServer)
return 0;

CHECK_PARAMS(2, "ResetPlayerMarkerForPlayer");

int playerid = static_cast<int>(params[1]);
int resetplayerid = static_cast<int>(params[2]);

if (!IsPlayerConnectedEx(playerid) || !IsPlayerConnectedEx(resetplayerid)) return 0;

return pPlayerData[playerid]->ResetPlayerMarkerForPlayer(static_cast<WORD>(resetplayerid));
}

// native SetPlayerVersion(playerid, version[];
static cell AMX_NATIVE_CALL Natives::SetPlayerVersion( AMX* amx, cell* params )
{
Expand Down Expand Up @@ -6636,7 +6653,8 @@ AMX_NATIVE_INFO YSINatives [] =
{ "HidePlayerForPlayer", Natives::HidePlayerForPlayer }, // R8
{ "AddPlayerForPlayer", Natives::AddPlayerForPlayer }, // R17
{ "RemovePlayerForPlayer", Natives::RemovePlayerForPlayer }, // R17
{ "SetPlayerChatBubbleForPlayer", Natives::SetPlayerChatBubbleForPlayer}, // R10
{ "SetPlayerChatBubbleForPlayer", Natives::SetPlayerChatBubbleForPlayer }, // R10
{ "ResetPlayerMarkerForPlayer", Natives::ResetPlayerMarkerForPlayer },
{ "SetPlayerVersion", Natives::SetPlayerVersion }, // R9
{ "IsPlayerSpawned", Natives::IsPlayerSpawned }, // R9
{"IsPlayerControllable", Natives::IsPlayerControllable}, // R11
Expand Down
1 change: 1 addition & 0 deletions src/src/Scripting.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace Natives
static cell AMX_NATIVE_CALL AddPlayerForPlayer(AMX *amx, cell *params); // R17
static cell AMX_NATIVE_CALL RemovePlayerForPlayer(AMX *amx, cell *params); // R17
static cell AMX_NATIVE_CALL SetPlayerChatBubbleForPlayer(AMX *amx, cell *params); // R10
static cell AMX_NATIVE_CALL ResetPlayerMarkerForPlayer(AMX *amx, cell *params);
static cell AMX_NATIVE_CALL SetPlayerVersion(AMX *amx, cell *params); // R9
static cell AMX_NATIVE_CALL IsPlayerSpawned(AMX *amx, cell *params); // R9
static cell AMX_NATIVE_CALL IsPlayerControllable(AMX *amx, cell *params); // R11
Expand Down

0 comments on commit ed6e459

Please sign in to comment.