本文整理汇总了C++中CGameContext类的典型用法代码示例。如果您正苦于以下问题:C++ CGameContext类的具体用法?C++ CGameContext怎么用?C++ CGameContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGameContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyWeapons
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;
}
示例2: ConLogout
void CGameContext::ConLogout(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
int Victim = pResult->m_ClientID;
if(Victim)
pSelf->Server()->Logout(Victim);
}
示例3: ConMoveRaw
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);
}
示例4: ConTuneReset
void CGameContext::ConTuneReset(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
CTuningParams p;
*pSelf->Tuning() = p;
pSelf->SendTuningParams(-1);
dbg_msg("tuning", "Tuning reset");
}
示例5: ConTuneReset
void CGameContext::ConTuneReset(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
CTuningParams TuningParams;
*pSelf->Tuning() = TuningParams;
pSelf->SendTuningParams(-1);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "Tuning reset");
}
示例6: ConMute
void CGameContext::ConMute(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
pSelf->Console()->Print(
IConsole::OUTPUT_LEVEL_STANDARD,
"mutes",
"Use either 'muteid <client_id> <seconds>' or 'muteip <ip> <seconds>'");
}
示例7:
void CGameContext::ConSetlvl1(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
int Victim = pResult->GetVictim();
CServer* pServ = (CServer*)pSelf->Server();
if(pSelf->m_apPlayers[Victim] && Victim != pResult->m_ClientID)
pServ->SetRconLevel(Victim, pServ->AUTHED_HELPER);
}
示例8: ConUnDeep
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;
}
示例9: ConLockTeams
void CGameContext::ConLockTeams(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->m_LockTeams ^= 1;
if(pSelf->m_LockTeams)
pSelf->SendChat(-1, CGameContext::CHAT_ALL, "Teams were locked");
else
pSelf->SendChat(-1, CGameContext::CHAT_ALL, "Teams were unlocked");
}
示例10: pfnCallback
void CGameContext::ConchainSettingUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
pfnCallback(pResult, pCallbackUserData);
if(pResult->NumArguments())
{
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->SendSettings(-1);
}
}
示例11: ConTuneDump
void CGameContext::ConTuneDump(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
for(int i = 0; i < pSelf->Tuning()->Num(); i++)
{
float v;
pSelf->Tuning()->Get(i, &v);
dbg_msg("tuning", "%s %.2f", pSelf->Tuning()->m_apNames[i], v);
}
}
示例12: ConEyeEmote
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();
}
}
示例13: ConMuteID
// mute through client id
void CGameContext::ConMuteID(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
int Victim = pResult->GetVictim();
NETADDR Addr;
pSelf->Server()->GetClientAddr(Victim, &Addr);
pSelf->Mute(pResult, &Addr, clamp(pResult->GetInteger(0), 1, 86400),
pSelf->Server()->ClientName(Victim));
}
示例14: if
void CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(str_comp_nocase(pResult->GetString(0), "yes") == 0)
pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_YES;
else if(str_comp_nocase(pResult->GetString(0), "no") == 0)
pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0));
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
}
示例15: ConLText
void CGameContext::ConLText(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
const int ClientID = pResult->m_ClientID;
CCharacter * pChar = pSelf->GetPlayerChar(ClientID);
// /text posx posy msg
if(pChar)
pSelf->CreateLolText(pChar, true, vec2(pResult->GetFloat(0), pResult->GetFloat(1)), vec2(0, 0), 150, pResult->GetString(2));
}