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

CS 1.6 Ban Ct


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-03-2022 , 22:07   Re: CS 1.6 Ban Ct
Reply With Quote #11

Quote:
Originally Posted by Supremache View Post
MAX_PLAYERS, MAX_AUTHID_LENGTH
try it now
Your plugin still won't work, try testing it yourself and you will know why, i for myself didn't even needed to test it, after a quick code scan i found alot of unreasonable behaviors and mistakes.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-03-2022 at 23:13.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-03-2022 , 22:47   Re: CS 1.6 Ban Ct
Reply With Quote #12

Quote:
Originally Posted by Natsheh View Post
Your plugin still won't work, try testing it yourself and you will know why, i for myself didn't even needed to test it, after a quick code scan i found alot of unreasonable behaviors snd mistakes.
Tested
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 04-03-2022 at 23:30.
Supremache is offline
Shyloo
Member
Join Date: Jan 2022
Old 06-07-2022 , 07:27   Re: CS 1.6 Ban Ct
Reply With Quote #13

Quote:
Originally Posted by Supremache View Post
how !!!, The player already banned how you can find him!

Try this
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #if !defined MAX_AUTHID_LENGTH const MAX_AUTHID_LENGTH = 64 #endif #if !defined MAX_PLAYERS const MAX_PLAYERS = 32 #endif new Array:g_aBanTeam public plugin_init( ) {     register_plugin( "AMX Ban Team", "1.0", "Supremache" )     register_cvar("AMXBanTeam", "1.0", FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )         g_aBanTeam = ArrayCreate( MAX_AUTHID_LENGTH );         register_concmd( "amx_banct", "@BanTeam");     register_concmd( "amx_bant", "@BanTeam" );     register_concmd( "amx_unbanct", "@UnBanTeam" );     register_concmd( "amx_unbant", "@UnBanTeam" ); } public plugin_end( ) {     ArrayDestroy( g_aBanTeam ); } @BanTeam( id ) {     new szCommand[ 10 ], szTeam[ 10 ], szValue[ 3 ], iPlayers[ MAX_PLAYERS ], iPnum;     read_argv( 0, szCommand, charsmax( szCommand ) )     read_argv( 1, szValue, charsmax( szValue ) )     copy( szTeam, charsmax( szTeam ), szCommand[ 7 ] == 'c' ? "CT" : "TERRORIST" )         get_players( iPlayers, iPnum, "e", szTeam )             for( new i, iPlayer; i < iPnum; i++ )     {         iPlayer = iPlayers[ i ];         client_cmd( id, "amx_ban ^"#%d^" ^"%i^"", get_user_userid( iPlayer ), str_to_num( szValue ) )         ReadFile( iPlayer, szTeam, 1 )         client_print( id, print_chat, "banned" )     }         return PLUGIN_HANDLED; } @UnBanTeam( id ) {         static szSteamID[ MAX_AUTHID_LENGTH ], szCommand[ 10 ], szTeam[ 10 ];     read_argv( 0, szCommand, charsmax( szCommand ) )     copy( szTeam, charsmax( szTeam ), szCommand[ 9 ] == 'c' ? "CT" : "TERRORIST" )         ReadFile( 0, szTeam )         for( new i; i < ArraySize( g_aBanTeam ); i++ )     {         ArrayGetString( g_aBanTeam, i, szSteamID, charsmax( szSteamID ) );                 client_cmd( id, "amx_unban ^"%s^"", szSteamID )         ReadFile( 0, szTeam, 2 )         client_print( id, print_chat, "unbanned" )     }         return PLUGIN_HANDLED; } ReadFile( id = -1, const szTeam[ ] = "", iType = 0) {     new szConfigs[ 64 ], szFile[ 96 ], szData[ MAX_AUTHID_LENGTH ], iFile;     get_configsdir( szConfigs, charsmax( szConfigs ) )     formatex( szFile, charsmax( szFile ), "%s/BanList_%s.ini", szConfigs, szTeam )         switch( iType )     {         case 0:         {             iFile = fopen( szFile, "rt" );                 if( iFile )             {                 while( fgets( iFile, szData, charsmax( szData ) ) )                 {                        trim( szData );                                      switch( szData[ 0 ] )                     {                         case EOS, ';', '#', '/': continue;                         default: ArrayPushString( g_aBanTeam, szData );                     }                 }                 fclose( iFile );             }         }                 case 1:         {             iFile = fopen( szFile, "wt")                     if( iFile && pev_valid( id ) )             {                       get_user_authid( id, szData, charsmax( szData ) )                 fprintf( iFile, "%s^n", szData )                 fclose( iFile );             }         }         case 2: delete_file( szConfigs );     } }

When i joined the Terrorist team i tryed the command "amx_bant" it banned me from the whole server not from the T team
Shyloo is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-07-2022 , 10:13   Re: CS 1.6 Ban Ct
Reply With Quote #14

Quote:
Originally Posted by Shyloo View Post
When i joined the Terrorist team i tryed the command "amx_bant" it banned me from the whole server not from the T team
Hmmm, what are you talking about, ban means "ban the player from the server (so the player can't join the server again until his time get expired )", do you mean to prevent the player from switching to a T team?
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Shyloo
Member
Join Date: Jan 2022
Old 06-09-2022 , 09:27   Re: CS 1.6 Ban Ct
Reply With Quote #15

Quote:
Originally Posted by Supremache View Post
Hmmm, what are you talking about, ban means "ban the player from the server (so the player can't join the server again until his time get expired )", do you mean to prevent the player from switching to a T team?
Yes , if i write amx_bant "Shyloo" , it just ban me from the T team so the oly choise i can do is to join the CT team or the SPEC team until the ban expires so i can join the T team again.
Shyloo is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-09-2022 , 12:41   Re: CS 1.6 Ban Ct
Reply With Quote #16

I got it
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-09-2022 , 14:20   Re: CS 1.6 Ban Ct
Reply With Quote #17

Quote:
Originally Posted by Supremache View Post
I got it
I had a problem when I tried to hook change team menu, so I will share the main code until I find the solution for the problem

How this work:
amx_banct "Value" // this gonna ban all ct players
amx_banct "Player" "Value" // this gonna ban the chosen player
etc..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32
#endif

#if !defined MAX_AUTHID_LENGTH
    
const MAX_AUTHID_LENGTH 64
#endif

new Trie:g_tBanTeam
const TASK_TEAM_JOIN 115514;
const 
iDateSeconds 60/* Minute = 60 , Hour = 3600 , Day = 86400 */
new g_szSteamIDMAX_PLAYERS ][ MAX_AUTHID_LENGTH ];

public 
plugin_init( ) 
{
    
register_plugin"AMX Ban Team""1.0""Supremache" )
    
register_cvar("AMXBanTeam""1.0"FCVAR_SERVER FCVAR_SPONLY FCVAR_UNLOGGED )
    
    
g_tBanTeam TrieCreate( );
    
    
register_concmd"amx_banct""@BanTeam");
    
register_concmd"amx_bant""@BanTeam" );
    
register_concmd"amx_unbanct""@UnBanTeam" );
    
register_concmd"amx_unbant""@UnBanTeam" );
}

public 
client_connectid )
{
    
get_user_authididg_szSteamIDid ], charsmaxg_szSteamID[ ] ) )
}

@
BanTeamid )
{
    new 
szCommand10 ], szTeam10 ], szPlayer32 ], szValue], iPlayersMAX_PLAYERS ], iPnum;
    
read_argv0szCommandcharsmaxszCommand ) )
    
read_argv1szPlayercharsmaxszPlayer ) )
    
copyszTeamcharsmaxszTeam ), szCommand] == 'c' "CT" "TERRORIST" )
    
    new 
iPlayer cmd_targetidszPlayerCMDTARGET_ALLOW_SELF )
    
    if( ! 
iPlayer )
    {
        
get_playersiPlayersiPnum"e"szTeam )
    
        for( new 
iiPnumi++ )
        {
            
ReadFileiPlayers], szTeamstr_to_numszPlayer ), );
        }
    }
    else
    {
        
read_argv2szValuecharsmaxszValue ) )
        
ReadFileiPlayerszTeamstr_to_numszValue ), );
    }
    
    
ReadFile_szTeam );
    
client_printidprint_chat"banned" )
    return 
PLUGIN_HANDLED;
}

@
UnBanTeamid )
{
    static 
szSteamIDMAX_AUTHID_LENGTH ], szCommand10 ], szTeam10 ], szPlayer32 ], szExpireDate32 ];
    
read_argv0szCommandcharsmaxszCommand ) )
    
read_argv1szPlayercharsmaxszPlayer ) )
    
copyszTeamcharsmaxszTeam ), szCommand] == 'c' "CT" "TERRORIST" )
        
    new 
iPlayer cmd_targetidszPlayer );
    
    
ReadFile_szTeam )
    
    if( 
iPlayer )
    {
        if( 
TrieGetStringg_tBanTeamg_szSteamIDid ], szExpireDatecharsmaxszExpireDate ) ) ) 
        {
            
TrieDeleteKeyg_tBanTeamszSteamID );
        }
        
client_printidprint_chat"Player %s has been unbanned"szSteamID )
    }
    else 
    {
        
ReadFile_szTeam_)
        
client_printidprint_chat"All %s has been unbanned"szTeam )
    }
    
    
client_printidprint_chat"unbanned" )

    return 
PLUGIN_HANDLED;
}

ReadFileid = -1, const szTeam[ ] = "", const iTime 0iType 0)
{
    new 
szConfigs64 ], szFile96 ], szDataMAX_AUTHID_LENGTH ], szSteamIDMAX_AUTHID_LENGTH ], szExpireDate32 ], iFile;
    
get_configsdirszConfigscharsmaxszConfigs ) )
    
formatexszFilecharsmaxszFile ), "%s/BanList_%s.ini"szConfigsszTeam )
    
    switch( 
iType )
    {
        case 
0:
        {
            
iFile fopenszFile"rt" );
    
            if( 
iFile )
            {
                while( 
fgetsiFileszDatacharsmaxszData ) ) )
                {   
                    
trimszData );
                
                    switch( 
szData] )
                    {
                        case 
EOS';''#''/': continue;
                        default:
                        {
                            
parseszDataszSteamIDcharsmaxszSteamID ), szExpireDatecharsmaxszExpireDate ) );
                            if( !
szExpireDate] || szExpireDate] == '0' || !HasDateExpiredszExpireDate ) )
                            {
                                
TrieSetStringg_tBanTeamszSteamIDszExpireDate );
                            }
                        }
                    }
                }
                
fcloseiFile );
            }
        }
        
        case 
1:
        {
            
iFile fopenszFile"wt")
        
            if( 
iFile && pev_validid ) && iTime 
            {        
                
get_time"%m-%d-%Y"szExpireDatecharsmaxszExpireDate ) );
        
                
AddToDateszExpireDateiTimeszExpireDatecharsmaxszExpireDate ) );
                
trimszExpireDate );
        
                
fprintfiFile"%s %s^n"g_szSteamIDid ], szExpireDate );

                
fcloseiFile );
            }
        }
        case 
2delete_fileszConfigs );
    }
}

bool:HasDateExpired( const szDate[ ] )
{
    return 
get_systime( ) >= parse_timeszDate"%m-%d-%Y" );
}

AddToDate( const szDate[ ], const iMinutesszReturnDate[ ], const iSize )
{
    new const 
szFormatRule[ ] = "%m-%d-%Y";
    new const 
iSecondsInMinute iDateSeconds;
    
    new 
iCurrentTimeStamp parse_timeszDateszFormatRule );
    
iCurrentTimeStamp iCurrentTimeStamp + ( iMinutes iSecondsInMinute );
    
format_timeszReturnDateiSizeszFormatRuleiCurrentTimeStamp );

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 06-09-2022 at 14:20.
Supremache 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 05:53.


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