本文整理汇总了C++中CGameContext::Score方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameContext::Score方法的具体用法?C++ CGameContext::Score怎么用?C++ CGameContext::Score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameContext
的用法示例。
在下文中一共展示了CGameContext::Score方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConMapInfo
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
}
示例2: ConRank
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
}
示例3: defined
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
}
示例4: 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
}
示例5: 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
}
示例6: ConTimes
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
}
}
示例7: ConMap
void CGameContext::ConMap(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
if (!CheckClientID(pResult->m_ClientID))
return;
if (g_Config.m_SvMapVote == 0)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "map",
"Admin has disabled /map");
return;
}
if (pResult->NumArguments() <= 0)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "map", "Example: /map adr3 to call vote for Adrenaline 3. This means that the map name must start with 'a' and contain the characters 'd', 'r' and '3' in that order");
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
pSelf->Score()->MapVote(pResult->m_ClientID, pResult->GetString(0));
#if defined(CONF_SQL)
if(g_Config.m_SvUseSQL)
pPlayer->m_LastSQLQuery = pSelf->Server()->Tick();
#endif
}