Raised This Month: $51 Target: $400
 12% 

Solved Ban players if disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 12-08-2015 , 20:44   Re: Ban if no return in 5 minutes.
Reply With Quote #141

works fine thnx
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-08-2015 , 21:09   Re: Ban if no return in 5 minutes.
Reply With Quote #142

I know it works..but I'm explaining what happens if you have multiple flags in cvar binr_immunityflags. It will give immunity if they have one or multiple of the flags.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-09-2015 , 07:14   Re: Ban if no return in 5 minutes.
Reply With Quote #143

Ne that question u asked about immunity isnt needed not by me atleast.

This is not request but do you think its possible to make so the disconnected player reserves a slot?
Like only he can join the server within those X reconnect minutes after that anyone can join?

Last edited by 4ever16; 12-09-2015 at 07:17.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-09-2015 , 08:33   Re: Ban if no return in 5 minutes.
Reply With Quote #144

Should be doable. It would just need to update the # of reserved slots to match the number of players who the plugin is waiting to reconnect.

I am also going to make some performance enhancements with the slots reservation piece.

Is this type of plugin used by a lot of people?
__________________

Last edited by Bugsy; 12-09-2015 at 13:14.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-09-2015 , 15:28   Re: Ban if no return in 5 minutes.
Reply With Quote #145

Well you know 1.6 is ''dead''.
But the best mix servers aka match servers has this cind of plugin and they kept it and are keeping it for them selfs i asked them couple of times to share the source code. But they jsut didnt wanted to be copied.

This is because they are ''quality'' servers or communities and want a ''quality'' server.
This is why i also wanted this plugin to make a ''quality'' server.

This is not for public play so the answer to your question is no i dont think so.

And also one more request - can it not ban time out players like internet lagged out pc crashed.
Only those who disconnect. Clicked disconnect or wrote quit or disconnect in console.

Cause i had some complains about people getting banned cause their internet died.

Its not so important but gr8t if it would exist.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-09-2015 , 16:33   Re: Ban if no return in 5 minutes.
Reply With Quote #146

Yes, this actually existed in the past using my disconnect reason plugin, which requires orpheu. IIRC, you asked for it to be removed. I can easily incorporate that again.

Take a look at post 35-36
__________________

Last edited by Bugsy; 12-09-2015 at 16:52.
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-09-2015 , 20:14   Re: Ban if no return in 5 minutes.
Reply With Quote #147

Changes:
  • Added slot reservation for players who disconnected. The servers reserved slots are set equal to the number of players in the queue. Each slot reservation will last for binr_reconnectmin minutes.
  • Added disconnect reason checking to exclude players who did not disconnect by choice (time out, etc)
  • Performance enhancement to make the entity think only when there are players in the queue.
The plugin now has 2 1 dependencies. I added checking for these which will make the plugin fail if they are missing. You can easily disable to disconnect reason checking if you want.
  • Disconnect Reason plugin, which requires you have the Orpheu module installed.
  • AMX-X native admin slot reservation plugin (adminslots.amxx). This I believe is enabled by default in plugins.ini.
PHP Code:

#include <amxmodx>
#include <engine>
#include <nvault_util>

new const Version[] = "1.4";

#define MAX_PLAYERS 32

//**************************************************************************************************
//* Exclude players who disconnected for any reason other than clicking Disconnect.             *                                            *
//*                                                   *
//* This functionality requires that you have the Disconnect Reason plugin running, which requires *
//* the orpheu module. https://forums.alliedmods.net/showthread.php?t=166239               *
//**************************************************************************************************
//* If you do not want to use this functionality, comment out the below #define line               *
//**************************************************************************************************
#define EXCLUDE_TIMEOUT_DISCONNECT

#if defined EXCLUDE_TIMEOUT_DISCONNECT
enum ReasonCodes
{
    
DR_TIMEDOUT,
    
DR_DROPPED,
    
DR_KICKED,
    
DR_LEVELCHANGE,
    
DR_OTHER
}
#endif

const BanQueueSize 30;
const 
Float:EntityInterval 1.0;
const 
MinuteSeconds 60;

enum PlayerData
{
    
pdAuthID34 ],
    
pdDisconnectTime,
}

new 
g_pdDataMAX_PLAYERS ][ PlayerData ] , g_BanQueueBanQueueSize ][ PlayerData ];
new 
g_IgnorePlayers g_HasAuthorized g_PlayersInQueue g_Entity g_Vault g_MaxPlayers;
new 
g_pBanLeavers g_pReconnectMinutes g_pBanMinutes g_pImmunityFlags g_pReservedSlots;

