Jump to content
GIGN Forum

Iptools.amxx


Recommended Posts

/* AMX Mod script. 
* 
* 
* 
*/ 

#include <amxmod>
#include <amxmisc>

public admin_banip(id, level, cid) { 
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED
    new ban_time = 0
    new ip[16] 
    read_argv(1, ip, 15) 
    new ban_times[13] 
    read_argv(2, ban_times, 12) 
    ban_time = str_to_num(ban_times) 
    if(!ban_time) 
        ban_time = 0
    new authid[16], name[32]
    get_user_authid(id,authid,15)
    get_user_name(id,name,31) 
    log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%i^") (reason ^"^")", name,get_user_userid(id),authid, ip, ban_time)
    new srvcmd[65]
    format(srvcmd, 64, "addip %i %s", ban_time, ip)
    if (ban_time == 0) {
        server_cmd("addip 0 %s; writeip", ip)
    } else {
        server_cmd("addip %d %s", ban_time, ip)
    }
    return PLUGIN_HANDLED_MAIN
    
} 

public admin_unbanip(id, level, cid) { 
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED
    new ip[16] 
    read_argv(1, ip, 15) 
    new authid[16], name[32]
    get_user_authid(id,authid,15)
    get_user_name(id,name,31) 
    log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^" unban ^"%s^" (reason ^"^")", name,get_user_userid(id),authid, ip)
    server_cmd("removeip %s; writeip", ip)
    return PLUGIN_HANDLED_MAIN
    
} 

public admin_ips(id) { 
    new players[32], inum, name[33], buf[2049], ip[17], tempn[35], temp[65]
    get_players(players, inum) 
    new i 
    for(i = 0; i < inum; i++) { 
        get_user_name(players[i], name, 32)
        get_user_ip(players[i], ip, 16, 1)
        copy(tempn, 32, name)
//        add(tempn, 34, "...........................................", 34)
        format(temp, 64, "%s ... %s^n", tempn, ip)
        add(buf, 2048, temp)
    } 
    show_motd(id, buf, "Player's IP")
    return PLUGIN_CONTINUE 
} 

public admin_ipl(id) { 
    new buf[2049], ip[33], temp[65]
    new len
    if (file_exists("listip.cfg")) {
        for(new i=0; i < 100 && read_file("listip.cfg", i, ip, 32, len) != 0; i += 1) {
        read_file("listip.cfg", i, ip, 32, len)
        format(temp, 32, "%s ^n", ip)
        add(buf, 2048, temp)
        }
    } 
    show_motd(id, buf, "Banned IP")
    return PLUGIN_CONTINUE 
} 

public plugin_init() 
{ 
    register_plugin("IPTools", "1.05", "SYZo") 
    register_clcmd("amx_ips", "admin_ips", ADMIN_BAN) 
    register_clcmd("amx_ipl", "admin_ipl", ADMIN_BAN) 
    register_concmd("amx_banip", "admin_banip", ADMIN_BAN, "<ip address> [time]") 
    register_concmd("amx_unbanip", "admin_unbanip", ADMIN_BAN,"<ip address>") 
    return PLUGIN_CONTINUE 
}

register_clcmd("amx_ips", "admin_ips", ADMIN_BAN) < lūk vieta kas jālabo... jo parastajiem spēlētājiem nav pieeja BAN'a komandai...

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...