void CGameContext::ConCopy(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; const int ClientID = pResult->m_ClientID; const int ToCopy = pResult->GetVictim(); if(!CheckClientID(ClientID)) return; pSelf->m_aInputCopy[ClientID] = (CheckClientID(ToCopy) && ClientID != ToCopy) ? ToCopy : -1; }
void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; for(int i = 0; i < pSelf->Server()->MaxClients(); i++) { if (i == pResult->m_ClientID) continue; if (!pSelf->m_apPlayers[i]) continue; if (str_comp(pSelf->m_apPlayers[i]->m_TimeoutCode, pResult->GetString(0))) continue; if (((CServer *)pSelf->Server())->m_NetServer.SetTimedOut(i, pResult->m_ClientID)) { ((CServer *)pSelf->Server())->DelClientCallback(pResult->m_ClientID, "Timeout Protection used", ((CServer *)pSelf->Server())); ((CServer *)pSelf->Server())->m_aClients[i].m_Authed = CServer::AUTHED_NO; if (pSelf->m_apPlayers[i]->GetCharacter()) ((CGameContext *)(((CServer *)pSelf->Server())->GameServer()))->SendTuningParams(i, pSelf->m_apPlayers[i]->GetCharacter()->m_TuneZone); return; } } ((CServer *)pSelf->Server())->m_NetServer.SetTimeoutProtected(pResult->m_ClientID); str_copy(pPlayer->m_TimeoutCode, pResult->GetString(0), sizeof(pPlayer->m_TimeoutCode)); }
bool CheckRights(int ClientID, int Victim, CGameContext *GameContext) { if(!CheckClientID(ClientID)) return false; if(!CheckClientID(Victim)) return false; if (ClientID == Victim) return true; if (!GameContext->m_apPlayers[ClientID] || !GameContext->m_apPlayers[Victim]) return false; if(GameContext->m_apPlayers[ClientID]->m_Authed <= GameContext->m_apPlayers[Victim]->m_Authed) return false; return true; }
void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; #if defined(CONF_SQL) if(pSelf->m_apPlayers[pResult->m_ClientID] && g_Config.m_SvUseSQL) if(pSelf->m_apPlayers[pResult->m_ClientID]->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; #endif if (g_Config.m_SvHideScore) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top5", "Showing the top 5 is not allowed on this server."); return; } if (pResult->NumArguments() > 0 && pResult->GetInteger(0) > 0) pSelf->Score()->ShowTop5(pResult, pResult->m_ClientID, pUserData, pResult->GetInteger(0)); else pSelf->Score()->ShowTop5(pResult, pResult->m_ClientID, pUserData); #if defined(CONF_SQL) if(pSelf->m_apPlayers[pResult->m_ClientID] && g_Config.m_SvUseSQL) pSelf->m_apPlayers[pResult->m_ClientID]->m_LastSQLQuery = pSelf->Server()->Tick(); #endif }
void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (g_Config.m_SvEmotionalTees == -1) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "emote", "Server admin disabled emotes."); return; } if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; if (pResult->NumArguments() == 0) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", "Emote commands are: /emote surprise /emote blink /emote close /emote angry /emote happy /emote pain"); pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", "Example: /emote surprise 10 for 10 seconds or /emote surprise (default 1 second)"); } else { if(pPlayer->m_LastEyeEmote + g_Config.m_SvEyeEmoteChangeDelay * pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; if (!str_comp(pResult->GetString(0), "angry")) pPlayer->m_DefEmote = EMOTE_ANGRY; else if (!str_comp(pResult->GetString(0), "blink")) pPlayer->m_DefEmote = EMOTE_BLINK; else if (!str_comp(pResult->GetString(0), "close")) pPlayer->m_DefEmote = EMOTE_BLINK; else if (!str_comp(pResult->GetString(0), "happy")) pPlayer->m_DefEmote = EMOTE_HAPPY; else if (!str_comp(pResult->GetString(0), "pain")) pPlayer->m_DefEmote = EMOTE_PAIN; else if (!str_comp(pResult->GetString(0), "surprise")) pPlayer->m_DefEmote = EMOTE_SURPRISE; else if (!str_comp(pResult->GetString(0), "normal")) pPlayer->m_DefEmote = EMOTE_NORMAL; else pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "emote", "Unknown emote... Say /emote"); int Duration = 1; if (pResult->NumArguments() > 1) Duration = pResult->GetInteger(1); pPlayer->m_DefEmoteReset = pSelf->Server()->Tick() + Duration * pSelf->Server()->TickSpeed(); pPlayer->m_LastEyeEmote = pSelf->Server()->Tick(); } }
void CGameContext::ConRank(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; #if defined(CONF_SQL) if(g_Config.m_SvUseSQL) if(pPlayer->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; #endif if (pResult->NumArguments() > 0) if (!g_Config.m_SvHideScore) pSelf->Score()->ShowRank(pResult->m_ClientID, pResult->GetString(0), true); else pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "rank", "Showing the rank of other players is not allowed on this server."); else pSelf->Score()->ShowRank(pResult->m_ClientID, pSelf->Server()->ClientName(pResult->m_ClientID)); #if defined(CONF_SQL) if(g_Config.m_SvUseSQL) pPlayer->m_LastSQLQuery = pSelf->Server()->Tick(); #endif }
void CGameContext::ConShowOthers(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; if (g_Config.m_SvShowOthers) { if (pPlayer->m_IsUsingDDRaceClient) { if (pResult->NumArguments()) pPlayer->m_ShowOthers = pResult->GetInteger(0); else pPlayer->m_ShowOthers = !pPlayer->m_ShowOthers; } else pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "showotherschat", "Showing players from other teams is only available with DDRace Client, http://DDRace.info"); } else pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "showotherschat", "Showing players from other teams is disabled by the server admin"); }
void CGameContext::ConLoad(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; #if defined(CONF_SQL) if(!g_Config.m_SvSaveGames) { pSelf->SendChatTarget(pResult->m_ClientID, "Save-function is disabled on this server"); return; } if(g_Config.m_SvUseSQL) if(pPlayer->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; #endif if (pResult->NumArguments() > 0) pSelf->Score()->LoadTeam(pResult->GetString(0), pResult->m_ClientID); else return; #if defined(CONF_SQL) if(g_Config.m_SvUseSQL) pPlayer->m_LastSQLQuery = pSelf->Server()->Tick(); #endif }
void CGameContext::ConMapInfo(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; #if defined(CONF_SQL) if(g_Config.m_SvUseSQL) if(pPlayer->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; #endif if (pResult->NumArguments() > 0) pSelf->Score()->MapInfo(pResult->m_ClientID, pResult->GetString(0)); else pSelf->Score()->MapInfo(pResult->m_ClientID, g_Config.m_SvMap); #if defined(CONF_SQL) if(g_Config.m_SvUseSQL) pPlayer->m_LastSQLQuery = pSelf->Server()->Tick(); #endif }
void CGameContext::ConLogin(IConsole::IResult *pResult, void *pUserData) { if(!CheckClientID(pResult->m_ClientID)) return; CGameContext *pSelf = (CGameContext *)pUserData; pSelf->MemberList->Login(pResult->m_ClientID, pResult->GetString(0), pSelf); }
void CGameContext::ConSayTimeAll(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; CCharacter* pChr = pPlayer->GetCharacter(); if (!pChr) return; if(pChr->m_DDRaceState != DDRACE_STARTED) return; char aBuftime[64]; int IntTime = (int) ((float) (pSelf->Server()->Tick() - pChr->m_StartTime) / ((float) pSelf->Server()->TickSpeed())); str_format(aBuftime, sizeof(aBuftime), "%s\'s current race time is %s%d:%s%d", pSelf->Server()->ClientName(pResult->m_ClientID), ((IntTime / 60) > 9) ? "" : "0", IntTime / 60, ((IntTime % 60) > 9) ? "" : "0", IntTime % 60); pSelf->SendChat(-1, CGameContext::CHAT_ALL, aBuftime, pResult->m_ClientID); }
void CGameContext::ConRocket(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; if (!CheckClientID(pResult->m_ClientID)) return; int Victim = pResult->GetVictim(); CPlayer *pPlayer = pSelf->m_apPlayers[Victim]; if(!pPlayer) return; pSelf->ModifyWeapons(pResult, pUserData, WEAPON_GRENADE, false); char aBuf[128]; if (!pPlayer->m_IsRocket) { pPlayer->m_IsRocket = true; str_format(aBuf, sizeof(aBuf), "You got Rocket by %s.", pSelf->Server()->ClientName(pResult->m_ClientID)); pSelf->SendChatTarget(Victim, aBuf); } else { pPlayer->m_IsRocket = false; str_format(aBuf, sizeof(aBuf), "%s removed your Rocket.", pSelf->Server()->ClientName(pResult->m_ClientID)); pSelf->SendChatTarget(Victim, aBuf); } }
void CGameContext::ConTogglePause(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; if(!CheckClientID(pResult->m_ClientID)) return; char aBuf[128]; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if(!pPlayer) return; if (pPlayer->GetCharacter() == 0) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "pause", "You can't pause while you are dead/a spectator."); return; } if(pPlayer->m_Paused == CPlayer::PAUSED_FORCE) { str_format(aBuf, sizeof(aBuf), "You are force-paused. %ds left.", pPlayer->m_ForcePauseTime/pSelf->Server()->TickSpeed()); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "pause", aBuf); return; } pPlayer->m_Paused = (pPlayer->m_Paused == CPlayer::PAUSED_SPEC) ? CPlayer::PAUSED_NONE : CPlayer::PAUSED_SPEC; }
void CGameContext::ConTest(IConsole::IResult *pResult, void *pUserData) { if(!CheckClientID(pResult->m_ClientID)) return; int Victim = pResult->m_ClientID; CGameContext *pSelf = (CGameContext *)pUserData; const char *message = pResult->GetString(0); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "ClientID:%i|First arg:%s", pResult->m_ClientID, message); pSelf->SendChatTarget(Victim, aBuf); // // CGameContext *pSelf = (CGameContext *)pUserData; // CCharacter* pChr = pSelf->m_apPlayers[pResult->ClientID]->GetCharacter(); // if(!pChr) // return; // str_format(aBuf, sizeof(aBuf), "md5:%s" , md5(message)); //pChr->m_is_bloody = 1; //~ pSelf->m_apPlayers[ClientID]->m_Score = (Score()->PlayerData(ClientID)->m_BestTime)?Score()->PlayerData(ClientID)->m_BestTime:0; //~ pSelf->m_apPlayers[ClientID]->m_Score = 123; //~ char aBuf[256]; //~ str_format(aBuf, sizeof(aBuf), "%s: %s" ,pSelf->Server()->ClientName(ClientID),message); //~ str_format(aBuf, sizeof(aBuf), "Teeinfo:%i" , pSelf->m_apPlayers[ClientID]->m_TeeInfos.m_ColorBody); //~ pResult->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf); //~ pSelf->SendChatTarget(Victim, aBuf); }
void CGameContext::ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; if(pResult->NumArguments() == 0) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", (pPlayer->m_EyeEmote) ? "You can now use the preset eye emotes." : "You don't have any eye emotes, remember to bind some. (until you die)"); return; } else if(str_comp_nocase(pResult->GetString(0), "on") == 0) pPlayer->m_EyeEmote = true; else if(str_comp_nocase(pResult->GetString(0), "off") == 0) pPlayer->m_EyeEmote = false; else if(str_comp_nocase(pResult->GetString(0), "toggle") == 0) pPlayer->m_EyeEmote = !pPlayer->m_EyeEmote; pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", (pPlayer->m_EyeEmote) ? "You can now use the preset eye emotes." : "You don't have any eye emotes, remember to bind some. (until you die)"); }
void CGameContext::ConGoUp(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; pSelf->MoveCharacter(pResult->m_ClientID, 0, -1); }
void CGameContext::ModifyWeapons(IConsole::IResult *pResult, void *pUserData, int Weapon, bool Remove) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; int ClientID = pResult->m_ClientID; if (clamp(Weapon, -1, NUM_WEAPONS - 1) != Weapon) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "invalid weapon id"); return; } CCharacter* pChr = GetPlayerChar(ClientID); if (!pChr) return; if (Weapon == -1) { if (Remove && (pChr->GetActiveWeapon() == WEAPON_SHOTGUN || pChr->GetActiveWeapon() == WEAPON_GRENADE || pChr->GetActiveWeapon() == WEAPON_RIFLE)) pChr->SetActiveWeapon(WEAPON_GUN); if (Remove) { pChr->SetWeaponGot(WEAPON_SHOTGUN, false); pChr->SetWeaponGot(WEAPON_GRENADE, false); pChr->SetWeaponGot(WEAPON_RIFLE, false); } else pChr->GiveAllWeapons(); } else if (Weapon != WEAPON_NINJA) { if (Remove && pChr->GetActiveWeapon() == Weapon) pChr->SetActiveWeapon(WEAPON_GUN); if (Remove) pChr->SetWeaponGot(Weapon, false); else pChr->GiveWeapon(Weapon, -1); } else { if (Remove) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "you can't remove ninja"); return; } pChr->GiveNinja(); } pChr->m_DDRaceState = DDRACE_CHEAT; }
void CGameContext::ConMoveRaw(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; pSelf->MoveCharacter(pResult->m_ClientID, pResult->GetInteger(0), pResult->GetInteger(1), true); }
void CGameContext::ConUnDeep(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID); if (pChr) pChr->m_DeepFreeze = false; }
void CGameContext::ConSave(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; #if defined(CONF_SQL) if(!g_Config.m_SvSaveGames) { pSelf->SendChatTarget(pResult->m_ClientID, "Save-function is disabled on this server"); return; } if(g_Config.m_SvUseSQL) if(pPlayer->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; int Team = ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.m_Core.Team(pResult->m_ClientID); const char* pCode = pResult->GetString(0); char aCountry[5]; if(str_length(pCode) > 3 && pCode[0] >= 'A' && pCode[0] <= 'Z' && pCode[1] >= 'A' && pCode[1] <= 'Z' && pCode[2] >= 'A' && pCode[2] <= 'Z') { if(pCode[3] == ' ') { str_copy(aCountry, pCode, 4); pCode = pCode + 4; } else if(str_length(pCode) > 4 && pCode[4] == ' ') { str_copy(aCountry, pCode, 5); pCode = pCode + 5; } else { str_copy(aCountry, g_Config.m_SvSqlServerName, sizeof(aCountry)); } } else { str_copy(aCountry, g_Config.m_SvSqlServerName, sizeof(aCountry)); } pSelf->Score()->SaveTeam(Team, pCode, pResult->m_ClientID, aCountry); if(g_Config.m_SvUseSQL) pPlayer->m_LastSQLQuery = pSelf->Server()->Tick(); #endif }
void CGameContext::ConRegister(IConsole::IResult *pResult, void *pUserData) { if(!CheckClientID(pResult->GetInteger(0))) return; CGameContext *pSelf = (CGameContext *)pUserData; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->GetInteger(0)]; if(!pPlayer) return; pSelf->MemberList->Register(pResult->m_ClientID, pResult->GetString(0), pSelf); }
void CGameContext::ConList(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; int ClientID = pResult->m_ClientID; if(!CheckClientID(ClientID)) return; char zerochar = 0; if(pResult->NumArguments() > 0) pSelf->List(ClientID, pResult->GetString(0)); else pSelf->List(ClientID, &zerochar); }
void CGameContext::ConJumps(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; if(!CheckClientID(pResult->m_ClientID)) return; CCharacter *pChr = pSelf->m_apPlayers[pResult->m_ClientID]->GetCharacter(); if (!pChr) return; char aBuf[64]; str_format(aBuf, sizeof(aBuf), "You can jump %d times.", pChr->Core()->m_MaxJumps); pSelf->SendChatTarget(pResult->m_ClientID, aBuf); }
void CGameContext::ConUnSuper(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID); if (pChr && pChr->m_Super) { pChr->m_Super = false; pChr->Teams()->SetForceCharacterTeam(pResult->m_ClientID, pChr->m_TeamBeforeSuper); } }
void CGameContext::ConPrivMsg(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; int to = pResult->GetVictim(); if(!CheckClientID(to)) return; if(CheckClientID(pResult->m_ClientID) && pSelf->ProcessSpamProtection(pResult->m_ClientID)) return; char message[512]; str_format(message, sizeof(message), "PM -> %s: ", pSelf->Server()->ClientName(to)); str_append(message, pResult->GetString(0), sizeof(message)); CNetMsg_Sv_Chat Msg; Msg.m_Team = 1; Msg.m_ClientID = CheckClientID(pResult->m_ClientID) ? pResult->m_ClientID : -1; Msg.m_pMessage = message; pSelf->Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, to); if(CheckClientID(pResult->m_ClientID)) { pSelf->Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, pResult->m_ClientID); str_format(message, sizeof(message), "\"%s\" -> \"%s\" : %s", pSelf->Server()->ClientName(pResult->m_ClientID), pSelf->Server()->ClientName(to), pResult->GetString(0)); } else { str_format(message, sizeof(message), "%d -> \"%s\" : %s", pResult->m_ClientID, pSelf->Server()->ClientName(to), pResult->GetString(0)); } pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "pmchat", message); }
void CGameContext::ConTimes(IConsole::IResult *pResult, void *pUserData) { if(!CheckClientID(pResult->m_ClientID)) return; CGameContext *pSelf = (CGameContext *)pUserData; #if defined(CONF_SQL) if(pSelf->m_apPlayers[pResult->m_ClientID] && g_Config.m_SvUseSQL) if(pSelf->m_apPlayers[pResult->m_ClientID]->m_LastSQLQuery + pSelf->Server()->TickSpeed() >= pSelf->Server()->Tick()) return; #endif if(g_Config.m_SvUseSQL) { CSqlScore *pScore = (CSqlScore *)pSelf->Score(); CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if(!pPlayer) return; if(pResult->NumArguments() == 0) { pScore->ShowTimes(pPlayer->GetCID(),1); return; } else if(pResult->NumArguments() < 3) { if (pResult->NumArguments() == 1) { if(pResult->GetInteger(0) != 0) pScore->ShowTimes(pPlayer->GetCID(),pResult->GetInteger(0)); else pScore->ShowTimes(pPlayer->GetCID(), (str_comp(pResult->GetString(0), "me") == 0) ? pSelf->Server()->ClientName(pResult->m_ClientID) : pResult->GetString(0),1); return; } else if (pResult->GetInteger(1) != 0) { pScore->ShowTimes(pPlayer->GetCID(), (str_comp(pResult->GetString(0), "me") == 0) ? pSelf->Server()->ClientName(pResult->m_ClientID) : pResult->GetString(0),pResult->GetInteger(1)); return; } } pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "times", "/times needs 0, 1 or 2 parameter. 1. = name, 2. = start number"); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "times", "Example: /times, /times me, /times Hans, /times \"Papa Smurf\" 5"); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "times", "Bad: /times Papa Smurf 5 # Good: /times \"Papa Smurf\" 5 "); #if defined(CONF_SQL) if(pSelf->m_apPlayers[pResult->m_ClientID] && g_Config.m_SvUseSQL) pSelf->m_apPlayers[pResult->m_ClientID]->m_LastSQLQuery = pSelf->Server()->Tick(); #endif } }
void CGameContext::ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; if (pResult->NumArguments()) pPlayer->m_NinjaJetpack = pResult->GetInteger(0); else pPlayer->m_NinjaJetpack = !pPlayer->m_NinjaJetpack; }
void CGameContext::ConLockTeam(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; int Team = ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.m_Core.Team(pResult->m_ClientID); bool Lock = ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.TeamLocked(Team); if (pResult->NumArguments() > 0) Lock = !pResult->GetInteger(0); if(Team > TEAM_FLOCK && Team < TEAM_SUPER) { char aBuf[512]; if(Lock) { ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.SetTeamLock(Team, false); str_format(aBuf, sizeof(aBuf), "'%s' unlocked your team.", pSelf->Server()->ClientName(pResult->m_ClientID)); for (int i = 0; i < MAX_CLIENTS; i++) if (((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.m_Core.Team(i) == Team) pSelf->SendChatTarget(i, aBuf); } else if(!g_Config.m_SvTeamLock) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "print", "Team locking is disabled on this server"); } else { ((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.SetTeamLock(Team, true); str_format(aBuf, sizeof(aBuf), "'%s' locked your team. After the race started killing will kill everyone in your team.", pSelf->Server()->ClientName(pResult->m_ClientID)); for (int i = 0; i < MAX_CLIENTS; i++) if (((CGameControllerDDRace*) pSelf->m_pController)->m_Teams.m_Core.Team(i) == Team) pSelf->SendChatTarget(i, aBuf); } } else pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "print", "This team can't be locked"); }
void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID); if (pChr && !pChr->m_Super) { pChr->m_Super = true; pChr->UnFreeze(); pChr->m_TeamBeforeSuper = pChr->Team(); pChr->Teams()->SetCharacterTeam(pResult->m_ClientID, TEAM_SUPER); pChr->m_DDRaceState = DDRACE_CHEAT; } }
void CGameContext::ConToggleFly(IConsole::IResult *pResult, void *pUserData) { if(!CheckClientID(pResult->m_ClientID)) return; CGameContext *pSelf = (CGameContext *)pUserData; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if(!pPlayer) return; CCharacter* pChr = pPlayer->GetCharacter(); if(!pChr) return; if(pChr->m_Super) { pChr->m_Fly = !pChr->m_Fly; pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", (pChr->m_Fly) ? "Fly enabled" : "Fly disabled"); } }