Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CWorld::UpdatePlayers()
- {
- for (int i = 1; i <= g_Engine.GetMaxClients(); i++)
- {
- if (i == g_Local.iIndex)
- continue;
- char buff[512 + sizeof(hud_player_info_t)];
- hud_player_info_t *thePlayerInfo = (hud_player_info_t *)&buff[0];
- memset(thePlayerInfo, NULL, 512 + sizeof(hud_player_info_t));
- g_Engine.pfnGetPlayerInfo(i, thePlayerInfo);
- memcpy(&g_PlayerInfoList[i], thePlayerInfo, sizeof(hud_player_info_t));
- cl_entity_s *ent = g_Engine.GetEntityByIndex(i);
- g_Player[i].bUpdated = g_Utils.IsPlayerUpdated(ent);
- if (!g_Player[i].bUpdated)
- {
- g_Player[i].iShotsFired = 0;
- g_Player[i].bAlive = false;
- continue;
- }
- g_Player[i].dwHistory = GetTickCount();
- g_PlayerExtraInfoList[ent->index].szWeaponName = "null";
- if (ent && ent->curstate.weaponmodel)
- {
- model_s* mdl = g_Studio.GetModelByIndex(ent->curstate.weaponmodel);
- if (mdl && mdl->name)
- {
- char *szWeapon = strstr(mdl->name, "/p_");
- if (szWeapon)
- {
- szWeapon = &szWeapon[3];
- g_Utils.StringReplace(szWeapon, ".mdl", "");
- g_PlayerExtraInfoList[ent->index].szWeaponName = new char[strlen(mdl->name) + 1];
- strcpy(g_PlayerExtraInfoList[ent->index].szWeaponName, szWeapon);
- }
- }
- }
- g_Player[i].bAlive = g_Utils.IsPlayerAlive(ent);
- if (!g_Player[i].bAlive)
- continue;
- g_Player[i].vAngles = Vector(-ent->angles[0] * 3, ent->angles[1], ent->angles[2]);//Restore original angles
- g_Player[i].flFrametime = ent->curstate.animtime - ent->prevstate.animtime;
- if (g_Player[i].flFrametime == NULL)
- g_Player[i].flFrametime = g_Local.flFrametime;
- g_Player[i].bDucked = ((ent->curstate.maxs[2] - ent->curstate.mins[2]) < 54 ? true : false);
- g_Player[i].vPrevOrigin = g_Player[i].vOrigin;
- g_Player[i].vOrigin = ent->curstate.origin;
- g_Player[i].vVelocity = ent->curstate.origin - ent->prevstate.origin;
- g_Player[i].flDist = g_Player[i].vOrigin.Distance(g_Local.vOrigin);
- int seq = Cstrike_SequenceInfo[ent->curstate.sequence];
- if (seq == SEQUENCE_RELOAD) {
- g_Player[i].iShotsFired = 0;
- }
- UpdateVisibility(i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement