搜索
查看: 1673|回复: 1

修改另類封禁問題

[复制链接]
发表于 2008-4-11 16:41:24 | 显示全部楼层 |阅读模式 来自 中国–香港
amx_retrybanduration        每次封禁   多久
amx_retrytimetoban            設定幾多分鐘
amx_retrycounttoban          設定retrytimetoban內重入多少次才封禁
如何修改為非使用banip           使用CFG記錄當該玩家進入便提示不能進入


[PHP]/* 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[MAX_PLAYERS+1][22]
new markedIp[MAX_PLAYERS+1]

public client_connect(id) {
    if ((!is_user_bot(id)) && ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) && (get_cvar_num("amx_retryban")==1)) {
new userip[21+1]
new uname[33+1]
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[1]
  userid[0] = get_user_userid(id)  
  if ( !(get_user_flags(id) & ADMIN_IMMUNITY) ) {     
      //--------------------------------------------
      if (markedIp < get_cvar_num("amx_retrycounttoban"))
      {   
   return PLUGIN_CONTINUE
      }
      //--------------------------------------------
      
      new txt[128]
      get_cvar_string("amx_retrybanmsg", txt, 127)
      new min[6]
      new min2[6]
      new retryCount[3]
      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[128]
   new text[128]
   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] = 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] == 0) {
  markedIp++;
  server_print("say ----Markip[%d] = %d----", i, markedIp)
  //--------------------------------------------
  if (markedIp == 1) // First time retry
  {  
   new para[3]
   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[21+1]
   get_user_ip(id, userip, 21, 0)
   copy(pip, 21, userip)   
  }
  return PLUGIN_CONTINUE
     }
}
    }
    return PLUGIN_CONTINUE
}
public clean_markedip(index[]) {
    markedIp[str_to_num(index)]=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","3")
register_cvar("amx_retrycounttoban","3")

// %s is the player name, %m is amx_retrybanduration in minutes

register_cvar("amx_retrybanmsg"," %s 被封禁 %m 分鐘因為佢重新連接伺服 %d 次在 %m2 分鐘內")
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
}
[/PHP]
 楼主| 发表于 2008-4-13 09:55:47 | 显示全部楼层 来自 中国–香港

回复: 修改另類封禁問題

誰能幫幫忙~~~~~~~~~~
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表