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

Get client SteamID on disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 08-25-2013 , 19:18   Get client SteamID on disconnect
Reply With Quote #1

to get SteamID on disconnect I use this code:
Code:
public OnClientDisconnect(client)
{
	if (IsClientInGame(client))
	{
		new String:query[295];
		new bool:check = GetClientAuthString(client, SteamID, sizeof(SteamID));
		if (check) // If the client is not connected or the index is invalid.
		{
			// cooooodeeee
		}
	}
}
But the thing is sometimes GetClientAuthString return false; and I suppose it means client already disconnected. If I'm right, I want to fix it; and get this code works for everyone.
So how to fix it? Should I use PRE player_disconnect & OnMapEnd?
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-25-2013 , 19:20   Re: Get client SteamID on disconnect
Reply With Quote #2

Hastily written pseudocode.
PHP Code:
g_bAuthed[MAXPLAYERS 1]
g_sSteam[MAXPLAYERS 1][24]

OnClientPostAdminCheck
[
g_bAuthed[client] = GetClientAuthString(clientg_sSteam[client], sizeof(g_sSteam[]))
}
OnClientDisconnect
{
if(
g_bAuthed[client])
//...g_sSteam[client], if it fails here they never authed.

g_bAuthed[client] = false;
g_sSteam[client][0] = '\0';

__________________

Last edited by thetwistedpanda; 08-25-2013 at 19:23.
thetwistedpanda is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 08-25-2013 , 19:52   Re: Get client SteamID on disconnect
Reply With Quote #3

@thetwistedpanda thank you, good idea. Is there any differences between using PRE player_disconnect & OnMapEnd and your way?
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-25-2013 , 20:04   Re: Get client SteamID on disconnect
Reply With Quote #4

I don't recall if the player_disconnect event actually fires for map changes, so that's something you may want to test. Pre-hooking it just means it's before clients are notified, it won't fire any earlier.
__________________
thetwistedpanda is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 08-25-2013 , 20:14   Re: Get client SteamID on disconnect
Reply With Quote #5

Quote:
Originally Posted by thetwistedpanda View Post
I don't recall if the player_disconnect event actually fires for map changes, so that's something you may want to test. Pre-hooking it just means it's before clients are notified, it won't fire any earlier.
Yes, player_disconnect doesn't fire on map changes, that's why I wrote OnMapEnd with it.
Pre-hoking player_disconnect allows to get user's frags, deaths and SteamID, that's why I chose pre.

Thank you
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.

Last edited by ShufflexDD; 08-25-2013 at 20:16.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
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 08:06.


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