Raised This Month: $240 Target: $400
 60% 

client_disconnected and client_authorized problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Senior Member
Join Date: Nov 2020
Old 11-07-2021 , 14:55   client_disconnected and client_authorized problem.
Reply With Quote #1

Hello. For some reason, i have a problem with my server.

If a player disconnect, the native client_disconnected is called 2 times. Same for client_authorized.

What can cause this thing ?
lexzor is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Location: Tunisia
Old 11-07-2021 , 15:36   Re: client_disconnected and client_authorized problem.
Reply With Quote #2

Show your code.
__________________
JusTGo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-07-2021 , 17:34   Re: client_disconnected and client_authorized problem.
Reply With Quote #3

Running 2 instances of the same plugin?
__________________
Bugsy is offline
lexzor
Senior Member
Join Date: Nov 2020
Old 11-08-2021 , 12:35   Re: client_disconnected and client_authorized problem.
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
Running 2 instances of the same plugin?
nop..

this is disconnected function

PHP Code:
#if AMXX_VERSION_NUM < 183
    
public client_disconnect(id)
#else 
    
public client_disconnected(id)
#endif
{
    if(
g_PlayerData[id][ISBOT] == )
        return 
PLUGIN_HANDLED;

    
save_data(id);
    
    return 
PLUGIN_CONTINUE;
}

public 
save_data(id)
{    
    new 
szQuery[512];

    
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `last_visit` = '%i' , `points` = '%i'  WHERE `steamid` = '%s'",
    
g_szTableget_systime(), g_PlayerData[id][CASH], g_PlayerData[id][STEAMID]);
    
SQL_ThreadQuery(g_SqlTuple"FreeHandle"szQuery);

actually, sometimes g_PlayerData[id][CASH] = 0 even if player made some points.


PHP Code:
public client_authorized(id)
{
    if(
is_user_bot(id) || is_user_hltv(id))
    {
        
g_PlayerData[id][ISBOT] = 1;

        return 
PLUGIN_HANDLED;
    }

    
get_user_authid(idg_PlayerData[id][STEAMID], charsmax(g_PlayerData[][STEAMID]));
    
get_user_name(idg_PlayerData[id][NAME], charsmax(g_PlayerData[][NAME]));
    
get_user_ip(idg_PlayerData[id][IP], charsmax(g_PlayerData[][IP]), 1);

    
mysql_escape_string(g_PlayerData[id][NAME], charsmax(g_PlayerData[][NAME]));

    
g_PlayerData[id][DONATE] = 0;
    
g_PlayerData[id][ID] = id;
    
g_PlayerData[id][CASH] = 0;
    
g_PlayerData[id][CHAT] = 1;
    
g_PlayerData[id][LASTVISIT] = 0;
    
g_PlayerData[id][DAILYBONUS] = 0;
    
g_PlayerData[id][VIPSTEAM] = 0;
    
g_PlayerData[id][VIP] = 0;
    
g_PlayerData[id][VIPRESET] = 0;
    
g_PlayerData[id][TOKENS] = 0;

    
get_data(id);

    
set_task(float(HELLO_TIME), "hello_user"id HelloTask);

    return 
PLUGIN_CONTINUE;

at client_authorized, sometimes function hello_user is called 2 times and i call only one time in this plugin.

i think is a engine problem.
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-08-2021 , 17:11   Re: client_disconnected and client_authorized problem.
Reply With Quote #5

Shouldn't happen, but would need to see full code.

If you don't want to post it(for whatever reason), you can do this:
PHP Code:
if ( !task_existsid HelloTask ) )
     
set_task(float(HELLO_TIME), "hello_user"id HelloTask); 
__________________
Bugsy is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 11-15-2021 , 04:02   Re: client_disconnected and client_authorized problem.
Reply With Quote #6

Are you sure disconnected is called two times?
Put a log_to_file and test.

I think the problem is when you load data
baneado 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:56.


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