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

Solved Ban players if disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-01-2019 , 04:16   Re: Ban if no return in 5 minutes.
Reply With Quote #161

Bugsy or someone else can you add some of the futures i requested?

Quote:
Originally Posted by 4ever16 View Post
Bugsy i have analized the plugin for a long time and started using it again it working good.

But i have a small problem.
When people have auto join function and like 3 people try to connect then 1 get succesfully connected and the other ones tries to connect but it says server full.
For those 2 connection is counted and they get banned for no reason. Just cause they allmost connected but got ''SERVER FULL'' message. You know like who has the fastest internet get the lucky one but those other ones still tries to connect and are counted as if they were connected. I hop you understand what i mean.

Only dead and alive players should be counted.
Or like you need to be connected atleast x minutes for the plugin to count you.
I think the last idea is better x minutes to be counted as connected its seems more safe proof.

And if possible without using other plugins. Cause i like stuff clean all in one.

Also if its possible without other plugins...
Can you add like timeleft for ban in ban reason?
Cause when people try reconnect it allways say like banned 4 days.
So if i try to join 2 days later it still says banned 4 days but it actually 2 days left for ban to expire.
Not a biggy but so that players knows exactly how much time its left, cause avarage human brain IQ is very low.
Its minutes not days i wrote an example only.
But if this needs another plugin then no its not needed then.

This version.
PHP Code:
#include <amxmodx> 
#include <engine> 
#include <nvault_util> 

new const Version[] = "1.2"

#define MAX_PLAYERS 32 

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_Entity g_Vault
new 
g_pBanLeavers g_pReconnectMinutes g_pBanMinutes g_pImmunityFlags

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" "8500" ); 
    
g_pImmunityFlags register_cvar"binr_immunityflags" "a" ); 
     
    
LoadQueue(); 
     
    
g_Vault nvault_open"ban_if_no_return" ); 
    
nvault_pruneg_Vault get_systime() ); 
     
    
g_Entity create_entity"info_target" ); 
    
entity_set_stringg_Entity EV_SZ_classname "binr_entity" ); 
    
register_think"binr_entity" "EntityThink" ); 
    
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) ); 


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 ) , "^nBanned 7 days. YOU LEFT LIVE MIX." );    
                
message_beginMSG_ONE , {0,0,0} , id );      
                
write_stringszKickMessage );      
                
message_end();  
            } 
            else 
            { 
                
nvault_removeg_Vault g_pdDataid ][ pdAuthID ] ); 
            } 
        } 
        else 
        { 
            
RemoveFromBanQueueid ); 
        } 
    } 
     
    
g_HasAuthorized |= ( << ( id 31 ) ); 


public 
client_disconnectid )  

    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();                         
        
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) ); 
    } 


bool:AddToBanQueueid DisconnectTime=

    new 
bool:bSuccess
     
    for (new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
g_BanQueueiFindSlot ][ pdAuthID ][ ] == EOS 
        { 
            
copyg_BanQueueiFindSlot ][ pdAuthID ] , charsmaxg_BanQueue[][ pdAuthID ] ) , g_pdDataid ][ pdAuthID ] ); 
            
g_BanQueueiFindSlot ][ pdDisconnectTime ] = DisconnectTime DisconnectTime get_systime(); 
            
bSuccess true
            break; 
        } 
    } 
     
    return 
bSuccess


RemoveFromBanQueueid 

    for ( new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
equalg_BanQueueiFindSlot ][ pdAuthID ] , g_pdDataid ][ pdAuthID ] ) ) 
        { 
            
g_BanQueueiFindSlot ][ pdAuthID ][ ] = EOS
            
g_BanQueueiFindSlot ][ pdDisconnectTime ] = 0
            break; 
        } 
    } 


SetBansInQueue() 

    new 
iBanTime
     
    for ( new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
g_BanQueueiFindSlot ][ pdAuthID ][ ] ) 
        { 
            if ( ( 
get_systime() - g_BanQueueiFindSlot ][ pdDisconnectTime ] ) >= ( get_pcvar_numg_pReconnectMinutes ) * MinuteSeconds ) ) 
            { 
                
nvault_setg_Vault g_BanQueueiFindSlot ][ pdAuthID ] , "1" ); 
                
nvault_touchg_Vault g_BanQueueiFindSlot ][ pdAuthID ] , ( iBanTime get_pcvar_numg_pBanMinutes ) ) == get_systime() +  ( iBanTime MinuteSeconds ) ); 

                
g_BanQueueiFindSlot ][ pdAuthID ][ ] = EOS
                
g_BanQueueiFindSlot ][ 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 ); 
        } 
    } 

4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2019 , 17:22   Re: Ban players if disconnect
Reply With Quote #162

Only the bolded items, or everything in your quote?
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-01-2019 , 19:48   Re: Ban players if disconnect
Reply With Quote #163

Quote:
Originally Posted by Bugsy View Post
Only the bolded items, or everything in your quote?
These two but number one is most important.

- You need to be connected atleast x minutes for the plugin to count you. No matter if spec or alive or dead.
- Can you add like timeleft for ban in ban reason?
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2019 , 20:08   Re: Ban players if disconnect
Reply With Quote #164

Untested
PHP Code:

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

new const Version[] = "1.3"

#define MAX_PLAYERS 32 

const BanQueueSize 30
const 
Float:EntityInterval 1.0
const 
MinuteSeconds 60

enum PlayerData 

    
pdAuthID34 ], 
    
pdDisconnectTime
    
pdConnectTime


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

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" "8500" ); 
    
