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

Solved Ban players if disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-05-2015 , 05:24   Ban players if disconnect
Reply With Quote #1

So im searching for a plugin which bans people for disconnecting but they have 5 minutes to return.
If they return in 5 minutes no ban, if they return after 5 minutes ban!

If mapchange was made within those five minutes, ban!

Simple cvars.

Ban_leavers 1
Ban_time 60
No_ban_return_time 5

It would also be cool if when a player disconnects a message is shown, player 1 left - he got 5 minutes to return of he will be banned for 60 minutes.

Last edited by 4ever16; 06-05-2019 at 07:41.
4ever16 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 07-05-2015 , 12:23   Re: Ban if no return in 5 minutes.
Reply With Quote #2

Damn! Bugsy was helping you in your other thread, there's no reason to start a new one.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-05-2015 , 14:03   Re: Ban if no return in 5 minutes.
Reply With Quote #3

Not thoroughly tested. Use the attached CellTravTrie include as the original one has a warning when compiled due to the author not tagging a variable as a bool in TravTrieGetArrayEx().

Edit: Removed disconnect reason code.
PHP Code:
#include <amxmodx>
#include <engine>
#include <celltravtrie>

new const Version[] = "0.3";

const 
Float:EntityTimerInterval 10.0

enum _:PlayerData
{
    
AuthID34 ],
    
DisconnectTime
}

new 
TravTrie:ttTrie g_pdDataMAX_PLAYERS ][ PlayerData ];
new 
g_Entity g_pBanLeavers g_pReconnectMinutes g_pBanMinutes;

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_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() + EntityTimerInterval ) );
    
    
ttTrie TravTrieCreate();
}

public 
plugin_end()
{
    
call_thinkg_Entity );
    
TravTrieDestroyttTrie );
}

public 
client_authorizedid )
{
    new 
pdDataPlayerData ] , iTrieKey szKickMessage60 ] , iReconnectMinutes;

    
get_user_authidid g_pdDataid ][ AuthID ] , charsmaxg_pdData[][ AuthID ] ) );

    
iTrieKey str_to_numg_pdDataid ][ AuthID ][ 10 ] );
    
    if ( 
TravTrieGetArrayExttTrie iTrieKey pdData sizeofpdData ) ) && pdDataDisconnectTime ] )
    {
        
iReconnectMinutes get_pcvar_numg_pReconnectMinutes );
        
        if ( 
get_pcvar_numg_pBanLeavers ) && ( ( get_systime() - pdDataDisconnectTime ] ) > ( iReconnectMinutes 60 ) ) )
        {
            
formatexszKickMessage charsmaxszKickMessage ) , "^nYou have been banned for %d minutes for not re-joining within %d minutes" get_pcvar_numg_pBanMinutes ) , iReconnectMinutes );     
            
message_beginMSG_ONE , {0,0,0} , id );     
            
write_stringszKickMessage );     
            
message_end();    
    
            
BanPlayerpdDataAuthID ] );
            
            
TravTrieDeleteKeyExttTrie iTrieKey );
        }
        else
        {
            
pdDataDisconnectTime ] = 0;
            
TravTrieSetArrayExttTrie iTrieKey pdData sizeofpdData ) );
        }
    }
}

public 
client_disconnectid )
{
    new 
szName33 ];
    
    if (!( 
get_user_flagsid ) & ADMIN_IMMUNITY ) )
    {
        
get_user_nameid szName charsmaxszName ) );
        
client_printprint_chat "* %s left - he has %d minutes to return or he will be banned for %d minutes." szName get_pcvar_numg_pReconnectMinutes ) , get_pcvar_numg_pBanMinutes ) );
        
        
g_pdDataid ][ DisconnectTime ] = get_systime();
        
TravTrieSetArrayExttTrie str_to_numg_pdDataid ][ AuthID ][ 10 ] ) , g_pdDataid ] , sizeofg_pdData[] ) );
    }
}

public 
EntityThinkiEntity )
{
    if( ( 
iEntity == g_Entity ) && get_pcvar_numg_pBanLeavers ) ) 
    {
        new 
travTrieIter:ttIterator pdDataPlayerData ] , iTimeLeft iReconnectMinutes iSysTime;
        
        
ttIterator GetTravTrieIteratorttTrie );
        
iTimeLeft get_timeleft();
        
iSysTime get_systime();
        
iReconnectMinutes get_pcvar_numg_pReconnectMinutes );
        
        while ( 
MoreTravTriettIterator ) )
        {
            
ReadTravTrieArrayttIterator pdData sizeofpdData ) );
            
            if ( ( 
iTimeLeft 30 ) || ( iSysTime pdDataDisconnectTime ] ) > ( iReconnectMinutes 60 ) )
            {
                
BanPlayerpdDataAuthID ] );
                
TravTrieDeleteKeyExttTrie str_to_numpdDataAuthID ][ 10 ] ) );
            }
        }
        
        
DestroyTravTrieIteratorttIterator );
        
        
entity_set_floatg_Entity EV_FL_nextthink , ( get_gametime() + EntityTimerInterval ) );
    }
}
 
public 
BanPlayer( const szAuthID[] )
{
     
server_cmd"banid %d %s" get_pcvar_numg_pBanMinutes ) , szAuthID );

Attached Files
File Type: inc celltravtrie.inc (9.2 KB, 229 views)
__________________

Last edited by Bugsy; 07-11-2015 at 08:55.
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-05-2015 , 21:31   Re: Ban if no return in 5 minutes.
Reply With Quote #4

Looks grate, want to test it but cant compile. Yes i downloaded celltravtrie.inc and placed it in include folder.

Quote:
Error: 017 undifiend symbol ´MAX PLAYERS´

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

You're not using the latest AMX-X dev build. Add this:
PHP Code:
const MAX_PLAYERS 32
__________________

Last edited by Bugsy; 07-06-2015 at 19:12.
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-06-2015 , 08:46   Re: Ban if no return in 5 minutes.
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
You're not using the latest AMX-X build. Add this:
PHP Code:
const MAX_PLAYERS 32
You mean he is not using the beta AMX Mod X build.
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-06-2015 , 08:56   Re: Ban if no return in 5 minutes.
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
You mean he is not using the beta AMX Mod X build.
You mean he is not using the latest beta AMX Mod X build.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-06-2015 , 13:00   Re: Ban if no return in 5 minutes.
Reply With Quote #8

Well i downloaded lastest beta AMXX the compile went good.
But i cant install latest beta on the server. Using 1.8.2 now.

When i write in commands amx_plugins ban_leave.amxx it ses error bad load, is it cause the server doesnt have latest beta amxx?

Will this help me to run the plugin on amxx 1.8.2?

Quote:
const MAX_PLAYERS = 32;
If yes where do i put this line?
4ever16 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-06-2015 , 13:05   Re: Ban if no return in 5 minutes.
Reply With Quote #9

I added the line to the above code, try it.
__________________
Bugsy is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-06-2015 , 16:15   Re: Ban if no return in 5 minutes.
Reply With Quote #10

Error, now i cant even compile when u added those lines.

http://s15.************/9ro4we8bt/2222.png
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 13:35.


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