public 
plugin_init() 
{
    
register_plugin"Ban If No Return" Version "bugsy" );
    
    
g_pBanLeavers register_cvar"binr_enabled" "1" );
    
g_pReconnectMinutes register_cvar"binr_reconnectmin" "5" );
    
g_pBanMinutes register_cvar"binr_banmins" "60" );
    
g_pImmunityFlags register_cvar"binr_immunityflags" "a" );
    
g_pReservedSlots get_cvar_pointer"sv_visiblemaxplayers" );
    
    
g_Entity create_entity"info_target" );
    
entity_set_stringg_Entity EV_SZ_classname "binr_entity" );
    
register_think"binr_entity" "EntityThink" );

    
g_MaxPlayers get_maxplayers();
    
    
#if defined EXCLUDE_TIMEOUT_DISCONNECT
    
if ( is_plugin_loaded"Disconnect Reason" ) == INVALID_HANDLE )
        
set_fail_state"Disconnect Reason plugin must be running!" );
    
#endif
        
}

public 
plugin_cfg()
{
    
LoadQueue();
    
    if ( 
g_PlayersInQueue )
    {
        
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) );
        
set_pcvar_numg_pReservedSlots g_MaxPlayers g_PlayersInQueue );
    }
    
    
g_Vault nvault_open"ban_if_no_return" );
    
nvault_pruneg_Vault get_systime() );
}

public 
plugin_end()
{
    
SaveQueue();
    
    
call_thinkg_Entity );
    
nvault_closeg_Vault );
}

public 
client_authorizedid 
{
    new 
iTimeStamp szKickMessage96 ] , szFlags26 ];
    
    
get_pcvar_stringg_pImmunityFlags szFlags charsmaxszFlags ) );
    
g_IgnorePlayers |= ( is_user_botid ) || is_user_hltvid )  || ( get_user_flagsid ) & read_flagsszFlags ) ) ? ) << ( id 31 ) ;
    
    if ( !( 
g_IgnorePlayers & ( << ( id 31 ) ) ) )
    {
        
get_user_authidid g_pdDataid ][ pdAuthID ] , charsmaxg_pdData[][ pdAuthID ] ) );
        
        if ( 
nvault_lookupg_Vault g_pdDataid ][ pdAuthID ] , "" iTimeStamp ) )
        {
            if ( 
iTimeStamp get_systime() )
            {
                
formatexszKickMessage charsmaxszKickMessage ) , "^nYou have been banned for %d minutes for not re-joining within %d minutes." get_pcvar_numg_pBanMinutes ) , get_pcvar_numg_pReconnectMinutes ) );   
                
message_beginMSG_ONE , {0,0,0} , id );     
                
write_stringszKickMessage );     
                
message_end(); 
            }
            else
            {
                
nvault_removeg_Vault g_pdDataid ][ pdAuthID ] );
            }
        }
        else
        {
            
RemoveFromBanQueueid );
        }
    }
    
    
g_HasAuthorized |= ( << ( id 31 ) );
}

#if defined EXCLUDE_TIMEOUT_DISCONNECT
public client_disconnect_reasonid ReasonCodes:drReason , const szReason[] )
{
    if ( 
drReason != DR_DROPPED )    
    {
        
g_IgnorePlayers &= ~( << ( id 31 ) );
        
g_HasAuthorized &= ~( << ( id 31 ) );
        
        return;
    }
#else
public client_disconnectid )
{
#endif

    
if (!( g_IgnorePlayers & ( << ( id 31 ) ) ) && ( g_HasAuthorized & ( << ( id 31 ) ) ) && get_pcvar_numg_pBanLeavers ) )
    {
        if ( !
AddToBanQueueid ) )
            
set_fail_state"Ban If No Return: Need to increase queue size." );
    }
        
    
g_IgnorePlayers &= ~( << ( id 31 ) );
    
g_HasAuthorized &= ~( << ( id 31 ) );
}

public 
EntityThinkiEntity )
{
    if( 
iEntity == g_Entity 
    {
        
SetBansInQueue();
        
        if ( 
g_PlayersInQueue )
            
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) );
    }
}

bool:AddToBanQueueid DisconnectTime=)
{
    new 
bool:bSuccess;
    
    for (new 
iSlot iSlot BanQueueSize iSlot++ )
    {
        if ( 
g_BanQueueiSlot ][ pdAuthID ][ ] == EOS )
        {
            
copyg_BanQueueiSlot ][ pdAuthID ] , charsmaxg_BanQueue[][ pdAuthID ] ) , g_pdDataid ][ pdAuthID ] );
            
g_BanQueueiSlot ][ pdDisconnectTime ] = DisconnectTime DisconnectTime get_systime();
            
