From 21c2ac40a81a3330f73539c157eb7e74bfa4648f Mon Sep 17 00:00:00 2001 From: BotoX Date: Tue, 23 Aug 2016 16:12:32 +0200 Subject: [PATCH] random ztele: improve bfcaca166f8fc65f21f0c25a4be42425e7a4daad --- src/zr/ztele/ztele.inc | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/zr/ztele/ztele.inc b/src/zr/ztele/ztele.inc index aa39e79..6d0e991 100644 --- a/src/zr/ztele/ztele.inc +++ b/src/zr/ztele/ztele.inc @@ -74,27 +74,17 @@ void ZTele_OnCommandsCreate() void ZTeleOnRoundStart() { char classname[64]; - // GetMaxEntities() returns the max EDICT count. Multiply by 2 to get max ENTITY count. - // Some maps spawn their spawpoints as logic entities, as does sm-ext-CSSFixes. - int maxentities = GetMaxEntities() * 2; - g_iZTeleSpawnPointsCount = 0; - for (int i = MaxClients; i <= maxentities; i++) + int entity = INVALID_ENT_REFERENCE; + while((entity = FindEntityByClassname(entity, "info_player_*")) != INVALID_ENT_REFERENCE) { - if (!IsValidEntity(i)) - { - continue; - } - - GetEntityClassname(i, classname, sizeof(classname)); - + GetEntityClassname(entity, classname, sizeof(classname)); if (StrEqual(classname, "info_player_terrorist", true) || StrEqual(classname, "info_player_counterterrorist", true)) { - GetEntPropVector(i, Prop_Send, "m_vecOrigin", g_vecZTeleSpawnPoints[g_iZTeleSpawnPointsCount]); + GetEntPropVector(entity, Prop_Send, "m_vecOrigin", g_vecZTeleSpawnPoints[g_iZTeleSpawnPointsCount]); g_iZTeleSpawnPointsCount++; - if (g_iZTeleSpawnPointsCount >= MAX_PLAYER_SPAWNS) { break;