rehlds / ReAPI

AMXModX module providing APIs for ReHLDS, ReGameDLL, and Metamod plugins (e.g., ReUnion, ReVoice).
GNU General Public License v3.0
159 stars 105 forks source link

Add rg_client_full_connect #327

Open TheKrytyk opened 2 months ago

TheKrytyk commented 2 months ago

Hello,

At the moment we have 3 events:

a) client_connect b) client_authorized c) client_putinserver

and the problem is reading the values from nvault, when after changing the client_authorized map it is not always able to immediately verify whether, for example, it has flags added by the shop ( not users.ini ). Example:

public client_authorized( id )
{   
    if( get_user_flags( id ) & ADMIN_FLAG_W )
    {
        get_user_name( id, szUserAuthID[ id ], charsmax( szUserAuthID[ ] ) );   
        nvault_settings( id, NVAULT_READ, "client_authorized" );
    }
}

In order to read the values correctly you need to duplicate the code in the client_putinserver, so my suggestion is to add a new event rg_client_full_connect( index ) so that it executes after authorization ( reading the STEAMID ) and connecting the player to the server ( during team selection ).

It is still possible to add a set_task( 1.0, "nvault", id ) in client_authorised, but the player may leave the server. Also, the client_putinserver MAY sometimes execute BEFORE client_authorized ( from my observations and logs, 95% execute AFTER client_authorized, so a forward after the player is fully connected would be useful ).

Would it be possible to add something like this?

NiceFeatures commented 2 months ago

Set a task to a new function and

if(is_user_authorized(index))
{
    code...
}
else
{
 function()
}