I'm using this to add a bot (spawn and kick fakeclient), which works fine whenever I'm near any info_survivor_position entities in the beginning of each map. For some reason, when I'm too far away from those entities, I can't spawn any more additional bots. Instead it adds a fakeclient and shows it as a DEAD survivor.
I allready tried creating an additional info_survivor_position and change it's coordinates every 10 seconds to the origin of an alive survivor. But that didn't help. :/
I tried searching for a cmd that limits the range between survivor and spawnpoint, but didn't find one.
Any ideas on how I can spawn that bot on demand?
PHP Code:
bool:SpawnFakeClient()
{
new bool:fakeclientKicked = false
// create fakeclient
new createdFakeclient = 0
createdFakeclient = CreateFakeClient("FakeClient")
// if entity is valid
if (createdFakeclient != 0)
{
// move into survivor team
ChangeClientTeam(createdFakeclient, TEAM_SURVIVORS)
// check if entity classname is survivorbot
if (DispatchKeyValue(createdFakeclient, "classname", "survivorbot") == true)
{
// spawn the client
if (DispatchSpawn(createdFakeclient) == true)
{
// kick the fake client to make the bot take over
CreateTimer(DELAY_KICK_FAKECLIENT, Timer_KickFakeBot, createdFakeclient, TIMER_REPEAT)
fakeclientKicked = true
}
}
// if something went wrong, kick the created FakeClient
if (fakeclientKicked == false)
KickClient(createdFakeclient, "Kicking FakeClient")
}
return fakeclientKicked
}
__________________