View Single Post
lexzor
Veteran 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