本文整理汇总了C++中IPlayerInfo类的典型用法代码示例。如果您正苦于以下问题:C++ IPlayerInfo类的具体用法?C++ IPlayerInfo怎么用?C++ IPlayerInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IPlayerInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Msg
void SizzlingStats::SS_PlayerDisconnect( CSizzPluginContext *pPluginContext, edict_t *pEdict )
{
Msg( "SS_DeletePlayer\n" );
int ent_index = SCHelpers::EntIndexFromEdict(pEdict);
if (ent_index != -1)
{
if (m_PlayerDataManager.IsValidPlayer(ent_index))
{
playerAndExtra_t data = m_PlayerDataManager.GetPlayerData(ent_index);
data.m_pPlayerData->UpdateRoundStatsData(m_aPropOffsets);
data.m_pPlayerData->UpdateRoundExtraData(*data.m_pExtraData);
IPlayerInfo *pInfo = pPluginContext->GetPlayerInfo(ent_index);
if (m_bTournamentMatchRunning)
{
playerWebStats_t stats;
stats.m_scoreData = data.m_pPlayerData->GetRoundStatsData();
V_strncpy(stats.m_playerInfo.m_name, pInfo->GetName(), sizeof(stats.m_playerInfo.m_name));
V_strncpy(stats.m_playerInfo.m_steamid, pInfo->GetNetworkIDString(), sizeof(stats.m_playerInfo.m_steamid));
V_strncpy(stats.m_playerInfo.m_ip, pPluginContext->GetPlayerIPPortString(ent_index), sizeof(stats.m_playerInfo.m_ip));
stats.m_playerInfo.m_teamid = pInfo->GetTeamIndex();
CPlayerClassTracker *pTracker = data.m_pPlayerData->GetClassTracker();
stats.m_playerInfo.m_mostPlayedClass = pTracker->GetMostPlayedClass();
stats.m_playerInfo.m_playedClasses = pTracker->GetPlayedClasses();
m_pWebStatsHandler->EnqueuePlayerStats(stats);
}
}
m_vecMedics.FindAndRemove(ent_index);
m_PlayerDataManager.RemovePlayer(ent_index);
}
}
示例2: GetAbsAngles
static cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
}
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
if (!pInfo)
{
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
}
cell_t *pAng;
pContext->LocalToPhysAddr(params[2], &pAng);
QAngle ang = pInfo->GetAbsAngles();
pAng[0] = sp_ftoc(ang.x);
pAng[1] = sp_ftoc(ang.y);
pAng[2] = sp_ftoc(ang.z);
return 1;
}
示例3: defined
void MRecipientFilter::AddAllPlayers(int maxClients)
{
m_Recipients.RemoveAll();
int i;
for ( i = 1; i <= maxClients; i++ )
{
#if defined ( GAME_CSGO )
edict_t *pPlayer = PEntityOfEntIndex(i);
#else
edict_t *pPlayer = engine->PEntityOfEntIndex(i);
#endif
if ( !pPlayer || pPlayer->IsFree()) {
continue;
}
IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( pPlayer );
if (!playerinfo || !playerinfo->IsConnected())
{
continue;
}
if (playerinfo->IsHLTV())
{
continue;
}
if (strcmp(playerinfo->GetNetworkIDString(),"BOT") == 0)
{
continue;
}
m_Recipients.AddToTail(i);
}
}
示例4: GetPlayerMaxs
static cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
}
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
if (!pInfo)
{
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
}
cell_t *pVec;
pContext->LocalToPhysAddr(params[2], &pVec);
Vector vec = pInfo->GetPlayerMaxs();
pVec[0] = sp_ftoc(vec.x);
pVec[1] = sp_ftoc(vec.y);
pVec[2] = sp_ftoc(vec.z);
return 1;
}
示例5: getName
const char *CClient :: getName ()
{
IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( m_pPlayer );
if ( playerinfo )
return playerinfo->GetName();
return NULL;
}
示例6: ClientConnect
//---------------------------------------------------------------------------------
// Purpose: called when a client joins a server
//---------------------------------------------------------------------------------
PLUGIN_RESULT CEmptyServerPlugin::ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
{
IPlayerInfo *pPlayerInfo = playerinfomanager->GetPlayerInfo( pEntity );
if (pPlayerInfo)
Msg("player: %s connected\n", pPlayerInfo->GetName() );
else
Msg("ClientConnect error\n");
return PLUGIN_CONTINUE;
}
示例7: sprintf
void BaseGameView::updateInfo() {
int tileSize = _tileManager->getTileSize();
int mapHeight = _model->getMap()->getHeight() * tileSize;
int lineSpacing = 24;
int currentY = _infoOffsetY;
int currentX = _infoOffsetX + 8;
_displayImg->draw_rectangle(_infoOffsetX, _infoOffsetY,
_infoOffsetX + _backgroundInfoWidth,
mapHeight + _displayOffset.second,
__cBlack);
sprintf(__drawString, "Current turn: %5d", _model->getCurrentTurnCount());
_displayImg->draw_text(currentX, currentY, __drawString,
__cTurquoise1, __cBlack, 1.0, __smallFont);
currentY += lineSpacing;
vector<IPlayerInfo*> playerInfos = _model->getPlayersInfo();
IPlayerInfo* cur;
for (int i = 0; i < playerInfos.size(); i++) {
cur = playerInfos[i];
pair<int,int> pos = cur->getHeadquarterPosition();
sprintf(__drawString, "Team %c - Head: (%d, %d)", cur->getPlayerMapID(),
pos.first, pos.second);
_displayImg->draw_text(currentX, currentY, __drawString,
__cGreen, __cBlack, 1.0, __bigFont);
currentY += lineSpacing;
sprintf(__drawString, "Pos\t\tHP\tAmmo\tRange");
_displayImg->draw_text(currentX, currentY, __drawString,
__cPink, __cBlack, 1.0, __smallFont);
currentY += lineSpacing;
list<ITank*> tanks = cur->getAliveTanks();
for (list<ITank*>::iterator it = tanks.begin(); it != tanks.end(); ++it) {
ITank* tank = *it;
pos = tank->getPosition();
sprintf(__drawString, "(%2d, %2d)\t%2d\t%4d\t%5d",
pos.first, pos.second,
tank->getHP(), tank->getAmmoNumber(),
tank->getRange());
_displayImg->draw_text(currentX, currentY, __drawString,
__cWhite, __cBlack, 1.0, __smallFont);
currentY += lineSpacing;
}
}
}
示例8: getOrigin
Vector CClient :: getOrigin ()
{
IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( m_pPlayer );
if ( playerinfo )
{
return playerinfo->GetAbsOrigin() + Vector(0,0,32);
}
return CBotGlobals::entityOrigin(m_pPlayer) + Vector(0,0,32);//m_pPlayer->GetCollideable()->GetCollisionOrigin();
}
示例9: ClientPutInServer
//---------------------------------------------------------------------------------
// Purpose: called on
//---------------------------------------------------------------------------------
void CEmptyServerPlugin::ClientPutInServer( edict_t *pEntity, char const *playername )
{
if( !pEntity || pEntity->IsFree() )
return;
IPlayerInfo *pPlayerInfo = playerinfomanager->GetPlayerInfo( pEntity );
if (pPlayerInfo)
Msg("player: %s put in server\n", pPlayerInfo->GetName() );
else
Msg("ClientPutInServer error\n");
}
示例10: OnClientSettingsChanged
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (!pPlayer->IsConnected())
{
return;
}
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
m_clinfochanged->Execute(&res, NULL);
IPlayerInfo *info = pPlayer->GetPlayerInfo();
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
const char *old_name = pPlayer->m_Name.c_str();
if (strcmp(old_name, new_name) != 0)
{
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
{
if (!CheckSetAdminName(client, pPlayer, id))
{
pPlayer->Kick("Your name is reserved by SourceMod; set your password to use it.");
RETURN_META(MRES_IGNORED);
}
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
if (id == pPlayer->GetAdminId())
{
/* This player is changing their name; force them to drop admin privileges! */
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
}
}
pPlayer->SetName(new_name);
}
if (m_PassInfoVar.size() > 0)
{
/* Try for a password change */
const char *old_pass = pPlayer->m_LastPassword.c_str();
const char *new_pass = engine->GetClientConVarValue(client, m_PassInfoVar.c_str());
if (strcmp(old_pass, new_pass) != 0)
{
pPlayer->m_LastPassword.assign(new_pass);
if (pPlayer->IsInGame() && pPlayer->IsAuthorized())
{
/* If there is already an admin id assigned, this will just bail out. */
pPlayer->DoBasicAdminChecks();
}
}
}
}
示例11: startGame
bool CCSSBot :: startGame ()
{
// do whatever is necessary here to join the game...
IPlayerInfo* pInfo = playerinfomanager->GetPlayerInfo(m_pEdict);
if ( pInfo->GetTeamIndex() == 0 )
{
pInfo->ChangeTeam(randomInt(2,3));
}
return (pInfo->GetTeamIndex() != 0);
}
示例12: ChatEvent
void SizzlingStats::ChatEvent( CSizzPluginContext *pPluginContext, int entindex, const char *pText, bool bTeamChat )
{
IPlayerInfo *pInfo = pPluginContext->GetPlayerInfo(entindex);
if (!pInfo)
{
return;
}
const char *pSteamId = pInfo->GetNetworkIDString();
// during the match, m_flMatchDuration is the Plat_FloatTime() from when the game started
// so subtracting gets the time since the match started
m_pWebStatsHandler->PlayerChatEvent(Plat_FloatTime() - m_flMatchDuration, pSteamId, pText, bTeamChat);
}
示例13: CheckPlayerDropped
void SizzlingStats::CheckPlayerDropped( CSizzPluginContext *pPluginContext, int victimIndex )
{
for (int i = 0; i < m_vecMedics.Count(); ++i)
{
int medIndex = m_vecMedics[i];
SS_PlayerData *pMedData = m_PlayerDataManager.GetPlayerData(medIndex).m_pPlayerData;
SS_PlayerData *pVictimData = m_PlayerDataManager.GetPlayerData(victimIndex).m_pPlayerData;
IPlayerInfo *pMedPlayerInfo = pPluginContext->GetPlayerInfo(medIndex);
IPlayerInfo *pVictimPlayerInfo = pPluginContext->GetPlayerInfo(victimIndex);
if ( pMedPlayerInfo->GetTeamIndex() == pVictimPlayerInfo->GetTeamIndex() )
{
using namespace SCHelpers;
CTFPlayerWrapper medic(pMedData->GetBaseEntity());
//CBaseEntity *pMedigun = pPluginContext->BaseEntityFromBaseHandle(hMedigun);
//const char *szWeapon = SCHelpers::GetClassName(pMedigun);
//if ( szWeapon && SCHelpers::FStrEq(szWeapon, "tf_weapon_medigun") )
//{
float flChargeLevel = medic.GetChargeLevel(pPluginContext);
bool bReleasingCharge = medic.IsReleasingCharge();
if (flChargeLevel == 1.0f || bReleasingCharge)
{
CTFPlayerWrapper victim(pVictimData->GetBaseEntity());
Vector *victimPos = victim.GetPlayerOrigin();
Vector *medPos = medic.GetPlayerOrigin();
vec_t distance = victimPos->DistToSqr( *medPos );
SS_AllUserChatMessage( pPluginContext, UTIL_VarArgs("distance: %.2f\n", distance) );
if (distance <= 230400.0f) // ~480 units is max target distance for medigun
{
IHandleEntity *pMedHandleEnt = pPluginContext->HandleEntityFromEntIndex(medIndex);
// slot 2 because we want the medigun
IHandleEntity *pMedigunHandleEnt = pPluginContext->HandleEntityFromEntIndex(medic.GetWeapon(2)->GetEntryIndex());
Ray_t ray;
ray.Init(*medPos, *victimPos);
CTraceFilterSkipTwo traceFilter(pMedHandleEnt, pMedigunHandleEnt);
trace_t trace;
enginetrace->TraceRay(ray, MASK_SHOT_HULL, &traceFilter, &trace);
if (!trace.DidHit())
{
SS_AllUserChatMessage( pPluginContext, "player dropped\n" );
}
}
}
//}
}
}
}
示例14: EdictFromEntIndex
bool CSizzPluginContext::CanRecordDemo()
{
for (int i = 1; i <= GetMaxClients(); ++i)
{
edict_t *pEdict = EdictFromEntIndex(i);
IPlayerInfo *pInfo = m_pPlayerInfoManager->GetPlayerInfo(pEdict);
if (pInfo && pInfo->IsHLTV())
{
return true;
}
}
return false;
}
示例15: clientActive
void CClient :: clientActive ()
{
// get steam id
IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( m_pPlayer );
m_szSteamID = NULL;
if ( playerinfo )
{
// store steam id
m_szSteamID = (char*)playerinfo->GetNetworkIDString();
// check my access levels
CAccessClients::checkClientAccess(this);
}
}