View Single Post
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 05-09-2021 , 01:08   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.2)[09-May-2021]
Reply With Quote #16

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 clientint zombieClassint attemptsfloat vecPos[3]); 
so I usually write
PHP Code:
if(L4D_GetRandomPZSpawnPosition(clientzombieclass5vPos) == true)
{
    
L4D2_SpawnSpecial(zombieclassvPosNULL_VECTOR);
}
else
{
    
PrintToServer("[TS] Couldn't find a valid Spawn position in 5 tries");

__________________
HarryPotter is offline