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

Solved Ban players if disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-10-2015 , 12:12   Re: Ban if no return in 5 minutes.
Reply With Quote #151

So if they get kicked you expect them to reconnect? Lol.

I made it so anything but drop is excluded
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-10-2015 , 12:19   Re: Ban if no return in 5 minutes.
Reply With Quote #152

Oj haha. Didnt think about what i wrote.

But we say if i dont want this function i just dont install DR or what?
Cause i thinking right now people can cheat with this like turn off their PC and then get time out and skip the ban you know.

But i will still use this version cause it has reservation slots function.

I will comeback with a review later when i can test this latest version.

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

You do not have to use the disconnect reason part, I included instructions for how to disable that piece.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-11-2015 , 19:08   Re: Ban if no return in 5 minutes.
Reply With Quote #154

How does the reservation slots work?

Cause i have tested it with few people and it doesnt seem to work.
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-11-2015 , 19:13   Re: Ban if no return in 5 minutes.
Reply With Quote #155

It updates the cvar amx_reservation to match the number of players who have disconnected for less than reconnectmins.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 12-11-2015 , 19:24   Re: Ban if no return in 5 minutes.
Reply With Quote #156

Have you tested it yourself somehow?
I will check more but it doesnt seem to work for me.

Coming with more updates in somedays!
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-11-2015 , 19:27   Re: Ban if no return in 5 minutes.
Reply With Quote #157

We need to research how the AMX-X reservation system works to see if it allows real-time updating of slots. I just looked at it and it appears using sv_visiblemaxplayers should do the trick. It appears to work as I changed the cvar with the cvar running and the value changes in my CS server list when I modify the value in HLDS. I also set it to 1 with a bot on my server and it wouldn't let me connect. Try the updated code.
__________________

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

Im just writing so i can remember which version actually worked.
I have tested all and this is the only one which worked for me.
Amxx beta 1.8.3

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" "60" );
    
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 ) , "^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 ) );
}

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
4ever16
Veteran Member
Join Date: Apr 2015
Old 01-15-2017 , 18:35   Re: Ban if no return in 5 minutes.
Reply With Quote #159

Bugsy i have analized the plugin for a long time and started using it again it working good. The last code i posted atleast.

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.

Last edited by 4ever16; 01-15-2017 at 19:45.
4ever16 is offline
Hectik17
AlliedModders Donor
Join Date: Oct 2005
Old 03-24-2017 , 21:36   Re: Ban players
Reply With Quote #160

Those extra fetures would be a great adition. If anyone could implement them!! Thanks
Hectik17 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 00:25.


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