bSuccess true;
            
            if ( !
g_PlayersInQueue++ )
                
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) );
            
            if ( !
DisconnectTime )
                
set_pcvar_numg_pReservedSlots g_MaxPlayers g_PlayersInQueue );
            
            break;
        }
    }
    
    return 
bSuccess;
}

RemoveFromBanQueueid )
{
    for ( new 
iSlot iSlot BanQueueSize iSlot++ )
    {
        if ( 
equalg_BanQueueiSlot ][ pdAuthID ] , g_pdDataid ][ pdAuthID ] ) )
        {
            
g_BanQueueiSlot ][ pdAuthID ][ ] = EOS;
            
g_BanQueueiSlot ][ pdDisconnectTime ] = 0;
            
            
g_PlayersInQueue--;
            
set_pcvar_numg_pReservedSlots g_MaxPlayers g_PlayersInQueue );
            
            break;
        }
    }
}

SetBansInQueue()
{
    new 
iBanTime;
    
    for ( new 
iSlot iSlot BanQueueSize iSlot++ )
    {
        if ( 
g_BanQueueiSlot ][ pdAuthID ][ ] )
        {
            if ( ( 
get_systime() - g_BanQueueiSlot ][ pdDisconnectTime ] ) >= ( get_pcvar_numg_pReconnectMinutes ) * MinuteSeconds ) )
            {
                
nvault_setg_Vault g_BanQueueiSlot ][ pdAuthID ] , "1" );
                
nvault_touchg_Vault g_BanQueueiSlot ][ pdAuthID ] , ( iBanTime get_pcvar_numg_pBanMinutes ) ) == get_systime() +  ( iBanTime MinuteSeconds ) );
                
                
g_PlayersInQueue--;
                
set_pcvar_numg_pReservedSlots g_MaxPlayers g_PlayersInQueue  );
                
                
g_BanQueueiSlot ][ pdAuthID ][ ] = EOS;
                
g_BanQueueiSlot ][ pdDisconnectTime ] = 0;
            }
        }
    }
}

LoadQueue()
{
    new 
iVault pData_:PlayerData ] , iPos iCount iItems iTimeStamp szKey];
    
    if ( ( 
iVault nvault_util_open"ban_if_no_return" ) ) )
    {
        
iCount nvault_util_countiVault );
        
        for ( new 
iEntry iEntry iCount iEntry++ )
        {
            
iPos nvault_util_read_arrayiVault iPos szKey charsmaxszKey ) , pData sizeofpData ) , iItems iTimeStamp );
            
            if ( 
equalszKey "BanQueue" ) )
            {
                
copyg_pdData][ pdAuthID ] , sizeofg_pdData[][ pdAuthID ] ) , pData_:pdAuthID ] );
                
g_pdData][ pdDisconnectTime ] = pData_:pdDisconnectTime ];
                
AddToBanQueueg_pdData][ pdDisconnectTime ] );
            }
        }
    }
}

SaveQueue()
{
    new 
szKey12 ] , iSlotIndex pData_:PlayerData ];
    
    
copyszKey charsmaxszKey ) , "BanQueue" );
    
    for ( new 
iSlot iSlot BanQueueSize iSlot++ )
    {
        if ( 
g_BanQueueiSlot ][ pdDisconnectTime ] )
        {
            
copypData_:pdAuthID ] , charsmaxpDatapdAuthID ] ) , g_BanQueueiSlot ][ pdAuthID ] );
            
pData_:pdDisconnectTime ] = g_BanQueueiSlot ][ pdDisconnectTime ];
            
            
num_to_striSlotIndex++ , szKey] , charsmaxszKey ) - );
            
nvault_set_arrayg_Vault szKey pData sizeofpData ) );
            
nvault_touchg_Vault szKey );
        }
    }

__________________

Last edited by Bugsy; 12-11-2015 at 19:54.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-10-2015 , 11:58   Re: Ban if no return in 5 minutes.
Reply With Quote #148

Wow thanks! Super gr8t.

Question, DR_DROPPED
What does it stand for?
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-10-2015 , 12:00   Re: Ban if no return in 5 minutes.
Reply With Quote #149

DR = Disconnect Reason
DROPPED = Client clicked Disconnect
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-10-2015 , 12:08   Re: Ban if no return in 5 minutes.
Reply With Quote #150

So what reasons does the players doesnt get banned for? Cause i see.

DR_TIMEDOUT,
DR_DROPPED,
DR_KICKED,
DR_LEVELCHANGE,
DR_OTHER


It was only timeout that was needed.
4ever16 is offline
Reply



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 04:27.


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