View Single Post
Author Message
@LeX
Junior Member
Join Date: Nov 2018
Old 08-30-2020 , 03:21   [REQ] edit plugin amx_banlist
Reply With Quote #1

hi, i recently encountered a problem on the server, more precisely, a problem with the banlist of the 'advanced bans' plugin.

i would like to change it, so that the admins can search for a ban in the banlist by the player's name.

after a few searches i found something here but only for banned.cfg
i edited a little and i faced a small problem, not all bans are displayed.
i want them to show me all the bans that contain what i was searching.

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

public plugin_init()
{
    
register_plugin("AMXX Ban List Viewer","0.1a","Drak");
    
    
register_concmd("amx_banlist","CmdBanList",ADMIN_BAN,"Views the users in the advanced_bans.txt file");
}

public 
CmdBanList(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1))
        return 
1
        
    
new Search[32];
    
read_args(Search31);
    
    new 
pFile fopen("addons/amxmodx/data/advanced_bans.txt","r");
    if(!
pFile)
        return 
client_print(id,print_console,"[AMXX BanList] Unable to open BanList File.");
    
    new 
Data[256],Arg1[101],Arg2[101],Arg3[101],Arg4[101],Arg5[101],Arg6[101];
    
    while(!
feof(pFile))
    {
        
fgets(pFile,Data,255);
        if(
contain(Data,Search) != -1)
        {
            
parse(DataArg1100Arg2100Arg3100Arg4100Arg5100Arg6100);
            
console_print(id"************************************");
            
console_print(id"Name: %s"Arg2);
            
console_print(id"IP/SteamID: %s"Arg1);
                
            if(
equal(Arg3"0") && !equal(Arg3"0"))
                
replace(Arg3,100,"0","Temporar"); 
            else 
replace(Arg3,100,"0","Permanent");
                
            
console_print(id"Ban Type: %s"Arg3);
            
console_print(id"Unban Time: %s"Arg4);
            
console_print(id"Reason: %s",Arg5);
            
console_print(id"Admin: %s"Arg6);
            
console_print(id"************************************");
            return 
1;
        }
    }
    
fclose(pFile);
    return 
1


Last edited by @LeX; 08-30-2020 at 06:43.
@LeX is offline