本文整理汇总了C++中CGameContext::SendChatTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameContext::SendChatTarget方法的具体用法?C++ CGameContext::SendChatTarget怎么用?C++ CGameContext::SendChatTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameContext
的用法示例。
在下文中一共展示了CGameContext::SendChatTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConRocket
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);
}
}
示例2: ConFastReload
void CGameContext::ConFastReload(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
if(!pPlayer)
return;
CCharacter* pChr = pSelf->m_apPlayers[Victim]->GetCharacter();
if(!pChr)
return;
char aBuf[128];
if (!pChr->m_FastReload)
{
pChr->m_ReloadMultiplier = 10000;
pChr->m_FastReload = true;
str_format(aBuf, sizeof(aBuf), "You got XXL by %s.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
else
{
pChr->m_ReloadMultiplier = 1000;
pChr->m_FastReload = false;
str_format(aBuf, sizeof(aBuf), "%s removed your XXL.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
pChr->m_DDRaceState = DDRACE_CHEAT;
}
示例3: ConBlood
void CGameContext::ConBlood(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
int Victim = pResult->GetVictim();
CGameContext *pSelf = (CGameContext *)pUserData;
CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
if(!pPlayer)
return;
CCharacter* pChr = pSelf->m_apPlayers[Victim]->GetCharacter();;
if(!pChr)
return;
char aBuf[128];
if (!pChr->m_Bloody)
{
pChr->m_Bloody = true;
str_format(aBuf, sizeof(aBuf), "You got bloody by %s.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
else
{
pChr->m_Bloody = false;
str_format(aBuf, sizeof(aBuf), "%s removed your blood.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
}
示例4: ConLockTeam
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");
}
示例5: ConLoad
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
}
示例6: ConScore
void CGameContext::ConScore(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
int Victim = pResult->GetVictim();
int Score = clamp(pResult->GetInteger(0), -9999, 9999);
CGameContext *pSelf = (CGameContext *)pUserData;
CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
if(!pPlayer)
return;
if (!g_Config.m_SvRconScore)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "You can't set a score, if sv_rcon_score is not enabled.");
return;
}
CCharacter* pChr = pSelf->m_apPlayers[Victim]->GetCharacter();;
if(!pChr)
return;
pSelf->m_apPlayers[Victim]->m_Score = Score;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s set score of %s to %i" ,pSelf->Server()->ClientName(pResult->m_ClientID),pSelf->Server()->ClientName(Victim), Score);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
str_format(aBuf, sizeof(aBuf), "%s set your to %i.", pSelf->Server()->ClientName(pResult->m_ClientID), Score);
pSelf->SendChatTarget(Victim, aBuf);
}
示例7: ConRename
void CGameContext::ConRename(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
const char *newName = pResult->GetString(0);
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
if(!pPlayer)
return;
CCharacter* pChr = pSelf->m_apPlayers[Victim]->GetCharacter();
if(!pChr)
return;
//change name
char oldName[MAX_NAME_LENGTH];
str_copy(oldName, pSelf->Server()->ClientName(Victim), MAX_NAME_LENGTH);
pSelf->Server()->SetClientName(Victim, newName);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s has changed %s's name to '%s'", pSelf->Server()->ClientName(pResult->m_ClientID), oldName, pSelf->Server()->ClientName(Victim));
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
str_format(aBuf, sizeof(aBuf), "%s changed your name to %s.", pSelf->Server()->ClientName(pResult->m_ClientID), pSelf->Server()->ClientName(Victim));
pSelf->SendChatTarget(Victim, aBuf);
}
示例8: ConTest
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);
}
示例9: ConWhisper
void CGameContext::ConWhisper(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
CCharacter* pChr = pSelf->m_apPlayers[pResult->m_ClientID]->GetCharacter();
const char *message = pResult->GetString(0);
if(!pChr)
return;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "%s: %s", pSelf->Server()->ClientName(pResult->m_ClientID), message);
pSelf->SendChatTarget(Victim, aBuf);
str_format(aBuf, sizeof(aBuf), "-->%s: %s", pSelf->Server()->ClientName(pResult->m_ClientID), message);
pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
}
示例10: ConSave
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
}
示例11: ConJumps
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);
}
示例12: ConVote
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), "admin forced vote %s", pResult->GetString(0));
pSelf->SendChatTarget(-1, aBuf);
str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0));
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
}
示例13: ConRainbow
void CGameContext::ConRainbow(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
CGameContext *pSelf = (CGameContext *)pUserData;
int Victim = pResult->GetVictim();
int Rainbowtype = clamp(pResult->GetInteger(0), 0, 2);
CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
if(!pPlayer)
return;
CCharacter* pChr = pSelf->m_apPlayers[Victim]->GetCharacter();
if(!pChr)
return;
char aBuf[256];
if ((pSelf->m_apPlayers[Victim]->m_Rainbow == RAINBOW_NONE || pSelf->m_apPlayers[Victim]->m_Rainbow == RAINBOW_BLACKWHITE) && Rainbowtype <= 1)
{
pSelf->m_apPlayers[Victim]->m_Rainbow = RAINBOW_COLOR;
str_format(aBuf, sizeof(aBuf), "You got rainbow by %s.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
else if ((pSelf->m_apPlayers[Victim]->m_Rainbow == RAINBOW_NONE || pSelf->m_apPlayers[Victim]->m_Rainbow == RAINBOW_COLOR) && Rainbowtype == 2)
{
pSelf->m_apPlayers[Victim]->m_Rainbow = RAINBOW_BLACKWHITE;
str_format(aBuf, sizeof(aBuf), "You got black and white rainbow by %s.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
else
{
pSelf->m_apPlayers[Victim]->m_Rainbow = RAINBOW_NONE;
str_format(aBuf, sizeof(aBuf), "%s removed your rainbow.", pSelf->Server()->ClientName(pResult->m_ClientID));
pSelf->SendChatTarget(Victim, aBuf);
}
}
示例14: ConSolo
void CGameContext::ConSolo(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)
{
pChr->m_Solo = !pChr->m_Solo;
pSelf->SendChatTarget(pResult->m_ClientID, pChr->m_Solo ? "You are now in solo" : "You are now out of solo");
}
}
示例15: ConLogin
void CGameContext::ConLogin(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;
if(pPlayer->m_LastLogin + 5 * pSelf->Server()->TickSpeed() - pSelf->Server()->Tick() > 0)
{
pSelf->SendChatTarget(pResult->m_ClientID, "You can login every 5 seconds only");
return;
}
pPlayer->m_LastLogin = pSelf->Server()->Tick();
pSelf->MemberList->Login(pResult->m_ClientID, pResult->GetString(0), pSelf);
}