Raised This Month: $51 Target: $400
 12% 

Native "IsFakeClient" reported: Client index 0 is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 07-27-2008 , 17:38   Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #1

What is wrong with this?
Code:
public Action:Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));	
	if (IsFakeClient(client))
	{
		return;
	}
	// some code
}
Error:
Code:
[SM] Native "IsFakeClient" reported: Client index 0 is invalid
[SM] Displaying call stack trace for plugin "test-plugin.smx":
[SM]   [0]  Line 64, /home/groups/sourcemod/upload_tmp/phpRz9Q5o.sp::Event_PlayerTeam()
Tried to add function that prints to chat current client value for diagnostic but it tells me 21 (not 0).
exvel is offline
Send a message via ICQ to exvel
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-27-2008 , 17:57   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #2

Are you trying this on a listen server?
bl4nk is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 07-27-2008 , 18:10   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #3

Code:
new client = GetClientOfUserId(GetEventInt(event, "userid"));    // Means the client not connected. if(!client) {      return; }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 07-27-2008 , 18:11   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #4

bl4nk, no, I am running SRCDS. But it runs on the same computer from which I start the game for testing.

Last edited by exvel; 07-27-2008 at 18:15.
exvel is offline
Send a message via ICQ to exvel
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 07-27-2008 , 18:13   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #5

Quote:
Originally Posted by teame06 View Post
Code:
new client = GetClientOfUserId(GetEventInt(event, "userid"));    // Means the client not connected. if(!client) {      return; }
I think here is something else. Because if I use PrintToChat(client, message) it works fine, so client (me) is connected.
exvel is offline
Send a message via ICQ to exvel
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 07-27-2008 , 18:19   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #6

Sorry. It really works.
Thanks, teame06 for helping but I dont understand wich client fires this event with clinet=0... world?
exvel is offline
Send a message via ICQ to exvel
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 07-27-2008 , 19:23   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #7

Quote:
Originally Posted by exvel View Post
Sorry. It really works.
Thanks, teame06 for helping but I dont understand wich client fires this event with clinet=0... world?
When GetClientOfUserId return 0 it means the client is from the server. player_team event fire off when the client disconnect too.

Check the structure of the event next time. It has a parameter which says disconnect
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Kigen
BANNED
Join Date: Feb 2008
Old 07-27-2008 , 22:10   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #8

0 refers to the console generally. 0 is not a valid client index of course. Only 1-GetMaxClients() are valid client indexes.
Kigen is offline
mitchdb
New Member
Join Date: Jul 2008
Old 07-29-2008 , 15:34   Re: Native "IsFakeClient" reported: Client index 0 is invalid
Reply With Quote #9

You need to check to make sure the client is connected ( IsClientConnected ) before you try to check if it is fake
__________________
WebDestroya

MitchDB: Full server/player management system for Half-life/HL2 games
http://mitchdb.com/
mitchdb is offline
Send a message via AIM to mitchdb
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 09:27.


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