Raised This Month: $ Target: $400
 0% 

How to exclude bots from votes?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 12-13-2013 , 16:47   How to exclude bots from votes?
Reply With Quote #1

Hello,

I was wondering if there is a way to exclude any bots from the votes? For example for RTV, they are currently counted as players and it adds up towards the total votes required.
__________________
cw main:

cw speedruns:
vodka00 is offline
NIGathan
Senior Member
Join Date: Aug 2011
Location: /dev/null
Old 12-13-2013 , 16:57   Re: How to exclude bots from votes?
Reply With Quote #2

IsFakeClient() http://docs.sourcemod.net/api/index....d=show&id=407&
NIGathan is offline
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 12-13-2013 , 17:19   Re: How to exclude bots from votes?
Reply With Quote #3

From what I see this bit already has isfakeclient.

Code:
public OnClientConnected(client)
{
	if(IsFakeClient(client))
		return;
	
	g_Voted[client] = false;

	g_Voters++;
	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
	
	return;
}

public OnClientDisconnect(client)
{
	if(IsFakeClient(client))
		return;
	
	if(g_Voted[client])
	{
		g_Votes--;
	}
	
	g_Voters--;
	
	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
	
	if (!g_CanRTV)
	{
		return;	
	}
	
	if (g_Votes && 
		g_Voters && 
		g_Votes >= g_VotesNeeded && 
		g_RTVAllowed ) 
	{
		if (GetConVarInt(g_Cvar_RTVPostVoteAction) == 1 && HasEndOfMapVoteFinished())
		{
			return;
		}
		
		StartRTV();
	}	
}
Unless it needs an else statement after those ifs?
__________________
cw main:

cw speedruns:
vodka00 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-13-2013 , 17:45   Re: How to exclude bots from votes?
Reply With Quote #4

new g_Voted[MAXPLAYERS+1]; by default creation is false. Mean this including bot is false.

try

Quote:
if ( IsFakeClient(client )) g_Voted[client] = true;
EDIT: Sorry for the poor explanation.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 12-13-2013 at 17:46.
GsiX is offline
NIGathan
Senior Member
Join Date: Aug 2011
Location: /dev/null
Old 12-13-2013 , 18:27   Re: How to exclude bots from votes?
Reply With Quote #5

It looks like returning if IsFakeClient() is fine, but if it still counts bots then maybe try OnClientAuthorized instead of connected? I'm not really sure but the comments on the IsFakeClient page say it does work from OnClientAuthorized so I'd give it a try.
NIGathan 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 11:19.


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