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); } }
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; }
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); } }
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; }
const char *CClient :: getName () { IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( m_pPlayer ); if ( playerinfo ) return playerinfo->GetName(); return NULL; }
//--------------------------------------------------------------------------------- // 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; }
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; } } }
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(); }
//--------------------------------------------------------------------------------- // 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"); }
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(); } } } }
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); }
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); }
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" ); } } } //} } } }
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; }
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); } }
cell_t GetSurvivorScore(IPluginContext *pContext, const cell_t *params) { CBaseEntity *pPlayer = gamehelpers->ReferenceToEntity(params[1]); if (!pPlayer) return pContext->ThrowNativeError("Invalid client index %d", params[1]); cell_t client = gamehelpers->ReferenceToIndex(params[1]); IGamePlayer *pGamePlayer = playerhelpers->GetGamePlayer(client); if (!pGamePlayer || !pGamePlayer->IsInGame()) return pContext->ThrowNativeError("Client index %d not in game", params[1]); IPlayerInfo* pInfo = pGamePlayer->GetPlayerInfo(); if(!pInfo || pInfo->IsObserver() || pInfo->GetTeamIndex() != 2) return -1; return Detours::g_scores[client]; }
void CBotSquad::Init () { edict_t *pLeader; m_theDesiredFormation = SQUAD_FORM_WEDGE; // default wedge formation m_fDesiredSpread = SQUAD_DEFAULT_SPREAD; m_CombatType = COMBAT_COMBAT; bCanFire = true; if ( (pLeader = GetLeader()) != NULL ) { IPlayerInfo *p = playerinfomanager->GetPlayerInfo(pLeader); m_vLeaderAngle = p->GetLastUserCommand().viewangles; } }
int __thiscall RevivedByDefib::OnRevived(CBaseEntity *pInitiator, void *deathModel) { CBaseEntity* pTarget = reinterpret_cast<CBaseEntity*>(this); cell_t client = gamehelpers->EntityToBCompatRef(pTarget); IGamePlayer* pGamePlayer = playerhelpers->GetGamePlayer(client); if(pGamePlayer) { IPlayerInfo* pInfo = pGamePlayer->GetPlayerInfo(); if(pInfo) { r_nowAlive(pInfo->GetAbsOrigin(), g_dead_players, arraysize(g_dead_players)); L4D_DEBUG_LOG("RevivedByDefib called for: %s", pInfo->GetName()); } } return (this->*(GetTrampoline()))(pInitiator, deathModel); }
void SizzlingStats::SS_TournamentMatchStarted( CSizzPluginContext *pPluginContext ) { Msg( "tournament match started\n" ); m_bTournamentMatchRunning = true; m_flMatchDuration = Plat_FloatTime(); V_strncpy(m_pHostInfo->m_hostname, pPluginContext->GetHostName(), 64); V_strncpy(m_pHostInfo->m_mapname, pPluginContext->GetMapName(), 64); V_strncpy(m_pHostInfo->m_bluname, pPluginContext->GetBluTeamName(), 32); V_strncpy(m_pHostInfo->m_redname, pPluginContext->GetRedTeamName(), 32); m_pHostInfo->m_hostip = m_refHostIP.GetInt(); V_strncpy(m_pHostInfo->m_ip, m_refIP.GetString(), 32); m_pHostInfo->m_hostport = m_refHostPort.GetInt(); m_pHostInfo->m_roundduration = m_flRoundDuration; m_pWebStatsHandler->SetHostData(*m_pHostInfo); // record demos if the cvar is non-zero if (record_demos.GetBool()) { m_STVRecorder.StartRecording(pPluginContext, m_pHostInfo->m_mapname); } CTFPlayerWrapper player; for (int i = 1; i <= MAX_PLAYERS; ++i) { if (m_PlayerDataManager.IsValidPlayer(i)) { player.SetPlayer(pPluginContext->BaseEntityFromEntIndex(i)); IPlayerInfo *pInfo = pPluginContext->GetPlayerInfo(i); playerInfo_t info; V_strncpy(info.m_name, pInfo->GetName(), sizeof(info.m_name)); V_strncpy(info.m_steamid, pInfo->GetNetworkIDString(), sizeof(info.m_steamid)); V_strncpy(info.m_ip, pPluginContext->GetPlayerIPPortString(i), sizeof(info.m_ip)); info.m_teamid = pInfo->GetTeamIndex(); info.m_mostPlayedClass = player.GetClass(); m_pWebStatsHandler->EnqueuePlayerInfo(info); } } // set the api key m_pWebStatsHandler->SetApiKey(apikey.GetString()); // send the initial match info to the web m_pWebStatsHandler->SendGameStartEvent(); }
//--------------------------------------------------------------------------------- // Purpose: called on level start //--------------------------------------------------------------------------------- void CEmptyServerPlugin::ClientSettingsChanged( edict_t *pEdict ) { if ( playerinfomanager ) { IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( pEdict ); const char * name = engine->GetClientConVarValue( engine->IndexOfEdict(pEdict), "name" ); if ( playerinfo && name && playerinfo->GetName() && Q_stricmp( name, playerinfo->GetName()) ) // playerinfo may be NULL if the MOD doesn't support access to player data // OR if you are accessing the player before they are fully connected { ClientPrint( pEdict, "Your name changed to \"%s\" (from \"%s\"\n", name, playerinfo->GetName() ); // this is the bad way to check this, the better option it to listen for the "player_changename" event in FireGameEvent() // this is here to give a real example of how to use the playerinfo interface } } }
void CSizzPluginContext::GetSteamIDString( int userid, char *dest, int buff_size ) { if (dest && (buff_size > 0)) { int ent_index = EntIndexFromUserID(userid); if (ent_index != -1) { IPlayerInfo *pInfo = GetPlayerInfo(ent_index); if (pInfo) { const char *src = pInfo->GetNetworkIDString(); if (src) { V_strncpy(dest, src, buff_size); } } } } }
bool SizzlingStats::SS_PlayerConnect( CSizzPluginContext *pPluginContext, edict_t *pEdict ) { Msg( "SS_InsertPlayer\n" ); int ent_index = SCHelpers::EntIndexFromEdict(pEdict); if (ent_index != -1) { IPlayerInfo *pPlayerInfo = pPluginContext->GetPlayerInfo(ent_index); if (pPlayerInfo && pPlayerInfo->IsConnected()) { CBaseEntity *pEnt = SCHelpers::EdictToBaseEntity(pEdict); m_PlayerDataManager.InsertPlayer(ent_index, pEnt); int acc_id = pPluginContext->SteamIDFromEntIndex(ent_index); SS_Msg("Stats for player #%i: '%s' will be tracked\n", acc_id, pPlayerInfo->GetName()); return true; } } return false; }
void SamplePlugin::Hook_ClientSettingsChanged(edict_t *pEdict) { if (playerinfomanager) { IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo(pEdict); const char *name = engine->GetClientConVarValue(IndexOfEdict(pEdict), "name"); if (playerinfo != NULL && name != NULL && strcmp(engine->GetPlayerNetworkIDString(pEdict), "BOT") != 0 && playerinfo->GetName() != NULL && strcmp(name, playerinfo->GetName()) == 0) { char msg[128]; MM_Format(msg, sizeof(msg), "Your name changed to \"%s\" (from \"%s\")\n", name, playerinfo->GetName()); engine->ClientPrintf(pEdict, msg); } } }
bool Bot_RunMimicCommand( CBotCmd& cmd ) { if ( bot_mimic.GetInt() <= 0 ) return false; if ( bot_mimic.GetInt() > gpGlobals->maxClients ) return false; IPlayerInfo *playerInfo = playerinfomanager->GetPlayerInfo( engine->PEntityOfEntIndex( bot_mimic.GetInt() ) ); if ( !playerInfo ) return false; cmd = playerInfo->GetLastUserCommand(); cmd.viewangles[YAW] += bot_mimic_yaw_offset.GetFloat(); if( bot_crouch.GetInt() ) cmd.buttons |= IN_DUCK; return true; }
static cell_t GetHealth(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"); } return pInfo->GetHealth(); }
int CPlayer::GetLifeState() { if (lifestate_offset == -1) { if (!g_pGameConf->GetOffset("m_lifeState", &lifestate_offset)) { lifestate_offset = -2; } } if (lifestate_offset < 0) { IPlayerInfo *info = GetPlayerInfo(); if (info == NULL) { return PLAYER_LIFE_UNKNOWN; } return info->IsDead() ? PLAYER_LIFE_DEAD : PLAYER_LIFE_ALIVE; } if (m_pEdict == NULL) { return PLAYER_LIFE_UNKNOWN; } CBaseEntity *pEntity; IServerUnknown *pUnknown = m_pEdict->GetUnknown(); if (pUnknown == NULL || (pEntity = pUnknown->GetBaseEntity()) == NULL) { return PLAYER_LIFE_UNKNOWN; } if (*((uint8_t *)pEntity + lifestate_offset) == LIFE_ALIVE) { return PLAYER_LIFE_ALIVE; } else { return PLAYER_LIFE_DEAD; } }
bool CCSSBot :: isEnemy ( edict_t *pEdict,bool bCheckWeapons ) { if ( ENTINDEX(pEdict) > CBotGlobals::maxClients() ) return false; if ( pEdict->IsFree() ) return false; if ( !CBotGlobals::isNetworkable(pEdict) ) return false; IPlayerInfo *p = playerinfomanager->GetPlayerInfo(pEdict); if ( p == NULL ) return false; if ( m_pEdict == pEdict ) return false; if ( !CBotGlobals::entityIsAlive ( pEdict ) ) return false; return (p->GetTeamIndex() != getTeam()); }
void SizzlingStats::SS_EndOfRound( CSizzPluginContext *pPluginContext ) { for (int i = 1; i <= MAX_PLAYERS; ++i) { if (m_PlayerDataManager.IsValidPlayer(i)) { playerAndExtra_t data = m_PlayerDataManager.GetPlayerData(i); data.m_pPlayerData->UpdateRoundStatsData(m_aPropOffsets); data.m_pPlayerData->UpdateRoundExtraData(*data.m_pExtraData); IPlayerInfo *pInfo = pPluginContext->GetPlayerInfo(i); 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(i), 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); } if (pInfo->GetTeamIndex() > 1) { SS_DisplayStats(pPluginContext, i); } } } if (m_bTournamentMatchRunning) { m_pHostInfo->m_roundduration = m_flRoundDuration; m_pWebStatsHandler->SetHostData(*m_pHostInfo); m_pWebStatsHandler->SendStatsToWeb(); } }
void XmlReport::writeJoueur(ticpp::Element * eJoueurs, ClanMember * player) { IPlayerInfo * pInfo = player->getPlayerInfo(); PlayerScore * stats = player->getCurrentScore(); if (isValidPlayerInfo(pInfo)) // excludes SourceTv { ticpp::Element * eJoueur = new ticpp::Element("joueur"); eJoueur->SetAttribute("steamid", pInfo->GetNetworkIDString()); ticpp::Element * ePseudo = new ticpp::Element("pseudo", pInfo->GetName()); eJoueur->LinkEndChild(ePseudo); ticpp::Element * eKills = new ticpp::Element("kills", stats->kills); eJoueur->LinkEndChild(eKills); ticpp::Element * eDeaths = new ticpp::Element("deaths", stats->deaths); eJoueur->LinkEndChild(eDeaths); eJoueurs->LinkEndChild(eJoueur); } }
static cell_t GetModelName(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"); } const char *model = pInfo->GetModelName(); pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), model ? model : "", NULL); return 1; }