Check IDs in a more reasonable order

This commit is contained in:
def 2015-08-12 15:54:03 +02:00
parent b89c4f767c
commit 9d5459d731

View file

@ -1247,8 +1247,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
}
int KickID = str_toint(pMsg->m_Value);
if (!Server()->ReverseTranslate(KickID, ClientID))
return;
if(KickID < 0 || KickID >= MAX_CLIENTS || !m_apPlayers[KickID])
{
@ -1260,6 +1258,10 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
SendChatTarget(ClientID, "You can't kick yourself");
return;
}
if (!Server()->ReverseTranslate(KickID, ClientID))
{
return;
}
//if(Server()->IsAuthed(KickID))
if(m_apPlayers[KickID]->m_Authed > 0 && m_apPlayers[KickID]->m_Authed >= pPlayer->m_Authed)
{
@ -1302,8 +1304,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
}
int SpectateID = str_toint(pMsg->m_Value);
if (!Server()->ReverseTranslate(SpectateID, ClientID))
return;
if(SpectateID < 0 || SpectateID >= MAX_CLIENTS || !m_apPlayers[SpectateID] || m_apPlayers[SpectateID]->GetTeam() == TEAM_SPECTATORS)
{
@ -1315,6 +1315,10 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
SendChatTarget(ClientID, "You can't move yourself");
return;
}
if (!Server()->ReverseTranslate(SpectateID, ClientID))
{
return;
}
if(!GetPlayerChar(ClientID) || !GetPlayerChar(SpectateID) || GetDDRaceTeam(ClientID) != GetDDRaceTeam(SpectateID))
{