View Single Post
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-10-2020 , 20:17   Re: client_disconnected() <-> plugin_end()
Reply With Quote #27

this all was wrong. i mean, i had a problem the new player was getting mysql info from last disconnected player (when server is 32/32 so its always switching players)...my bad is that i thought map_end or smth like that was making a big mess...so fix is:

Code:
//Load_MySql( task )

new Data[ 2 ] 
Data[ 0 ] = id
Data[ 1 ] = get_user_userid( id )
formatex(szTemp,charsmax(szTemp),"SELECT * FROM players WHERE steamid = '%s';", szSteamId) 
	
SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data, sizeof( Data ) ) 

//and then later in register_client:

new id, uid
id = Data[ 0 ]
uid = Data[ 1 ]
	
if( !is_user_connected( id ) || uid != get_user_userid( id ) )
	return PLUGIN_HANDLED	

//and on other ThreadQueries, just to be sure
}
didnt test yet, but i see the logic here

big thanks to lazarev for pointing that out for me
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 04-11-2020 at 08:48.
JocAnis is offline