广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 1538 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
能天使
个人头像
个人文章 个人相簿 个人日记 个人地图
初露锋芒
级别: 初露锋芒 该用户目前不上站
推文 x72 鲜花 x196
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6][插件] Ban sma 修改.. 请进..大大
复制程式
/*

Ban Old Menu (yeah it could really use a better name)

Collects info from players who have left the server recently and gives the admin a menu from which the admin can auth/ip ban, name+auth+ip are collected and displayed, each ban requires a confirm which will help prevent annoying accidents.

50 most recent, reset on map change, when over 50 the old data gets over written slot by slot, while under 50 oldest first, just a little over 50 and the first few start to get over written.

used menu structure from:
http://www.amxmodx.org/forums/viewtopic.php?p=112762
*     Vote Kick/Ban Menu
*        by WaZZeR
*   Thanks to:
*     v3x       - helped me with the loose indentation error 
*     xeroblood - for the palyer menu template

todo: ban server cmd cvar, for diff ban systems; unban menu; reduce memory waste; see ip permissions; newest always go first

*/
#include <amxmodx>
#include <amxmisc>

#define MENU_SIZE    1024
#define MENU_PLAYERS 7
#define OLD_MAX 50

new g_iMenuPosition[33]; //position in menu list
new g_iMenuPlayers_auth[OLD_MAX+1][30]; //old player list
new g_iMenuPlayers_name[OLD_MAX+1][30]; 
new g_iMenuPlayers_ip[OLD_MAX+1][30]; 
new g_iMenuOption_auth[33][30]; //to confirm
new g_iMenuOption_name[33][30]; 
new g_iMenuOption_ip[33][30]; 
new g_iMenuSettings[33]; //auth/ip
new g_iMenuOldCounter; // up stop
new g_iMenuOldInsertPos; // up down up down

public plugin_init()
{
    register_plugin("Ban Old Menu","0.1","Seather");
    register_menucmd(register_menuid("Ban Old Menu"),1023,"actionBanOldMenu");
    register_clcmd("amx_banmenu","cmdBanOld",ADMIN_KICK,"- displays ban old menu");
    g_iMenuOldCounter = 0;
    g_iMenuOldInsertPos = 0;
}


public cmdBanOld( id, lvl, cid )
{
    if( cmd_access( id, lvl, cid, 0 ) )
    {
        g_iMenuOption_auth[id] = " ";
        g_iMenuSettings[id] = 0;
        g_iMenuPosition[id] = 0;

        showBanOldMenu(id);
    }
    return PLUGIN_HANDLED
}

public showBanOldMenu( id )
{
    if( g_iMenuPosition[id] < 0 ) return

    new i;
    new szMenuBody[MENU_SIZE];
    new iCurrKey = 0;
    new iStart = g_iMenuPosition[id] * MENU_PLAYERS;

    if( iStart >= g_iMenuOldCounter )
    {
        iStart = g_iMenuPosition[id] = 0;
    }
    new iLen = format( szMenuBody, MENU_SIZE-1, "\rBan Old Menu\R%d/%d^n\w^n", g_iMenuPosition[id]+1, (g_iMenuOldCounter / MENU_PLAYERS + ((g_iMenuOldCounter % MENU_PLAYERS) ? 1 : 0 )) );
    new iEnd = iStart + MENU_PLAYERS;
    new iKeys = (1<<9|1<<7);

    if( iEnd > g_iMenuOldCounter )
        iEnd = g_iMenuOldCounter;

    for( i = iStart; i < iEnd; i++ )
    {
            iKeys |= (1<<iCurrKey++);
            iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s, %s, %s^n", iCurrKey, g_iMenuPlayers_auth[i], g_iMenuPlayers_name[i], g_iMenuPlayers_ip[i] );
    }
    //Check if it is auth or ip
    if (!equal(g_iMenuOption_auth[id]," "))
        iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. CONFIRM,%s,%s,%s,%s^n" , g_iMenuSettings[id] ? "Ban IP" : "Ban Auth" , g_iMenuOption_auth[id] , g_iMenuOption_name[id] , g_iMenuOption_ip[id] );
    else if ( g_iMenuSettings[id] == 0)
        iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. AUTH^n" );
    else
        iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. IP^n" );
        
    //Cheack if there are more players left
    if( iEnd != g_iMenuOldCounter )
    {
        format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s", g_iMenuPosition[id] ? "Back" : "Exit" );
        iKeys |= (1<<8);
    }
    else
        format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", g_iMenuPosition[id] ? "Back" : "Exit" );

    show_menu( id, iKeys, szMenuBody, -1 );

    return
}

