|
发表于 2009-1-15 02:59:23
|
显示全部楼层
来自 中国–广西–百色
- /* AMX Mod Script.
- *
- * (c) Copyright 2002-2003, RAV
- * This file is provided as is (no warranties).
- *
- * Swearing will be filtered.
- *
- * Changelog:
- * 1.20 - Fixed some bugs
- * 1.10 - Initial Release
- */
- #include <amxmod>
- // max number of words in word list
- #define MAX_WORDS 64
- // Number of random messages.
- #define MESSAGES 4
- new g_messages[MESSAGES][] = {
- "三次警告內容!",
- "你再發廣告我就踢你出去!",
- "你再發廣告我就封你IP!",
- "你再發廣告我就長封你IP!"}
- // file to read words from
- new g_wordList[] = "addons/amx/wordlist.txt"
- new g_swears[MAX_WORDS][32]
- new g_swearsNum
- new count=0
- public plugin_init()
- {
- register_plugin("Word_Auto_Ban","0.1","YanOnline")
- register_clcmd("say","swearFilter")
- register_clcmd("say_team","swearFilter")
- register_cvar("amx_word_ban","60")
-
- if (file_exists(g_wordList))
- {
- new len, i = 0
- while( read_file(g_wordList,i++,g_swears[g_swearsNum],31,len) )
- if (len) ++g_swearsNum
- }
- else log_message("[AMX] Swear file not found (name ^"%s^")",g_wordList)
- }
- public swearFilter(id)
- {
- new said[128],says[3],names[32],ips[16],bans[5]
- read_args(said,127)
-
- for (new i=0; i<g_swearsNum; ++i)
- {
- if ( containi(said,g_swears[i]) != -1 )
- {
- count=count+1
-
- if (count>3){
- get_user_ip(id,ips,16)
-
- numtostr(get_cvar_num( "amx_word_ban"),bans,5)
- client_print(0,print_center,"*公告:已經自動封[%s]%s分鐘!",ips,bans)
- server_cmd("amx_ban %s %s",bans,ips)
- count=0
- }
- get_user_name(id,names,31)
- numtostr(count,says,3)
- // client_cmd(id,"say %s %s",says,g_messages[ random_num(0,MESSAGES-1) ])
- if (count>0)
- client_print(0,print_chat,"*第%s次警告[%s], %s",says,names,g_messages[count])
- return PLUGIN_HANDLED
- }
- }
-
- return PLUGIN_CONTINUE
- }
复制代码 |
|