added system to generalize rcon commands

This commit is contained in:
heinrich5991 2010-11-07 17:08:09 +01:00
parent 6f35687e03
commit 470e2773ba
3 changed files with 174 additions and 446 deletions

View file

@ -1569,7 +1569,7 @@ void CServer::RegisterCommands()
{
m_pConsole = Kernel()->RequestInterface<IConsole>();
Console()->Register("kick", "i?t", CFGFLAG_SERVER, ConKick, this, "", 2);
Console()->Register("kick", "v?t", CFGFLAG_SERVER, ConKick, this, "", 2);
Console()->Register("ban", "s?ir", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "", 2);
Console()->Register("unban", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConUnban, this, "", 2);
Console()->Register("bans", "", CFGFLAG_SERVER|CFGFLAG_STORE, ConBans, this, "", 2);

View file

@ -7,59 +7,45 @@
#endif
CONSOLE_COMMAND("clear_votes", "", CFGFLAG_SERVER, ConClearVotes, this, "Clears the vote list", 4)
CONSOLE_COMMAND("kill_pl", "i", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player i and announces the kill", 2)
CONSOLE_COMMAND("logout", "?i", CFGFLAG_SERVER, ConLogOut, this, "If you are a helper or didn't specify [i] it logs you out, otherwise it logs player i out", 0)
CONSOLE_COMMAND("helper", "i", CFGFLAG_SERVER, ConSetlvl1, this, "Authenticates player i to the Level of 1", 2)
CONSOLE_COMMAND("moder", "i", CFGFLAG_SERVER, ConSetlvl2, this, "Authenticates player i to the Level of 2", 3)
CONSOLE_COMMAND("admin", "i", CFGFLAG_SERVER, ConSetlvl3, this, "Authenticates player i to the Level of 3 (CAUTION: Irreversible, once he is an admin you can't control him)", 3)
CONSOLE_COMMAND("mute", "ii", CFGFLAG_SERVER, ConMute, this, "Mutes player i1 for i2 seconds", 2)
CONSOLE_COMMAND("invis_me", "", CFGFLAG_SERVER, ConInvisMe, this, "Makes you invisible", 1)
CONSOLE_COMMAND("vis_me", "", CFGFLAG_SERVER, ConVisMe, this, "Makes you visible again", 1)
CONSOLE_COMMAND("invis", "i", CFGFLAG_SERVER, ConInvis, this, "Makes player i invisible", 2)
CONSOLE_COMMAND("vis", "i", CFGFLAG_SERVER, ConVis, this, "Makes player i visible again", 2)
CONSOLE_COMMAND("timerstop", "i", CFGFLAG_SERVER, ConTimerStop, this, "Stops the timer of player i", 2)
CONSOLE_COMMAND("timerstart", "i", CFGFLAG_SERVER, ConTimerStart, this, "Starts the timer of player i", 2)
CONSOLE_COMMAND("timerrestart", "i", CFGFLAG_SERVER, ConTimerReStart, this, "Sets the timer of player i to 0 and starts it", 2)
CONSOLE_COMMAND("timerzero", "i", CFGFLAG_SERVER, ConTimerZero, this, "Sets the timer of player i to 0 and stops it", 2)
CONSOLE_COMMAND("tele", "ii", CFGFLAG_SERVER, ConTeleport, this, "Teleports player i1 to player i2", 2)
CONSOLE_COMMAND("freeze", "i?i", CFGFLAG_SERVER, ConFreeze, this, "Freezes player i1 for i2 seconds (infinity by default)", 2)
CONSOLE_COMMAND("unfreeze", "i", CFGFLAG_SERVER, ConUnFreeze, this, "Unfreezes player i", 2)
CONSOLE_COMMAND("addweapon", "i?i", CFGFLAG_SERVER, ConAddWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4, ninja = 5)", 1)
CONSOLE_COMMAND("removeweapon", "i?i", CFGFLAG_SERVER, ConRemoveWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4)", 1)
CONSOLE_COMMAND("shotgun", "i", CFGFLAG_SERVER, ConShotgun, this, "Gives a shotgun to player i", 2)
CONSOLE_COMMAND("shotgun_me", "", CFGFLAG_SERVER, ConShotgunMe, this, "Gives shotgun to yourself", 1)
CONSOLE_COMMAND("grenade", "i", CFGFLAG_SERVER, ConGrenade, this, "Gives a grenade launcher to player i", 2)
CONSOLE_COMMAND("grenade_me", "", CFGFLAG_SERVER, ConGrenadeMe, this, "Gives grenade launcher to yourself", 1)
CONSOLE_COMMAND("rifle", "i", CFGFLAG_SERVER, ConRifle, this, "Gives a rifle to player i", 2)
CONSOLE_COMMAND("rifle_me", "", CFGFLAG_SERVER, ConRifleMe, this, "Gives rifle to yourself", 1)
CONSOLE_COMMAND("weapons", "i", CFGFLAG_SERVER, ConWeapons, this, "Gives all weapons to player i", 2)
CONSOLE_COMMAND("weapons_me", "", CFGFLAG_SERVER, ConWeaponsMe, this, "Gives all weapons to yourself", 1)
CONSOLE_COMMAND("unshotgun", "i", CFGFLAG_SERVER, ConUnShotgun, this, "Takes a shotgun from player i", 2)
CONSOLE_COMMAND("unshotgun_me", "", CFGFLAG_SERVER, ConUnShotgunMe, this, "Takes shotgun from yourself", 1)
CONSOLE_COMMAND("ungrenade", "i", CFGFLAG_SERVER, ConUnGrenade, this, "Takes a grenade launcher from player i", 2)
CONSOLE_COMMAND("ungrenade_me", "", CFGFLAG_SERVER, ConUnGrenadeMe, this, "Takes grenade launcher from yourself", 1)
CONSOLE_COMMAND("unrifle", "i", CFGFLAG_SERVER, ConUnRifle, this, "Takes a rifle from player i", 2)
CONSOLE_COMMAND("unrifle_me", "", CFGFLAG_SERVER, ConUnRifleMe, this, "Takes rifle from yourself", 1)
CONSOLE_COMMAND("unweapons", "i", CFGFLAG_SERVER, ConUnWeapons, this, "Takes all weapons from player i", 2)
CONSOLE_COMMAND("unweapons_me", "", CFGFLAG_SERVER, ConUnWeaponsMe, this, "Takes all weapons from yourself", 1)
CONSOLE_COMMAND("ninja", "i", CFGFLAG_SERVER, ConNinja, this, "Makes player i a ninja", 2)
CONSOLE_COMMAND("ninja_me", "", CFGFLAG_SERVER, ConNinjaMe, this, "Makes yourself a ninja", 1)
CONSOLE_COMMAND("hammer_me", "i", CFGFLAG_SERVER, ConHammerMe, this, "Sets your hammer power to i", 1)
CONSOLE_COMMAND("hammer", "ii", CFGFLAG_SERVER, ConHammer, this, "Sets the hammer power of player i1 to i2", 2)
CONSOLE_COMMAND("super", "i", CFGFLAG_SERVER, ConSuper, this, "Makes player i super", 2)
CONSOLE_COMMAND("unsuper", "i", CFGFLAG_SERVER, ConUnSuper, this, "Removes super from player i", 2)
CONSOLE_COMMAND("super_me", "", CFGFLAG_SERVER, ConSuperMe, this, "Makes yourself super", 1)
CONSOLE_COMMAND("unsuper_me", "", CFGFLAG_SERVER, ConUnSuperMe, this, "Removes super from yourself", 1)
CONSOLE_COMMAND("left", "?i", CFGFLAG_SERVER, ConGoLeft, this, "Makes you or player i move 1 tile left", 1)
CONSOLE_COMMAND("right", "?i", CFGFLAG_SERVER, ConGoRight, this, "Makes you or player i move 1 tile right", 1)
CONSOLE_COMMAND("up", "?i", CFGFLAG_SERVER, ConGoUp, this, "Makes you or player i move 1 tile up", 1)
CONSOLE_COMMAND("down", "?i", CFGFLAG_SERVER, ConGoDown, this, "Makes you or player i move 1 tile down", 1)
CONSOLE_COMMAND("move", "ii?i", CFGFLAG_SERVER, ConMove, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 tile)", 1)
CONSOLE_COMMAND("move_raw", "ii?i", CFGFLAG_SERVER, ConMoveRaw, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 pixel)", 1)
CONSOLE_COMMAND("kill", "v", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player i and announces the kill", 2)
CONSOLE_COMMAND("logout", "v", CFGFLAG_SERVER, ConLogOut, this, "If you are a helper or didn't specify [i] it logs you out, otherwise it logs player i out", 0)
CONSOLE_COMMAND("helper", "v", CFGFLAG_SERVER, ConSetlvl1, this, "Authenticates player i to the Level of 1", 2)
CONSOLE_COMMAND("moder", "v", CFGFLAG_SERVER, ConSetlvl2, this, "Authenticates player i to the Level of 2", 3)
CONSOLE_COMMAND("admin", "v", CFGFLAG_SERVER, ConSetlvl3, this, "Authenticates player i to the Level of 3 (CAUTION: Irreversible, once he is an admin you can't control him)", 3)
CONSOLE_COMMAND("mute", "vi", CFGFLAG_SERVER, ConMute, this, "Mutes player i1 for i2 seconds", 2)
CONSOLE_COMMAND("invis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConInvis, this, "Makes player i invisible", 2)
CONSOLE_COMMAND("vis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConVis, this, "Makes player i visible again", 2)
CONSOLE_COMMAND("timerstop", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStop, this, "Stops the timer of player i", 2)
CONSOLE_COMMAND("timerstart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStart, this, "Starts the timer of player i", 2)
CONSOLE_COMMAND("timerrestart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerReStart, this, "Sets the timer of player i to 0 and starts it", 2)
CONSOLE_COMMAND("timerzero", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerZero, this, "Sets the timer of player i to 0 and stops it", 2)
CONSOLE_COMMAND("tele", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConTeleport, this, "Teleports player i1 to player i2", 2)
CONSOLE_COMMAND("freeze", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConFreeze, this, "Freezes player i1 for i2 seconds (infinity by default)", 2)
CONSOLE_COMMAND("unfreeze", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConUnFreeze, this, "Unfreezes player i", 2)
CONSOLE_COMMAND("addweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConAddWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4, ninja = 5)", 1)
CONSOLE_COMMAND("removeweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRemoveWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4)", 1)
CONSOLE_COMMAND("shotgun", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConShotgun, this, "Gives a shotgun to player i", 2)
CONSOLE_COMMAND("grenade", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGrenade, this, "Gives a grenade launcher to player i", 2)
CONSOLE_COMMAND("rifle", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRifle, this, "Gives a rifle to player i", 2)
CONSOLE_COMMAND("weapons", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConWeapons, this, "Gives all weapons to player i", 2)
CONSOLE_COMMAND("unshotgun", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnShotgun, this, "Takes a shotgun from player i", 2)
CONSOLE_COMMAND("ungrenade", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnGrenade, this, "Takes a grenade launcher from player i", 2)
CONSOLE_COMMAND("unrifle", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnRifle, this, "Takes a rifle from player i", 2)
CONSOLE_COMMAND("unweapons", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnWeapons, this, "Takes all weapons from player i", 2)
CONSOLE_COMMAND("ninja", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConNinja, this, "Makes player i a ninja", 2)
CONSOLE_COMMAND("hammer", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConHammer, this, "Sets the hammer power of player i1 to i2", 2)
CONSOLE_COMMAND("super", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConSuper, this, "Makes player i super", 2)
CONSOLE_COMMAND("unsuper", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnSuper, this, "Removes super from player i", 2)
CONSOLE_COMMAND("left", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoLeft, this, "Makes you or player i move 1 tile left", 1)
CONSOLE_COMMAND("right", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoRight, this, "Makes you or player i move 1 tile right", 1)
CONSOLE_COMMAND("up", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoUp, this, "Makes you or player i move 1 tile up", 1)
CONSOLE_COMMAND("down", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoDown, this, "Makes you or player i move 1 tile down", 1)
CONSOLE_COMMAND("move", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMove, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 tile)", 1)
CONSOLE_COMMAND("move_raw", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMoveRaw, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 pixel)", 1)
CONSOLE_COMMAND("broadtime", "", CFGFLAG_SERVER, ConBroadTime, this, "Toggles Showing the time string in race", -1)
CONSOLE_COMMAND("cmdlist", "", CFGFLAG_SERVER, ConCmdList, this, "Shows the list of all commands", -1)
CONSOLE_COMMAND("credits", "", CFGFLAG_SERVER, ConCredits, this, "Shows the credits of the DDRace mod", -1)
CONSOLE_COMMAND("emote", "?s?i", CFGFLAG_SERVER, ConEyeEmote, this, "Sets your tee's eye emote", -1)
CONSOLE_COMMAND("emote", "?si", CFGFLAG_SERVER, ConEyeEmote, this, "Sets your tee's eye emote", -1)
CONSOLE_COMMAND("broadmsg", "", CFGFLAG_SERVER, ConToggleBroadcast, this, "Toggle Showing the Server's Broadcast message during race", -1)
CONSOLE_COMMAND("eyeemote", "", CFGFLAG_SERVER, ConEyeEmote, this, "Toggles whether you automatically use eyeemotes with standard emotes", -1)
CONSOLE_COMMAND("flags", "", CFGFLAG_SERVER, ConFlags, this, "Shows gameplay information for this server", -1)

View file

@ -1182,16 +1182,16 @@ void CGameContext::ConSay(IConsole::IResult *pResult, void *pUserData, int Clien
void CGameContext::ConSetTeam(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Team = clamp(pResult->GetInteger(1), -1, 1);
int Victim = pResult->GetVictim();
int Team = clamp(pResult->GetInteger(0), -1, 1);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "moved client %d to team %d", Victim, Team);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
if(!pSelf->m_apPlayers[Victim] || !compare_players(pSelf->m_apPlayers[ClientId], pSelf->m_apPlayers[Victim]))
if(!pSelf->m_apPlayers[Victim])
return;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "moved client %d to team %d", Victim, Team);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
pSelf->m_apPlayers[ClientId]->SetTeam(Team);
//(void)pSelf->m_pController->CheckTeamBalance();
}
@ -1273,87 +1273,48 @@ void CGameContext::ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *p
}
bool CGameContext::CheatsAvailable()
{
if(!g_Config.m_SvCheats)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "cheats", "Cheats are not available on this server.");
}
return g_Config.m_SvCheats;
}
void CGameContext::ConGoLeft(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->MoveCharacter(ClientId, (pResult->NumArguments() > 0) ? pResult->GetInteger(0) : ClientId, -1, 0);
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), -1, 0);
}
void CGameContext::ConGoRight(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->MoveCharacter(ClientId, (pResult->NumArguments() > 0) ? pResult->GetInteger(0) : ClientId, 1, 0);
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), 1, 0);
}
void CGameContext::ConGoDown(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->MoveCharacter(ClientId, (pResult->NumArguments() > 0) ? pResult->GetInteger(0) : ClientId, 0, 1);
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), 0, 1);
}
void CGameContext::ConGoUp(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->MoveCharacter(ClientId, (pResult->NumArguments() > 0) ? pResult->GetInteger(0) : ClientId, 0, -1);
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), 0, -1);
}
void CGameContext::ConMove(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if (pResult->NumArguments() > 2)
pSelf->MoveCharacter(ClientId, pResult->GetInteger(0), pResult->GetInteger(1), pResult->GetInteger(2));
else
pSelf->MoveCharacter(ClientId, ClientId, pResult->GetInteger(0), pResult->GetInteger(1));
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), pResult->GetInteger(0), pResult->GetInteger(1));
}
void CGameContext::ConMoveRaw(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if (pResult->NumArguments() > 2)
pSelf->MoveCharacter(ClientId, pResult->GetInteger(0), pResult->GetInteger(1), pResult->GetInteger(2), true);
else
pSelf->MoveCharacter(ClientId, ClientId, pResult->GetInteger(0), pResult->GetInteger(1), true);
pSelf->MoveCharacter(ClientId, pResult->GetVictim(), pResult->GetInteger(0), pResult->GetInteger(1), true);
}
void CGameContext::MoveCharacter(int ClientId, int Victim, int X, int Y, bool Raw)
{
if(!CheatsAvailable())
return;
if(clamp(Victim, 0, (int) MAX_CLIENTS - 1) != Victim || GetPlayerChar(ClientId) == 0)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "invalid client id");
return;
}
if(ClientId != Victim && m_apPlayers[ClientId]->m_Authed <= 1)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You have too low level to move the tees of other players");
return;
}
if(ClientId != Victim && !compare_players(m_apPlayers[ClientId], m_apPlayers[Victim]))
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can't move the tee of players with the same or a higher rank");
return;
}
CCharacter* pChr = GetPlayerChar(ClientId);
if(!pChr)
return;
pChr->m_Core.m_Pos.x += ((Raw) ? 1 : 32) * X;
pChr->m_Core.m_Pos.y += ((Raw) ? 1 : 32) * Y;
@ -1365,30 +1326,30 @@ void CGameContext::MoveCharacter(int ClientId, int Victim, int X, int Y, bool Ra
void CGameContext::ConMute(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Seconds = pResult->GetInteger(1);
int Victim = pResult->GetVictim());
int Seconds = pResult->GetInteger(0);
char buf[512];
if(Seconds < 10)
Seconds = 10;
if(pSelf->m_apPlayers[Victim] && (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim])))
if(pSelf->m_apPlayers[Victim]->m_Muted < Seconds * pSelf->Server()->TickSpeed())
{
if(pSelf->m_apPlayers[Victim]->m_Muted < Seconds * pSelf->Server()->TickSpeed())
{
pSelf->m_apPlayers[Victim]->m_Muted = Seconds * pSelf->Server()->TickSpeed();
}
else
Seconds = pSelf->m_apPlayers[Victim]->m_Muted / 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);
pSelf->m_apPlayers[Victim]->m_Muted = Seconds * pSelf->Server()->TickSpeed();
}
else
Seconds = pSelf->m_apPlayers[Victim]->m_Muted / 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::ConSetlvl3(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(pSelf->m_apPlayers[Victim] && (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) || ClientId == Victim))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Authed = 3;
pServ->SetRconLevel(Victim, 3);
@ -1398,9 +1359,9 @@ void CGameContext::ConSetlvl3(IConsole::IResult *pResult, void *pUserData, int C
void CGameContext::ConSetlvl2(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(pSelf->m_apPlayers[Victim] && (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) || ClientId == Victim))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Authed = 2;
pServ->SetRconLevel(Victim, 2);
@ -1410,9 +1371,9 @@ void CGameContext::ConSetlvl2(IConsole::IResult *pResult, void *pUserData, int C
void CGameContext::ConSetlvl1(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(pSelf->m_apPlayers[Victim] && (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) || ClientId == Victim))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Authed = 1;
pServ->SetRconLevel(Victim, 1);
@ -1422,11 +1383,10 @@ void CGameContext::ConSetlvl1(IConsole::IResult *pResult, void *pUserData, int C
void CGameContext::ConLogOut(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = ClientId;
if(pResult->NumArguments() && pSelf->m_apPlayers[Victim]->m_Authed > 1)
Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(pSelf->m_apPlayers[Victim] && (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) || ClientId == Victim))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Authed = -1;
pServ->SetRconLevel(Victim, -1);
@ -1436,72 +1396,37 @@ void CGameContext::ConLogOut(IConsole::IResult *pResult, void *pUserData, int Cl
void CGameContext::ConKillPlayer(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(!pSelf->m_apPlayers[Victim])
return;
int Victim = pResult->GetVictim();
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->KillCharacter(WEAPON_GAME);
char buf[512];
str_format(buf, sizeof(buf), "%s killed by %s", pSelf->Server()->ClientName(Victim), pSelf->Server()->ClientName(ClientId));
str_format(buf, sizeof(buf), "%s was killed by %s", pSelf->Server()->ClientName(Victim), pSelf->Server()->ClientName(ClientId));
pSelf->SendChat(-1, CGameContext::CHAT_ALL, buf);
}
}
void CGameContext::ConNinjaMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_NINJA, false);
}
void CGameContext::ConNinja(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_NINJA, false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_NINJA, false);
}
void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
char buf[128];
int Victim = pResult->GetVictim();
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int type = pResult->GetInteger(1);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
CServer* pServ = (CServer*)pSelf->Server();
if(type>3 || type<0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Select hammer between 0 and 3");
}
else
{
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
chr->m_HammerType = type;
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
str_format(buf, sizeof(buf), "Hammer of '%s' ClientId=%d setted to %d", pServ->ClientName(ClientId), Victim, type);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
}
void CGameContext::ConHammerMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
char buf[128];
int type = pResult->GetInteger(0);
CCharacter* chr = pSelf->GetPlayerChar(ClientId);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
CServer* pServ = (CServer*)pSelf->Server();
if(type>3 || type<0)
{
@ -1512,239 +1437,102 @@ void CGameContext::ConHammerMe(IConsole::IResult *pResult, void *pUserData, int
chr->m_HammerType = type;
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
str_format(buf, sizeof(buf), "Hammer setted to %d",type);
str_format(buf, sizeof(buf), "Hammer of '%s' ClientId=%d setted to %d", pServ->ClientName(ClientId), Victim, type);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
int Victim = pResult->GetVictim();
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(chr && !chr->m_Super)
{
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(chr && !chr->m_Super)
{
chr->m_Super = true;
chr->UnFreeze();
chr->m_TeamBeforeSuper = chr->Team();
dbg_msg("Teamb4super","%d",chr->m_TeamBeforeSuper = chr->Team());
chr->Teams()->SetCharacterTeam(Victim, TEAM_SUPER);
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
}
chr->m_Super = true;
chr->UnFreeze();
chr->m_TeamBeforeSuper = chr->Team();
dbg_msg("Teamb4super","%d",chr->m_TeamBeforeSuper = chr->Team());
chr->Teams()->SetCharacterTeam(Victim, TEAM_SUPER);
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
}
}
void CGameContext::ConUnSuper(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
int Victim = pResult->GetVictim();
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(chr && chr->m_Super)
{
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(chr && chr->m_Super)
{
chr->m_Super = false;
chr->Teams()->SetForceCharacterTeam(Victim, chr->m_TeamBeforeSuper);
}
}
}
void CGameContext::ConSuperMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
if(pSelf->m_apPlayers[ClientId])
{
CCharacter* chr = pSelf->GetPlayerChar(ClientId);
if(chr && !chr->m_Super)
{
chr->m_Super = true;
chr->UnFreeze();
chr->m_TeamBeforeSuper = chr->Team();
dbg_msg("Teamb4super","%d",chr->m_TeamBeforeSuper = chr->Team());
chr->Teams()->SetCharacterTeam(ClientId, TEAM_SUPER);
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
}
}
}
void CGameContext::ConUnSuperMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
if(pSelf->m_apPlayers[ClientId])
{
CCharacter* chr = pSelf->GetPlayerChar(ClientId);
if(chr && chr->m_Super)
{
chr->m_Super = false;
chr->Teams()->SetForceCharacterTeam(ClientId, chr->m_TeamBeforeSuper);
}
chr->m_Super = false;
chr->Teams()->SetForceCharacterTeam(Victim, chr->m_TeamBeforeSuper);
}
}
void CGameContext::ConShotgun(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_SHOTGUN, false);
}
void CGameContext::ConShotgunMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_SHOTGUN, false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_SHOTGUN, false);
}
void CGameContext::ConGrenade(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_GRENADE, false);
}
void CGameContext::ConGrenadeMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_GRENADE, false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_GRENADE, false);
}
void CGameContext::ConRifle(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_RIFLE, false);
}
void CGameContext::ConRifleMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_RIFLE, false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_RIFLE, false);
}
void CGameContext::ConWeapons(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), -1, false);
}
void CGameContext::ConWeaponsMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, -1, false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), -1, false);
}
void CGameContext::ConUnShotgun(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_SHOTGUN, true);
}
void CGameContext::ConUnShotgunMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_SHOTGUN, true);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_SHOTGUN, true);
}
void CGameContext::ConUnGrenade(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_GRENADE, true);
}
void CGameContext::ConUnGrenadeMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_GRENADE, true);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_GRENADE, true);
}
void CGameContext::ConUnRifle(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), WEAPON_RIFLE, true);
}
void CGameContext::ConUnRifleMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, WEAPON_RIFLE, true);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), WEAPON_RIFLE, true);
}
void CGameContext::ConUnWeapons(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), -1, true);
}
void CGameContext::ConUnWeaponsMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->ModifyWeapons(ClientId, ClientId, -1, true);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), -1, true);
}
void CGameContext::ConAddWeapon(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if (pResult->NumArguments() > 1)
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), pResult->GetInteger(1), false);
else
pSelf->ModifyWeapons(ClientId, ClientId, pResult->GetInteger(0), false);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), pResult->GetInteger(0), false);
}
void CGameContext::ConRemoveWeapon(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if (pResult->NumArguments() > 1)
pSelf->ModifyWeapons(ClientId, pResult->GetInteger(0), pResult->GetInteger(1), true);
else
pSelf->ModifyWeapons(ClientId, ClientId, pResult->GetInteger(0), true);
pSelf->ModifyWeapons(ClientId, pResult->GetVictim(), pResult->GetInteger(0), true);
}
void CGameContext::ModifyWeapons(int ClientId, int Victim, int Weapon, bool Remove)
{
if(!CheatsAvailable())
return;
if(clamp(Victim, 0, (int) MAX_CLIENTS - 1) != Victim || GetPlayerChar(ClientId) == 0)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "invalid client id");
return;
}
if(ClientId != Victim && m_apPlayers[ClientId]->m_Authed <= 1)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You have too low level to add/remove weapons from other players");
return;
}
if(ClientId != Victim && !compare_players(m_apPlayers[ClientId], m_apPlayers[Victim]))
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can't add/remove weapons from players with the same or a higher rank");
return;
}
if(clamp(Weapon, -1, NUM_WEAPONS - 1) != Weapon)
{
Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "invalid weapon id");
@ -1752,6 +1540,9 @@ void CGameContext::ModifyWeapons(int ClientId, int Victim, int Weapon, bool Remo
}
CCharacter* pChr = GetPlayerChar(Victim);
if(!pChr)
return;
if(Weapon == -1)
{
if(Remove && pChr->m_ActiveWeapon == WEAPON_SHOTGUN || pChr->m_ActiveWeapon == WEAPON_GRENADE || pChr->m_ActiveWeapon == WEAPON_RIFLE)
@ -1795,18 +1586,15 @@ void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData, int
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int cid2 = clamp(pResult->GetInteger(1), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[Victim] && pSelf->m_apPlayers[cid2])
int Victim = pResult->GetVictim();
int TeleTo = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[TeleTo])
{
if(ClientId==Victim
|| (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[cid2]))
|| (compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]) && cid2==ClientId))
{
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(chr)
{
chr->m_Core.m_Pos = pSelf->m_apPlayers[cid2]->m_ViewPos;
chr->m_Core.m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
if(!g_Config.m_SvCheatTime)
chr->m_DDRaceState = DDRACE_CHEAT;
}
@ -1817,51 +1605,36 @@ void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData, int
void CGameContext::ConTimerStop(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
char buf[128];
CServer* pServ = (CServer*)pSelf->Server();
if(!g_Config.m_SvTimer)
{
int Victim = pResult->GetVictim();
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
chr->m_DDRaceState=DDRACE_CHEAT;
str_format(buf, sizeof(buf), "'%s' ClientId=%d Hasn't time now (Timer Stopped)", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
else
char buf[128];
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim])
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Timer commands are disabled");
chr->m_DDRaceState=DDRACE_CHEAT;
str_format(buf, sizeof(buf), "'%s' ClientId=%d Hasn't time now (Timer Stopped)", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
void CGameContext::ConTimerStart(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
char buf[128];
CServer* pServ = (CServer*)pSelf->Server();
if(!g_Config.m_SvTimer)
{
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
chr->m_DDRaceState = DDRACE_STARTED;
str_format(buf, sizeof(buf), "'%s' ClientId=%d Has time now (Timer Started)", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
else
{
int Victim = pResult->GetVictim();
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Timer commands are disabled");
char buf[128];
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim])
{
chr->m_DDRaceState = DDRACE_STARTED;
str_format(buf, sizeof(buf), "'%s' ClientId=%d Has time now (Timer Started)", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
@ -1869,74 +1642,59 @@ void CGameContext::ConTimerZero(IConsole::IResult *pResult, void *pUserData, int
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
char buf[128];
CServer* pServ = (CServer*)pSelf->Server();
if(!g_Config.m_SvTimer)
{
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
int Victim = pResult->GetVictim();
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
chr->m_StartTime = pSelf->Server()->Tick();
chr->m_RefreshTime = pSelf->Server()->Tick();
chr->m_DDRaceState=DDRACE_CHEAT;
str_format(buf, sizeof(buf), "'%s' ClientId=%d time has been reset & stopped.", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
else
char buf[128];
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim])
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Timer commands are disabled");
chr->m_StartTime = pSelf->Server()->Tick();
chr->m_RefreshTime = pSelf->Server()->Tick();
chr->m_DDRaceState=DDRACE_CHEAT;
str_format(buf, sizeof(buf), "'%s' ClientId=%d time has been reset & stopped.", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
void CGameContext::ConTimerReStart(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!pSelf->CheatsAvailable()) return;
char buf[128];
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(!g_Config.m_SvTimer)
{
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
chr->m_StartTime = pSelf->Server()->Tick();
chr->m_RefreshTime = pSelf->Server()->Tick();
chr->m_DDRaceState=DDRACE_STARTED;
str_format(buf, sizeof(buf), "'%s' ClientId=%d time has been reset & stopped.", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
else
char buf[128];
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Timer commands are disabled");
chr->m_StartTime = pSelf->Server()->Tick();
chr->m_RefreshTime = pSelf->Server()->Tick();
chr->m_DDRaceState=DDRACE_STARTED;
str_format(buf, sizeof(buf), "'%s' ClientId=%d time has been reset & stopped.", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
}
void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
//if(!pSelf->CheatsAvailable()) return;
char buf[128];
int time=-1;
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pResult->NumArguments()>1)
int Victim = pResult->GetVictim();
char buf[128];
if(pResult->NumArguments() >= 1)
time = clamp(pResult->GetInteger(1), -1, 29999);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
if(pSelf->m_apPlayers[Victim])
{
chr->Freeze(((time!=0&&time!=-1)?(pSelf->Server()->TickSpeed()*time):(-1)));
chr->m_pPlayer->m_RconFreeze = true;
@ -1950,9 +1708,9 @@ void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData, int Cl
void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
//if(!pSelf->CheatsAvailable()) return;
int Victim = pResult->GetVictim();
char buf[128];
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
CCharacter* chr = pSelf->GetPlayerChar(Victim);
if(!chr)
return;
@ -1961,35 +1719,18 @@ void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int
CServer* pServ = (CServer*)pSelf->Server();
str_format(buf, sizeof(buf), "'%s' ClientId=%d has been UnFreezed.", pServ->ClientName(ClientId), Victim);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
}
void CGameContext::ConInvisMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
//if(!pSelf->CheatsAvailable()) return;
if(!pSelf->m_apPlayers[ClientId])
return;
pSelf->m_apPlayers[ClientId]->m_Invisible = true;
}
void CGameContext::ConVisMe(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
//if(!pSelf->CheatsAvailable()) return;
if(!pSelf->m_apPlayers[ClientId])
return;
pSelf->m_apPlayers[ClientId]->m_Invisible = false;
}
void CGameContext::ConInvis(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
char buf[128];
int Victim = pResult->GetVictim();
if(!pSelf->m_apPlayers[ClientId])
return;
char buf[128];
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Invisible = true;
CServer* pServ = (CServer*)pSelf->Server();
@ -2001,11 +1742,12 @@ void CGameContext::ConInvis(IConsole::IResult *pResult, void *pUserData, int Cli
void CGameContext::ConVis(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
if(!pSelf->m_apPlayers[ClientId])
return;
char buf[128];
int Victim = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
if(pSelf->m_apPlayers[Victim] && compare_players(pSelf->m_apPlayers[ClientId],pSelf->m_apPlayers[Victim]))
if(pSelf->m_apPlayers[Victim])
{
pSelf->m_apPlayers[Victim]->m_Invisible = false;
CServer* pServ = (CServer*)pSelf->Server();
@ -2389,7 +2131,7 @@ void CGameContext::OnConsoleInit()
Console()->Register("restart", "?i", CFGFLAG_SERVER, ConRestart, this, "Kills all players", 3);
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConBroadcast, this, "Changes the broadcast message for a moment", 3);
Console()->Register("say", "r", CFGFLAG_SERVER, ConSay, this, "Sends a server message to all players", 3);
Console()->Register("set_team", "ii", CFGFLAG_SERVER, ConSetTeam, this, "Changes the team of player i1 to team i2", 2);
Console()->Register("set_team", "vi", CFGFLAG_SERVER, ConSetTeam, this, "Changes the team of player i1 to team i2", 2);
Console()->Register("addvote", "r", CFGFLAG_SERVER, ConAddVote, this, "Adds a vote entry to the clients", 4);
Console()->Register("tune", "si", CFGFLAG_SERVER, ConTuneParam, this, "Modifies tune parameter s to value i", 4);