fix random ztele feature: exception and no zombie when there are no spawnpoints found
which was caused by maps using renamed logic entities for spawnpoints (also fixed detecting those) removed deprecated cvar flag
This commit is contained in:
parent
37a7224d6c
commit
f987a534f2
|
@ -214,10 +214,10 @@ CvarsInit()
|
|||
// Create public cvar for tracking.
|
||||
decl String:description[64];
|
||||
Format(description, sizeof(description), "%s Current version of this plugin", TRANSLATION_PHRASE_PREFIX);
|
||||
CreateConVar("gs_zombiereloaded_version", VERSION, description, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
CreateConVar("gs_zombiereloaded_version", VERSION, description, FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
|
||||
#if defined ADD_VERSION_INFO
|
||||
CreateConVar("zombiereloaded_revision", ZR_VER_REVISION, "Revision number for this plugin in source code repository.", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
CreateConVar("zombiereloaded_revision", ZR_VER_REVISION, "Revision number for this plugin in source code repository.", FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
#endif
|
||||
|
||||
// Forward event to modules.
|
||||
|
|
|
@ -85,18 +85,18 @@ void ZTeleOnRoundStart()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (g_iZTeleSpawnPointsCount >= MAX_PLAYER_SPAWNS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
GetEdictClassname(i, classname, sizeof(classname));
|
||||
GetEntityClassname(i, 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]);
|
||||
|
||||
g_iZTeleSpawnPointsCount++;
|
||||
|
||||
if (g_iZTeleSpawnPointsCount >= MAX_PLAYER_SPAWNS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ bool ZTeleClient(int client, bool force = false)
|
|||
void ZTele_TeleportClient(int client)
|
||||
{
|
||||
// Teleport client.
|
||||
if (ZTele_IsRandomSpawnEnabled())
|
||||
if (ZTele_IsRandomSpawnEnabled() && g_iZTeleSpawnPointsCount)
|
||||
{
|
||||
int select = Math_GetRandomInt(0, g_iZTeleSpawnPointsCount - 1);
|
||||
TeleportEntity(client, g_vecZTeleSpawnPoints[select], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
|
||||
|
|
Loading…
Reference in New Issue
Block a user