added unmute + some minor fix

This commit is contained in:
Floff Floffsson 2011-01-14 16:10:48 +01:00 committed by GreYFoXGTi
parent 9891ab8a10
commit 8c32c01653
4 changed files with 38 additions and 4 deletions

View file

@ -1404,7 +1404,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
Addr.port = AddrCheck.port = 0;
if(net_addr_comp(&Addr, &AddrCheck) == 0)
{
pServer->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "server", "you can't ban yourself");
pServer->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "server", "you can\'t ban yourself");
return;
}
}
@ -1416,7 +1416,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
{
if ((((CServer *)pUser)->m_aClients[ClientId1].m_Authed > 0) && ((CServer *)pUser)->m_aClients[ClientId1].m_Authed <= ((CServer *)pUser)->m_aClients[i].m_Authed)
{
pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "you can't ban an a player with the higher or same rank!");
pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "you can\'t ban a player with higher or same level");
return;
}
}

View file

@ -13,6 +13,7 @@ CONSOLE_COMMAND("helper", "v", CFGFLAG_SERVER, ConSetlvl1, this, "Authenticates
CONSOLE_COMMAND("moder", "v", CFGFLAG_SERVER, ConSetlvl2, this, "Authenticates player v to the level of 2", 3)
CONSOLE_COMMAND("admin", "v", CFGFLAG_SERVER, ConSetlvl3, this, "Authenticates player v to the level of 3 (CAUTION: Irreversible, once he is an admin you can't remove his status)", 3)
CONSOLE_COMMAND("mute", "vi", CFGFLAG_SERVER, ConMute, this, "Mutes player v for i seconds", 2)
CONSOLE_COMMAND("unmute", "v", CFGFLAG_SERVER, ConUnmute, this, "Unmutes player v", 2)
CONSOLE_COMMAND("invis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConInvis, this, "Makes player v invisible", 2)
CONSOLE_COMMAND("vis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConVis, this, "Makes player v visible again", 2)
CONSOLE_COMMAND("timerstop", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStop, this, "Stops the timer of player v", 2)

View file

@ -78,14 +78,46 @@ void CGameContext::ConMute(IConsole::IResult *pResult, void *pUserData, int Clie
if(Seconds < 10)
Seconds = 10;
if(pSelf->m_apPlayers[Victim]->m_Muted < Seconds * pSelf->Server()->TickSpeed())
{
if(Victim == ClientId) {
pSelf->SendChatTarget(ClientId, "You can\'t mute yourself");
}
else {
/*pSelf->m_apPlayers[Victim]->m_Muted = Seconds * pSelf->Server()->TickSpeed();
str_format(buf, sizeof(buf), "You have been muted by for %d seconds", pSelf->Server()->ClientName(Victim), Seconds);
pSelf->SendChatTarget(Victim, buf);*/
pSelf->m_apPlayers[Victim]->m_Muted = Seconds * pSelf->Server()->TickSpeed();
str_format(buf, sizeof(buf), "%s muted by %s for %d seconds", pSelf->Server()->ClientName(Victim), pSelf->Server()->ClientName(ClientId), Seconds);
pSelf->SendChat(-1, CGameContext::CHAT_ALL, buf);
}
}
void CGameContext::ConUnmute(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
char buf[512];
if(Victim == ClientId) {
pSelf->SendChatTarget(ClientId, "You can\'t unmute yourself");
}
else {
if(pSelf->m_apPlayers[Victim]->m_Muted > 0)
{
pSelf->m_apPlayers[Victim]->m_Muted = 0;
str_format(buf, sizeof(buf), "You have been unmuted", pSelf->Server()->ClientName(Victim));
pSelf->SendChatTarget(Victim, buf);
}
/*if(pSelf->m_apPlayers[Victim]->m_Muted > 0)
{
pSelf->m_apPlayers[Victim]->m_Muted = 0;
str_format(buf, sizeof(buf), "%s has been unmuted", pSelf->Server()->ClientName(Victim));
pSelf->SendChat(-1, CGameContext::CHAT_ALL, buf);
}*/
}
}
void CGameContext::ConSetlvl3(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;

View file

@ -60,6 +60,7 @@ class CGameContext : public IGameServer
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConMute(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConUnmute(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConLogOut(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConSetlvl1(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConSetlvl2(IConsole::IResult *pResult, void *pUserData, int ClientId);