Raised This Month: $32 Target: $400
 8% 

[CS:GO] Safest Connection Hook? Experiencing Data Loss Bug


Post New Thread Reply   
 
Thread Tools Display Modes
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 12-31-2014 , 03:02   Re: [CS:GO] Safest Connection Hook? Experiencing Data Loss Bug
Reply With Quote #21

tl;dr. according to my stats plugin safest ways would be OnClientPostAdminCheck, because its fired when client is fully authorized with its access. OnClientDisconnect is fired for every client when map changes, however player_disconnect event is fired when player really leaves from server. Tested for long time and it worked fine for me.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-31-2014 , 05:51   Re: [CS:GO] Safest Connection Hook? Experiencing Data Loss Bug
Reply With Quote #22

Quote:
Originally Posted by Root_ View Post
tl;dr. according to my stats plugin safest ways would be OnClientPostAdminCheck, because its fired when client is fully authorized with its access. OnClientDisconnect is fired for every client when map changes, however player_disconnect event is fired when player really leaves from server. Tested for long time and it worked fine for me.
You should avoid postadmincheck, because by design it will be delayed (often for a long time by other sql plugins) to authh admins with signal admin check. Authorized is all you need for identifying a player, and it usually fires really early. If you are worried about race conditions, like the player disconnecting before authorized fires, the best way is to just set a boolean once the authed query completes. Alternatively, you can store the client's auth string globally and terminate it they disconnect or au fails by setting it to '/0' this way you know your clients/queries will always succeed.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
aexi0n
AlliedModders Donor
Join Date: Nov 2014
Location: bhop_deluxe
Old 12-31-2014 , 10:30   Re: [CS:GO] Safest Connection Hook? Experiencing Data Loss Bug
Reply With Quote #23

So far I think the change to Auth instead of PostAdmin has prevented the bug I was experiencing previously. Here is my SetLevelTag code, the only thing I can see happening when it's not under PostAdmin is that it's requiring to know if I'm an Admin or not for the Generic_Admin tag.

Code:
public SetLevelTag(client)
{
	decl String:name[MAX_NAME_LENGTH];
	decl String:tag[15];
	
	CS_GetClientClanTag(client, name, sizeof(name));
	
	if(CheckCommandAccess(client, "sm_flag", ADMFLAG_GENERIC, true))
	{
		Format(tag, sizeof(tag), "[Admin | Lv.%d]", Level[client]);
	}
	else if(CheckCommandAccess(client, "sm_flag", ADMFLAG_CUSTOM2, true))
	{
		Format(tag, sizeof(tag), "★ [Lv.%d]", Level[client]);
	}
	else
	{
		Format(tag, sizeof(tag), "[Lv.%d]", Level[client]);
	}
	
	if (StrContains(name, tag) == -1)
	{
		CS_SetClientClanTag(client, tag);
	}
}
aexi0n is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-31-2014 , 10:52   Re: [CS:GO] Safest Connection Hook? Experiencing Data Loss Bug
Reply With Quote #24

SO call your tag thingy twice, since it requires query + admin. Make a function check that both have completed:
Usually I just bit shift in something like so:
#defing FLAG_QUERY_COMPLETE (1<<0)
#define FLAG_ADMIN_COMPLETE (1<<1)

then do
if(flags & FLAG_QUERY_COMPLETE && flags & FLAG_ADMIN_COMPLETE)
{

}

This way you can safely avoid race conditions without further delaying your queries.
This whole problem can be avoided by simply not using plugins that mess with the admin check. Unfortunately the sourcebans team refuses to do proper flatfile caching, and sql_admins also adds delays...
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 12-31-2014 at 10:54.
friagram is offline
Reply


Thread Tools
Display Modes

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 23:38.


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