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

Solved Ban players if disconnect


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

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
 


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 12:26.


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