Code:
L4D_GetRandomPZSpawnPosition(client, zombieclass, 5, vPos);
L4D_GetRandomPZSpawnPosition could return false on failure to find valid location.
PHP Code:
/**
* @brief Attempts to find a random valid position to spawn a Special Infected
* @remarks The zombieClass does not matter but different values yield different results:
* @remarks Using the Tank zombieClass probably searches for a larger area that's clear of objects
*
* @param client Client id to find an area near this player
* @param zombieClass Special Infected class to search for a spawn position for
* @param attempts How many tries to find a valid location
* @param vecPos The vector array to store the valid location on success
*
* @return True on success, false on failure to find valid location
*/
native bool L4D_GetRandomPZSpawnPosition(int client, int zombieClass, int attempts, float vecPos[3]);
so I usually write
PHP Code:
if(L4D_GetRandomPZSpawnPosition(client, zombieclass, 5, vPos) == true)
{
L4D2_SpawnSpecial(zombieclass, vPos, NULL_VECTOR);
}
else
{
PrintToServer("[TS] Couldn't find a valid Spawn position in 5 tries");
}
__________________