Raised This Month: $ Target: $400
 0% 

[L4D] Fakeclients coming back


Post New Thread Reply   
 
Thread Tools Display Modes
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
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 10-17-2013 , 09:25   Re: [L4D] Fakeclients coming back
Reply With Quote #2

As far as i can tell.. your plugin is doing the checking before everybody is fully spawn on the next round.
Only guess tough.

EDIT: Also, you forget this ";"
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 10-17-2013 at 09:28.
GsiX is offline
gbr161
Member
Join Date: May 2012
Old 10-17-2013 , 09:34   Re: [L4D] Fakeclients coming back
Reply With Quote #3

Another plugin was reloading this plugin and this was causing fakeclients to appear. Anyway thanks for the reply
gbr161 is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 10-17-2013 , 11:35   Re: [L4D] Fakeclients coming back
Reply With Quote #4

semicolon is not required to compile; it's a personal preference in sp
Skyy is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-17-2013 , 16:39   Re: [L4D] Fakeclients coming back
Reply With Quote #5

Quote:
Originally Posted by Skyy View Post
semicolon is not required to compile; it's a personal preference in sp
Should become a habit of adding the semicolon to the end. It could help determine where the error(s) are.
Mitchell is offline
Reply



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 13:01.


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