public actionBanOldMenu( id, key )
{
    switch( key )
    {
        case 7: {
            if(!equal(g_iMenuOption_auth[id]," ")) //ban!
            {
                if(g_iMenuSettings[id] == 0)
                    server_cmd("banid 0 %s;writeid",g_iMenuOption_auth[id]);
                else
                    server_cmd("addip 0 %s;writeip",g_iMenuOption_ip[id]);
                
                /////
                new l_name[30];
                get_user_name( id, l_name, 29 );
                new l_authid[30];
                get_user_authid(id,l_authid,29);
                console_print(id, "[AMXX] %s,%s,%s,%s", g_iMenuSettings[id] ? "Ban IP" : "Ban Auth", g_iMenuOption_auth[id],g_iMenuOption_ip[id],g_iMenuOption_name[id]);                
                switch (get_cvar_num("amx_show_activity"))
                {
                    case 2: client_print(0, print_chat, "[香港伺服器] 管理员 %s :: %s,%s,%s", l_name, g_iMenuSettings[id] ? "Ban IP" : "Ban Auth", g_iMenuOption_auth[id],g_iMenuOption_name[id]); //admin name
                    case 1: client_print(0, print_chat, "[香港伺服器] 管理员 :: %s,%s,%s", g_iMenuSettings[id] ? "Ban IP" : "Ban Auth", g_iMenuOption_auth[id],g_iMenuOption_name[id]);
                }
            
                log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s,%s,%s,%s^"", l_name, get_user_userid(id), l_authid, g_iMenuSettings[id] ? "Ban IP" : "Ban Auth", g_iMenuOption_auth[id],g_iMenuOption_ip[id],g_iMenuOption_name[id]);

                /////
                g_iMenuOption_auth[id] = " ";
            }
            else if(g_iMenuSettings[id] == 0)
            {
                g_iMenuSettings[id] = 1;
            }
            else
            {
                g_iMenuSettings[id] = 0;
            }
                 
            showBanOldMenu( id );
        }
        case 8: {
            g_iMenuOption_auth[id] = " ";
            ++g_iMenuPosition[id];
            showBanOldMenu( id ); // More Option
        }
        case 9: {
            g_iMenuOption_auth[id] = " ";
            --g_iMenuPosition[id];
            showBanOldMenu( id ); // Back Option
        }

        default:
        {
            new player = g_iMenuPosition[id] * MENU_PLAYERS + key;

            g_iMenuOption_auth[id] = g_iMenuPlayers_auth[player];
            g_iMenuOption_name[id] = g_iMenuPlayers_name[player];
            g_iMenuOption_ip[id] = g_iMenuPlayers_ip[player];

            showBanOldMenu( id );
        }
    }
    return PLUGIN_HANDLED
}

public client_disconnect(id)
{
   new l_authid[30];
   get_user_authid(id,l_authid,29);
   
   new l_name[30];
   get_user_name( id, l_name, 29 );
   
   new l_ip[30];
   get_user_ip( id, l_ip, 29, 1 );
   
   if( !(get_user_flags(id) & ADMIN_IMMUNITY) && !is_user_bot(id) )
   {
   g_iMenuPlayers_auth[g_iMenuOldInsertPos] = l_authid;
   g_iMenuPlayers_name[g_iMenuOldInsertPos] = l_name;
   g_iMenuPlayers_ip[g_iMenuOldInsertPos] = l_ip;
   
   g_iMenuOldCounter++;
   g_iMenuOldInsertPos++;
   if(g_iMenuOldInsertPos >= OLD_MAX)
     g_iMenuOldInsertPos = 0;
   if(g_iMenuOldCounter > OLD_MAX)
     g_iMenuOldCounter = OLD_MAX;
   }  
}

如何修改至不封IP 只封CS名





献花 x0 回到顶端 [楼 主] From:香港特别行政区 | Posted:2012-01-25 04:21 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.067797 second(s),query:15 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言