g_pImmunityFlags register_cvar"binr_immunityflags" "a" ); 
    
    
LoadQueue(); 
    
    
g_Vault nvault_open"ban_if_no_return" ); 
    
nvault_pruneg_Vault get_systime() ); 
    
    
g_Entity create_entity"info_target" ); 
    
entity_set_stringg_Entity EV_SZ_classname "binr_entity" ); 
    
register_think"binr_entity" "EntityThink" ); 
    
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) ); 


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 ) , "^nBanned 7 days. YOU LEFT LIVE MIX. Come back in %d minutes" , ( get_systime() - iTimeStamp ) / 60  );    
                
message_beginMSG_ONE , {0,0,0} , id );      
                
write_stringszKickMessage );      
                
message_end();  
            } 
            else 
            { 
                
nvault_removeg_Vault g_pdDataid ][ pdAuthID ] ); 
            } 
        } 
        else 
        { 
            
RemoveFromBanQueueid ); 
        } 
    } 
    
    
g_pdDataid ][ pdConnectTime ] = get_systime();
    
g_HasAuthorized |= ( << ( id 31 ) ); 


public 
client_disconnectid )  

    if ( !( 
g_IgnorePlayers & ( << ( id 31 ) ) ) && ( g_HasAuthorized & ( << ( id 31 ) ) ) && get_pcvar_numg_pBanLeavers ) && ( ( get_systime() - g_pdDataid ][ pdConnectTime ] ) >= 60 ) ) 
    { 
        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();                         
        
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityInterval ) ); 
    } 


bool:AddToBanQueueid DisconnectTime=

    new 
bool:bSuccess
    
    for (new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
g_BanQueueiFindSlot ][ pdAuthID ][ ] == EOS 
        { 
            
copyg_BanQueueiFindSlot ][ pdAuthID ] , charsmaxg_BanQueue[][ pdAuthID ] ) , g_pdDataid ][ pdAuthID ] ); 
            
g_BanQueueiFindSlot ][ pdDisconnectTime ] = DisconnectTime DisconnectTime get_systime(); 
            
bSuccess true
            break; 
        } 
    } 
    
    return 
bSuccess


RemoveFromBanQueueid 

    for ( new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
equalg_BanQueueiFindSlot ][ pdAuthID ] , g_pdDataid ][ pdAuthID ] ) ) 
        { 
            
g_BanQueueiFindSlot ][ pdAuthID ][ ] = EOS
            
g_BanQueueiFindSlot ][ pdDisconnectTime ] = 0
            break; 
        } 
    } 


SetBansInQueue() 

    new 
iBanTime
    
    for ( new 
iFindSlot iFindSlot BanQueueSize iFindSlot++ ) 
    { 
        if ( 
g_BanQueueiFindSlot ][ pdAuthID ][ ] ) 
        { 
            if ( ( 
get_systime() - g_BanQueueiFindSlot ][ pdDisconnectTime ] ) >= ( get_pcvar_numg_pReconnectMinutes ) * MinuteSeconds ) ) 
            { 
                
nvault_setg_Vault g_BanQueueiFindSlot ][ pdAuthID ] , "1" ); 
                
nvault_touchg_Vault g_BanQueueiFindSlot ][ pdAuthID ] , ( iBanTime get_pcvar_numg_pBanMinutes ) ) == get_systime() +  ( iBanTime MinuteSeconds ) ); 
            
                
g_BanQueueiFindSlot ][ pdAuthID ][ ] = EOS
                
g_BanQueueiFindSlot ][ 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 ); 
        } 
    } 

__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-02-2019 , 08:34   Re: Ban players if disconnect
Reply With Quote #165

PHP Code:
nvault_array.inc(42) : error 021symbol already defined"nvault_set_array"
nvault_array.inc(80) : error 021symbol already defined"nvault_get_array"

2 Errors.
Could not locate output file banleavers.amx (compile failed). 
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-02-2019 , 08:57   Re: Ban players if disconnect
Reply With Quote #166

You may be using an old copy of nvault utility. I ended up moving the nvault array functionality out of utility into its own include.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-02-2019 , 09:23   Re: Ban players if disconnect
Reply With Quote #167

Quote:
Originally Posted by Bugsy View Post
You may be using an old copy of nvault utility. I ended up moving the nvault array functionality out of utility into its own include.
The old plugin could be compiled only with AMX Mod X Compiler 1.8.3-dev+5147

What amxx version are you using?
I tested all cind of versions with your latest edit allways problem.

The latest edit can't be compiled i tested all cinds of amxx versions and downloaded nvault_util.inc from https://forums.alliedmods.net/showthread.php?t=139584

Depending on the amxx version i get this problem.


Or this problem.
PHP Code:
nvault_array.inc(42) : error 021symbol already defined"nvault_set_array" 
nvault_array.inc(80) : error 021symbol already defined"nvault_get_array" 

Last edited by 4ever16; 06-02-2019 at 09:26.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-02-2019 , 09:28   Re: Ban players if disconnect
Reply With Quote #168

Quote:
Originally Posted by Bugsy View Post
You may be using an old copy of nvault utility. I ended up moving the nvault array functionality out of utility into its own include.
1. Download nvault utility
2. Download nvault array
__________________

Last edited by Bugsy; 06-02-2019 at 09:29.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-02-2019 , 09:30   Re: Ban players if disconnect
Reply With Quote #169

Quote:
Originally Posted by Bugsy View Post
1. Download nvault utility
2. Download nvault array
Yes now it worked. Testing plugin.
4ever16 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-02-2019 , 10:18   Re: Ban players if disconnect
Reply With Quote #170

Yes it works.
4ever16 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 11:56.


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