fixed last commits

This commit is contained in:
oy 2010-10-11 01:06:44 +02:00
parent 8557d3a022
commit b65a26fe93
6 changed files with 29 additions and 22 deletions

View file

@ -209,7 +209,7 @@ File
== Fichier
Filename:
== Nom du fichier :
== Nom du fichier:
Filter
== Filtre
@ -236,7 +236,7 @@ Game type
== Type de jeu
Game types:
== Types de jeu :
== Types de jeu:
General
== Général
@ -335,7 +335,7 @@ Map
== Carte
Maximum ping:
== Ping maximum :
== Ping maximum:
Miscellaneous
== Divers
@ -371,7 +371,7 @@ Nickname
== Pseudonyme
Name:
== Nom :
== Nom:
No
== Non

View file

@ -634,7 +634,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
{
// OH FUCK! wrong version, drop him
char aReason[256];
str_format(aReason, sizeof(aReason), "Wrong version : server is running \"%s\" and client \"%s\"", GameServer()->NetVersion(), aVersion);
str_format(aReason, sizeof(aReason), "Wrong version. Server is running '%s' and client '%s'", GameServer()->NetVersion(), aVersion);
m_NetServer.Drop(ClientId, aReason);
return;
}

View file

@ -425,13 +425,13 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(s_ControlPage == 1)
{
CUIRect Reason;
Bottom.VSplitRight(140.0f, &Bottom, &Reason);
Bottom.VSplitRight(200.0f, &Bottom, &Reason);
Bottom.VSplitRight(40.0f, &Bottom, 0);
Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:");
UI()->DoLabel(&Reason, pLabel, 14.0f, -1);
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
Reason.VSplitLeft(w, 0, &Reason);
Reason.VSplitLeft(10.0f, 0, &Reason);
Reason.VSplitLeft(w+10.0f, 0, &Reason);
static float s_Offset = 0.0f;
DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL);
}
@ -453,7 +453,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer);
m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_aCallvoteReason[0] = 0;
SetActive(false);
}
}

View file

@ -29,7 +29,7 @@ void CVoting::Callvote(const char *pType, const char *pValue)
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
}
void CVoting::CallvoteKick(int ClientId, char *pReason)
void CVoting::CallvoteKick(int ClientId, const char *pReason)
{
char aBuf[32];
if(pReason[0])
@ -55,11 +55,14 @@ void CVoting::CallvoteOption(int OptionId)
}
}
void CVoting::ForcevoteKick(int ClientId)
void CVoting::ForcevoteKick(int ClientId, const char *pReason)
{
char Buf[32];
str_format(Buf, sizeof(Buf), "kick %d", ClientId);
Client()->Rcon(Buf);
char aBuf[32];
if(pReason[0])
str_format(aBuf, sizeof(aBuf), "kick %d \"%s\"", ClientId, pReason);
else
str_format(aBuf, sizeof(aBuf), "kick %d", ClientId);
Client()->Rcon(aBuf);
}
void CVoting::ForcevoteOption(int OptionId)

View file

@ -39,9 +39,9 @@ public:
void RenderBars(CUIRect Bars, bool Text);
void CallvoteKick(int ClientId, char *pReason);
void CallvoteKick(int ClientId, const char *pReason);
void CallvoteOption(int Option);
void ForcevoteKick(int ClientId);
void ForcevoteKick(int ClientId, const char *pReason);
void ForcevoteOption(int Option);
void Vote(int v); // -1 = no, 1 = yes

View file

@ -670,21 +670,24 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
}
const char *pReason = "No reason given";
for(int i = 0; i < str_length(pMsg->m_Value)-1; i++)
for(const char *p = pMsg->m_Value; *p; ++p)
{
if(pMsg->m_Value[i] == ' ')
pReason = &pMsg->m_Value[i+1];
if(*p == ' ')
{
pReason = p+1;
break;
}
}
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientId), Server()->ClientName(KickId), pReason);
str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId));
if (!g_Config.m_SvVoteKickBantime)
str_format(aCmd, sizeof(aCmd), "kick %d %s", KickId, pReason);
str_format(aCmd, sizeof(aCmd), "kick %d \"Kicked by vote\"", KickId);
else
{
char aBuf[64] = {0};
Server()->GetClientIP(KickId, aBuf, sizeof(aBuf));
str_format(aCmd, sizeof(aCmd), "ban %s %d %s", aBuf, g_Config.m_SvVoteKickBantime, pReason);
str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime);
}
}