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

Client Connect Public function


Post New Thread Reply   
 
Thread Tools Display Modes
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 03-08-2010 , 12:51   Re: Client Connect Public function
Reply With Quote #11

Also you can get player's steamid only after OnClientAuthorized is called. The best work around will be to move all your code in this forward.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Raver
Member
Join Date: May 2009
Location: Germany
Old 03-08-2010 , 13:00   Re: Client Connect Public function
Reply With Quote #12

Okay i has try it.
Here is the Code:
Code:
public Action:Event_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
	if(GetConVarInt(DisableStandardJoinMsg))
	{
		if(!dontBroadcast)
		{
			SetEventBroadcast(event, true);
		}
	}
	if(GetConVarInt(JoinMessageEnabled) == 1)
	{
		new client = GetClientOfUserId(GetEventInt(event, "userid"));
		new String:clientname[24];
		GetClientName(client, clientname, sizeof(clientname));
		new String:ip[18];
		GetClientIP(client, ip, sizeof(ip));
		new String:country[45];
		GeoipCountry(ip, country, sizeof(country));
		
		JoinMessage(clientname, country);
	}
	return Plugin_Continue;
}
And here is the message from the Console:
Code:
L 03/08/2010 - 18:58:09: [SM] Native "GetClientIP" reported: Client index 0 is invalid
L 03/08/2010 - 18:58:09: [SM] Displaying call stack trace for plugin "msgchange.smx":
L 03/08/2010 - 18:58:09: [SM]   [0]  Line 83, E:\Server-Stuff\msgchange.sp::Event_PlayerConnect()
Raver is offline
Frus
Senior Member
Join Date: Aug 2009
Old 03-08-2010 , 13:03   Re: Client Connect Public function
Reply With Quote #13

add this after you get the client number

Code:
if (!client) return Plugin_Continue;
Frus is offline
Raver
Member
Join Date: May 2009
Location: Germany
Old 03-08-2010 , 13:07   Re: Client Connect Public function
Reply With Quote #14

Dont work...
Code:
Code:
public Action:Event_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
	if(GetConVarInt(DisableStandardJoinMsg))
	{
		if(!dontBroadcast)
		{
			SetEventBroadcast(event, true);
		}
	}
	if(GetConVarInt(JoinMessageEnabled) == 1)
	{
		new client = GetClientOfUserId(GetEventInt(event, "userid"));
		new String:clientname[24];
		GetClientName(client, clientname, sizeof(clientname));
		new String:ip[18];
		GetClientIP(client, ip, sizeof(ip));
		new String:country[45];
		GeoipCountry(ip, country, sizeof(country));
		
		JoinMessage(clientname, country);
		if (!client)
		{
			return Plugin_Continue;
		}
	}
	return Plugin_Continue;
}
Code:
L 03/08/2010 - 19:06:35: [SM] Native "GetClientIP" reported: Client index 0 is invalid
L 03/08/2010 - 19:06:35: [SM] Displaying call stack trace for plugin "msgchange.smx":
L 03/08/2010 - 19:06:35: [SM]   [0]  Line 83, E:\Server-Stuff\Smsgchange.sp::Event_PlayerConnect()
Raver is offline
Frus
Senior Member
Join Date: Aug 2009
Old 03-08-2010 , 15:08   Re: Client Connect Public function
Reply With Quote #15

By 'after' I quite literally mean immediately after :S (the next line)
Frus is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-09-2010 , 06:49   Re: Client Connect Public function
Reply With Quote #16

use,
Code:
if (!client || client == 0)
and like he said, directly after.
__________________
asherkin is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 03-09-2010 , 12:11   Re: Client Connect Public function
Reply With Quote #17

PHP Code:
new server 0;
if (!
client || client == || client == server
Better triple check it to be completely sure.
__________________
plop
p3tsin is offline
cmptrwz
Member
Join Date: Dec 2008
Old 03-09-2010 , 12:21   Re: Client Connect Public function
Reply With Quote #18

PHP Code:
new server 0;
if (!
client || client == || client == server || !(client && client <= MaxClients)) 
cmptrwz is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-09-2010 , 12:22   Re: Client Connect Public function
Reply With Quote #19

lol, yea, I posted without thinking xD.
What I get for posting as I'm going out.
__________________
asherkin is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 03-09-2010 , 13:31   Re: Client Connect Public function
Reply With Quote #20

Quote:
Originally Posted by p3tsin View Post
PHP Code:
new server 0;
if (!
client || client == || client == server
Better triple check it to be completely sure.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
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 01:55.


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