Rulzy 发表于 2006-12-16 00:07:24

回复: [发布]BAN在一定时间内retry的玩家

public client_connect(id) {
if ((!is_user_bot(id)) && ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) && (get_cvar_num("amx_retryban")==1)) {

这个使用不正确,因为在 client_connect 事件里,玩家都还没有任何权限的,本来此玩家应该有免疫权限,但在这里并还没生效。
应该改成在 client_authorized 事件里判断。

8874323 发表于 2009-1-11 20:29:28

555 下载的源码是空白的

INSUN 发表于 2009-1-11 21:32:30

骗钱,下的源码是空的

tianming84 发表于 2009-1-11 21:47:52

占位待编辑

tingshow163 发表于 2009-1-14 16:44:35

支持共享精神

11698195 发表于 2009-1-14 19:06:46

骗钱,下的源码是空的

KzFun.小鱼 发表于 2009-1-15 10:13:12

/* AMX Mod script.
*
* ========================Ban retry player Version 1.1============================
*
* (c) Copyright 2006, C@mp3R based on SYZo's AMX plugin
* This file is provided as is (no warranties).
*
*
*
*        NEWS
*        11 Jan 2006       
*        - Add 2 new cvars
*                amx_retrytimetoban
*                amx_retrycounttoban : (if you retry "amx_retrycounttoban" times in "amx_retrytimetoban" minute(s), you will be banned)
*        - Fixed ADMIN_IMMUNITY problem, now admin with access level a will not be banned
*
*        10 Jan 2006
*        - Rename the plugin from no_reconnect to banretryplayer
*        - Fixed the wrong spelling Embarassed
*
*
*
*        amx_retryban = 1
*        amx_retrybanduration = 3
*        amx_retrychat = 1
*
*        amx_retrytimetoban = 10
*        amx_retrycounttoban = 2 (if you retry 3 times in amx_retrytimetoban minute(s), you will be banned)
*       
*        amx_retrybankmsg = "Ban %s %m min(s) because retry %d times in %m2 min(s)"
*        amx_retrychatmsg = "You were using command RETRY %d time(s) in %d minute(s) so you has been banned from this server in %d minutes. Come back later please!"
*
*/

#include <amxmodx>
#include <amxmisc>
#define MAX_PLAYERS 32

new pip
new markedIp


public client_connect(id) {
    if ((!is_user_bot(id)) && ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) && (get_cvar_num("amx_retryban")==1)) {

        new userip
        new uname
        get_user_ip(id, userip, 21, 0)
        get_user_name(id, uname, 33)
        for(new i = 1; i <= MAX_PLAYERS; i++) {
          if (equal(userip, pip, 21)) {
                new userid
                userid = get_user_userid(id)               
                if ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) {          
                  //--------------------------------------------
                  if (markedIp < get_cvar_num("amx_retrycounttoban"))
                  {                       
                        return PLUGIN_CONTINUE
                  }
                  //--------------------------------------------
                  
                  new txt
                  get_cvar_string("amx_retrybanmsg", txt, 127)
                  new min
                  new min2
                  new retryCount

                  num_to_str(get_cvar_num("amx_retrybanduration"),min, 5)                               
                  num_to_str(get_cvar_num("amx_retrytimetoban"),min2, 5)
                  num_to_str(get_cvar_num("amx_retrycounttoban"),retryCount, 2)

                  replace(txt, 127, "%s", uname)
                  replace(txt, 127, "%m", min)       
                  replace(txt, 127, "%m2", min2)
                  replace(txt, 127, "%d", retryCount)
                  
                  server_cmd("say %s",txt)
                  set_hudmessage(255, 0, 0, 0.05, 0.70, 0, 5.0, 6.0, 6.0, 0.15, 3)
                  show_hudmessage(0,"%s",txt)                  
                  
                  if        (get_cvar_num("amx_retrychat")==1)
                  {
                        new sTemp
                        new text
                        get_cvar_string("amx_retrychatmsg", sTemp, 127)
                        format(text, 128, sTemp, get_cvar_num("amx_retrycounttoban"), get_cvar_num("amx_retrytimetoban"), get_cvar_num("amx_retrybanduration"))
                        client_cmd(id,"echo %s",text)
                  }                  
                  server_cmd("addip %d ^"%s^";wait;writeip",get_cvar_num("amx_retrybanduration"),userip)
                  markedIp = 0
                  pip = 0

                }
                return PLUGIN_CONTINUE
          }
        }
       
    }   
    return PLUGIN_CONTINUE
}

public client_disconnect(id) {
    if ((!is_user_bot(id)) && ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) && (get_cvar_num("amx_retryban")==1)) {
        for(new i = 1; i <= MAX_PLAYERS; i++) {
          if(pip == 0) {
                markedIp++;
                server_print("say ----Markip[%d] = %d----", i, markedIp)
                //--------------------------------------------
                if (markedIp == 1) // First time retry
                {               
                        new para
                        format(para, 2, "%d", i)
                        set_task(60.0 * get_cvar_num("amx_retrytimetoban"), "clean_markedip", 0, para, 1)                       
                }
                //----------------------------------       
                else if (markedIp == get_cvar_num("amx_retrycounttoban"))// Reached the retry time count
                {
                        new userip
                        get_user_ip(id, userip, 21, 0)
                        copy(pip, 21, userip)                       
                }
                return PLUGIN_CONTINUE
          }
        }
    }
    return PLUGIN_CONTINUE
}
public clean_markedip(index[]) {

    markedIp=0;
}


public plugin_init() {
        register_plugin("Ban retry player","1.1","C@mp3r.vn")
        register_cvar("amx_retryban","1")
        register_cvar("amx_retrybanduration","3")
        register_cvar("amx_retrychat","1")
        register_cvar("amx_retrytimetoban","10")
        register_cvar("amx_retrycounttoban","2")
       
        // %s is the player name, %m is amx_retrybanduration in minutes
       
        register_cvar("amx_retrybanmsg","Ban %s %m min(s) because retry %d time(s) in %m2 min(s)")
        register_cvar("amx_retrychatmsg","You were using command RETRY %d time(s) in %d minute(s) so you has been banned from this server in %d minutes. Come back later please!")
        for(new i=0; i< MAX_PLAYERS; i++)
        {
                markedIp=0;
        }

        return PLUGIN_CONTINUE
}

没有钱下载的 可以看看这个源码

colaawp 发表于 2009-7-24 04:54:49

ban了是不是太邪恶了点```

colaawp 发表于 2009-7-24 04:56:07

ban了是不是太邪恶了点```

jackemoney 发表于 2009-12-11 16:44:52

好又学到点东西
页: 1 [2] 3 4
查看完整版本: [发布]BAN在一定时间内retry的玩家