Raised This Month: $ Target: $400
 0% 

[L4D] Fakeclients coming back


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
gbr161
Member
Join Date: May 2012
Old 10-17-2013 , 07:37   [L4D] Fakeclients coming back
Reply With Quote #1

Hello.
Ive got weird problem with fakeclients, heres part of the code:
Code:
checkbots()
{
	if(GetConVarInt(maxplayers)>TotalSurvivors())
	{
		while(GetConVarInt(maxplayers)!=TotalSurvivors())
		{
			l4dbot();
		}
	}else
	{
		new botstoremove=TotalSurvivors()-GetConVarInt(maxplayers)
		for(new i = 1; i <= MaxClients; i++)
		{
			if(IsClientConnected(i) && IsClientInGame(i))
			{
				if((GetClientTeam(i) == TEAM_SURVIVORS) && IsAlive(i))
				{
					if(IsFakeClient(i) && !HasIdlePlayer(i))
					{
						if(botstoremove>0)
						{
							KickClient(i,"")
							botstoremove--
						}else
						{
							break
						}
					}
				}
			}
		}
	}
	for(new i = 1; i <= MaxClients; i++)
	{

	}
}
public l4dbot()
{
	new bot = CreateFakeClient("I am not real.");
	ChangeClientTeam(bot,2);
	DispatchKeyValue(bot,"classname","SurvivorBot");
	DispatchSpawn(bot);
	CreateTimer(3.0,kickbot,bot);
}

public Action:kickbot(Handle:timer, any:value)
{
	KickClient(value,"fake player");
	return Plugin_Stop;
}
checkbots() is called when i change number of bots and when player spawns in round.
All works good for first round but after next round ive got bunch of fakeclients standing in the saferoom and unable to play :/

What am i doing wrong?
gbr161 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode