Raised This Month: $59 Target: $400
 14% 

Solved CS 1.6 BlackList Plugin Customization


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
127.0.0.1
Junior Member
Join Date: Sep 2019
Old 10-06-2019 , 20:22   CS 1.6 BlackList Plugin Customization
Reply With Quote #1

Hello,

I found this old plugin and if possible could you please help me how can i edit this plugin for adding SteamIDs from the console?

Thanks.

Last edited by 127.0.0.1; 10-11-2019 at 05:00. Reason: issue is fixed and admins can use this
127.0.0.1 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-06-2019 , 21:21   Re: CS 1.6 BlackList Plugin Customization
Reply With Quote #2

Um, why don't you just ban the SteamID?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
127.0.0.1
Junior Member
Join Date: Sep 2019
Old 10-08-2019 , 20:45   Re: CS 1.6 BlackList Plugin Customization
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Um, why don't you just ban the SteamID?!
Sometimes we are cleaning ban lists and i don't want to clean the marked players and if i can add the SteamIDs from the console with this plugin that would be great. If you can help me i would be appreciated. Thanks.
127.0.0.1 is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 10-09-2019 , 07:09   Re: CS 1.6 BlackList Plugin Customization
Reply With Quote #4

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

#define PLUGIN "Black List"
#define VERSION "1.0"
#define AUTHOR "Dias"

new const user_file[] = "black_list.ini"
new Array:BlackList

new cvar_blacklist_handle
new cvar_blacklist_bantypecvar_blacklist_bantime

new filename[256]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
get_configsdir(filename,255)
    
format(filename,255,"%s/black_list.ini",filename)
    
    
cvar_blacklist_handle register_cvar("bl_handle""1"// 1 = Kick | 2 = Ban
    
    
cvar_blacklist_bantype register_cvar("bl_ban_type""2"// 1 = Ban SteamID | 2 = Ban IP
    
cvar_blacklist_bantime register_cvar("bl_ban_time""30"// Minutes
    
    
register_clcmd("amx_blacklist""addblacklist"ADMIN_BAN"amx_blacklist ^"STEAMID>^"")
}

public 
plugin_precache()
{
    
BlackList ArrayCreate(321)
    
read_user_from_file()
}

public 
addblacklist(id){
    if ( !
access(idADMIN_BAN) )
    {
        
console_print(id"You don't have access to this command.")
        return 
PLUGIN_HANDLED
    
}
    
    
    new 
arg1[32]
    
read_args(arg131)
    
remove_quotes(arg1)
    
    if (!
arg1[0]){
        
console_print(id"Usage: amx_blacklist ^"SteamID^"")
        return 
PLUGIN_HANDLED
    
}
    
    new 
writedata[32]
    
formatex(writedata,31,"%s",arg1)
    
    
write_file(filename,writedata)
    
    if(
is_user_connected(id))
        
console_print(id"[BlackList] %s have been blacklisted"writedata)
        
    new 
players[32], pnum
    get_players
(playerspnum"ch")
    
    
    for (new 
032i++){
        new 
szAuthId[34];
        
get_user_authidiszAuthIdcharsmax(szAuthId) );
        
        if(
equali(szAuthIdwritedata)){
            
server_cmd("kick #%d ^"You have been blacklisted.^""get_user_userid(i));
        }
    }
    
    
read_user_from_file()
    
    return 
PLUGIN_HANDLED
}

public 
read_user_from_file()
{
    static 
user_file_url[64], config_dir[32]
    
    
get_configsdir(config_dirsizeof(config_dir))
    
format(user_file_urlsizeof(user_file_url), "%s/%s"config_diruser_file)
    
    if(!
file_exists(user_file_url))
        return
    
    static 
file_handleline_data[64], line_count
    file_handle 
fopen(user_file_url"rt")
    
    while(!
feof(file_handle))
    {
        
fgets(file_handleline_datasizeof(line_data))
        
        
replace(line_datacharsmax(line_data), "^n""")
        
        if(!
line_data[0] || line_data[0] == ';'
            continue
            
        
ArrayPushString(BlackListline_data)
        
line_count++
    }
    
    
fclose(file_handle)
}

public 
client_connect(id)
{
    
check_and_handle(id)
}

public 
client_infochanged(id)
{
    
check_and_handle(id)
}

public 
check_and_handle(id)
{
    static 
name[64], steamid[64], Data[32]
    
    
get_user_name(idnamesizeof(name))
    
get_user_authid(idsteamidsizeof(steamid))
    
    for(new 
0ArraySize(BlackList); i++)
    {
        
ArrayGetString(BlackListiDatasizeof(Data))
        
        if(
equal(nameData) || equal(steamidData))
        {
            if(
get_pcvar_num(cvar_blacklist_handle) == 1// Kick
            
{
                
server_cmd("amx_kick %s BlackList"name)
                
                
client_printcolor(0"!g[AMX]!y !t%s!y is in Black List. Kick !t%s!y !!!"namename)
            } else if(
get_pcvar_num(cvar_blacklist_handle) == 2) { // Ban
                
if(get_pcvar_num(cvar_blacklist_bantype) == 1// Ban SteamID
                
{
                    
server_cmd("amx_ban %s BlackList %i"steamidget_pcvar_num(cvar_blacklist_bantime))
                } else if(
get_pcvar_num(cvar_blacklist_bantype) == 2) { // BanIP
                    
server_cmd("amx_banip %s BlackList %i"nameget_pcvar_num(cvar_blacklist_bantime))
                }
                
                
client_printcolor(0"!g[AMX]!y !t%s!y is in Black List. Ban !t%s!y | %i minutes !!!"namenameget_pcvar_num(cvar_blacklist_bantime))                
            }
        }
    }        
}

stock client_printcolor(const id, const input[], any:...)
{
    new 
iCount 1iPlayers[32]
    static 
szMsg[191]
    
    
vformat(szMsgcharsmax(szMsg), input3)
    
replace_all(szMsg190"!g""^4")
    
replace_all(szMsg190"!y""^1")
    
replace_all(szMsg190"!t""^3")
    
    if(
idiPlayers[0] = id
    
else get_players(iPlayersiCount"ch")
    
    for (new 
0iCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMsg)
            
message_end()
        }
    }


amx_blacklist "STEAMID" or "Name" should add that name or STEAMID to blacklist. If it's a steamid and the user is connected it will kick the user immediately. I didn't bother to add a kick mechanic for a name block. It will kick the user with that nickname when map changes/they rejoin.

Last edited by Moody92; 10-09-2019 at 07:36.
Moody92 is offline
127.0.0.1
Junior Member
Join Date: Sep 2019
Old 10-10-2019 , 13:59   Re: CS 1.6 BlackList Plugin Customization
Reply With Quote #5

Quote:
Originally Posted by Moody92 View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Black List"
#define VERSION "1.0"
#define AUTHOR "Dias"

new const user_file[] = "black_list.ini"
new Array:BlackList

new cvar_blacklist_handle
new cvar_blacklist_bantypecvar_blacklist_bantime

new filename[256]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
get_configsdir(filename,255)
    
format(filename,255,"%s/black_list.ini",filename)
    
    
cvar_blacklist_handle register_cvar("bl_handle""1"// 1 = Kick | 2 = Ban
    
    
cvar_blacklist_bantype register_cvar("bl_ban_type""2"// 1 = Ban SteamID | 2 = Ban IP
    
cvar_blacklist_bantime register_cvar("bl_ban_time""30"// Minutes
    
    
register_clcmd("amx_blacklist""addblacklist"ADMIN_BAN"amx_blacklist ^"STEAMID>^"")
}

public 
plugin_precache()
{
    
BlackList ArrayCreate(321)
    
read_user_from_file()
}

public 
addblacklist(id){
    if ( !
access(idADMIN_BAN) )
    {
        
console_print(id"You don't have access to this command.")
        return 
PLUGIN_HANDLED
    
}
    
    
    new 
arg1[32]
    
read_args(arg131)
    
remove_quotes(arg1)
    
    if (!
arg1[0]){
        
console_print(id"Usage: amx_blacklist ^"SteamID^"")
        return 
PLUGIN_HANDLED
    
}
    
    new 
writedata[32]
    
formatex(writedata,31,"%s",arg1)
    
    
write_file(filename,writedata)
    
    if(
is_user_connected(id))
        
console_print(id"[BlackList] %s have been blacklisted"writedata)
        
    new 
players[32], pnum
    get_players
(playerspnum"ch")
    
    
    for (new 
032i++){
        new 
szAuthId[34];
        
get_user_authidiszAuthIdcharsmax(szAuthId) );
        
        if(
equali(szAuthIdwritedata)){
            
server_cmd("kick #%d ^"You have been blacklisted.^""get_user_userid(i));
        }
    }
    
    
read_user_from_file()
    
    return 
PLUGIN_HANDLED
}

public 
read_user_from_file()
{
    static 
user_file_url[64], config_dir[32]
    
    
get_configsdir(config_dirsizeof(config_dir))
    
format(user_file_urlsizeof(user_file_url), "%s/%s"config_diruser_file)
    
    if(!
file_exists(user_file_url))
        return
    
    static 
file_handleline_data[64], line_count
    file_handle 
fopen(user_file_url"rt")
    
    while(!
feof(file_handle))
    {
        
fgets(file_handleline_datasizeof(line_data))
        
        
replace(line_datacharsmax(line_data), "^n""")
        
        if(!
line_data[0] || line_data[0] == ';'
            continue
            
        
ArrayPushString(BlackListline_data)
        
line_count++
    }
    
    
fclose(file_handle)
}

public 
client_connect(id)
{
    
check_and_handle(id)
}

public 
client_infochanged(id)
{
    
check_and_handle(id)
}

public 
check_and_handle(id)
{
    static 
name[64], steamid[64], Data[32]
    
    
get_user_name(idnamesizeof(name))
    
get_user_authid(idsteamidsizeof(steamid))
    
    for(new 
0ArraySize(BlackList); i++)
    {
        
ArrayGetString(BlackListiDatasizeof(Data))
        
        if(
equal(nameData) || equal(steamidData))
        {
            if(
get_pcvar_num(cvar_blacklist_handle) == 1// Kick
            
{
                
server_cmd("amx_kick %s BlackList"name)
                
                
client_printcolor(0"!g[AMX]!y !t%s!y is in Black List. Kick !t%s!y !!!"namename)
            } else if(
get_pcvar_num(cvar_blacklist_handle) == 2) { // Ban
                
if(get_pcvar_num(cvar_blacklist_bantype) == 1// Ban SteamID
                
{
                    
server_cmd("amx_ban %s BlackList %i"steamidget_pcvar_num(cvar_blacklist_bantime))
                } else if(
get_pcvar_num(cvar_blacklist_bantype) == 2) { // BanIP
                    
server_cmd("amx_banip %s BlackList %i"nameget_pcvar_num(cvar_blacklist_bantime))
                }
                
                
client_printcolor(0"!g[AMX]!y !t%s!y is in Black List. Ban !t%s!y | %i minutes !!!"namenameget_pcvar_num(cvar_blacklist_bantime))                
            }
        }
    }        
}

stock client_printcolor(const id, const input[], any:...)
{
    new 
iCount 1iPlayers[32]
    static 
szMsg[191]
    
    
vformat(szMsgcharsmax(szMsg), input3)
    
replace_all(szMsg190"!g""^4")
    
replace_all(szMsg190"!y""^1")
    
replace_all(szMsg190"!t""^3")
    
    if(
idiPlayers[0] = id
    
else get_players(iPlayersiCount"ch")
    
    for (new 
0iCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMsg)
            
message_end()
        }
    }


amx_blacklist "STEAMID" or "Name" should add that name or STEAMID to blacklist. If it's a steamid and the user is connected it will kick the user immediately. I didn't bother to add a kick mechanic for a name block. It will kick the user with that nickname when map changes/they rejoin.
Appreciate for your work and effort. I will try and will write the results.
127.0.0.1 is offline
127.0.0.1
Junior Member
Join Date: Sep 2019
Old 10-11-2019 , 05:00   Re: CS 1.6 BlackList Plugin Customization
Reply With Quote #6

Working like a charm! Thanks @Moody92, appreciate!
127.0.0.1 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 17:40.


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