搜索
查看: 1993|回复: 2

求助!!!关于惩罚骂人插件的问题。

[复制链接]
发表于 2004-9-4 12:31:03 | 显示全部楼层 |阅读模式 来自 中国–湖南–郴州
我的服务器是CS1。5,装的是AMX0。9。3,用惩罚骂人插件的只能屏蔽骂人的话,不能惩罚啊。请老大指点迷津!!谢谢!!
还有,如果可以的话,请老大修改可以屏蔽胀话ID,OP不受限制,谢谢!!!


/* AMX Mod script.
*
* (c) Copyright 2003, Dra
* This file is provided as is (no warranties).
*
*/

#include <amxmod>
#include <amxmisc>

#define MAX_WORD_NUM 256

/* cvar : amx_maxswear 3 , one map swear 3 times punish it */

new SwearSlap = 50    /* every swear slap damage */
new SwearMoney = 2000 /* every swear lost money */
new SwearType = 1    /* punish type : 1 kick, 2 ban, 3 gag, 0 do nothing */
new SwearBanTime = 30    /* ban punish time */
new ReplaceType = 1    /* swear msg : 1 replace swear words to '*', 2 handle msg, 3 replace msg */
new replacemsg1[] = "I tried to swear%s"
new replacemsg2[] = ", but if i do it %d more times i will be %sed!"

new wordfile[] = "addons/amx/wordlist.cfg"
new words[MAX_WORD_NUM][32]
new wlen[MAX_WORD_NUM]
new wnum
new swearflag[33]
new g_logFile[16]
new spword[4][] = {"","kick","bann","gag"}

public handlesay(id,level,cid) {
    new cmd[32], msg[192]
    new i, b, j, s, len
    if (swearflag[id]==-1) {
        client_print(id,print_notify,"* You are gagged...")
        return PLUGIN_HANDLED
    }
    read_args(msg,191)
    for (i=0;i<wnum;++i)
        if ((b=containi(msg,words))!=-1) {
            s = 1
            for (j=b;j<b+wlen;++j)
                msg[j]='*'
        }
    if (!s)    return PLUGIN_CONTINUE
    b = get_cvar_num("amx_maxswear")
    if ((++swearflag[id]>= b) && id) {
        if (SwearType && run_punish(id)!=3) return PLUGIN_HANDLED
    }
    set_user_money(id,max(get_user_money(id)-SwearMoney,0))
    if (is_user_alive(id))
        user_slap(id,min(get_user_health(id)-1,SwearSlap))
    if (swearflag[id]==-1 || ReplaceType==2) return PLUGIN_HANDLED
    if (!ReplaceType) return PLUGIN_CONTINUE
    read_argv(0,cmd,31)
    if (ReplaceType==3) {
        len = format(msg,191,replacemsg1, swearflag[id] == 1 ? "" : " once again")
        if (SwearType) {
            format(msg[len],191-len,replacemsg2, b-swearflag[id], spword[SwearType])
        }
    }
    client_cmd(id,"%s %s",cmd,msg)
    return PLUGIN_HANDLED
}
public run_punish(id) {
    new name[32], bantag[32]
    get_user_name(id,name,31)
    console_print(0,"[swear] %s have been %sed .",name,spword[SwearType])
    if (SwearType==2) {
        console_print(id,"* you have been banned  %d due to swear punish .",SwearBanTime)
        if (get_cvar_num("sv_lan")){
            get_user_ip(id, bantag, 31,1)
            server_cmd("addip %i %s;wait;writeip;kick #%d", SwearBanTime, bantag, get_user_userid(id))
        } else {
            get_user_authid(id, bantag, 31)
            server_cmd("banid %i %s kick;wait;writeid",SwearBanTime ,bantag)
        }
        log_to_file(g_logFile,"(swear) banned %d %s <%s> due to swear punish",SwearBanTime, name,bantag)
        return 2
    }
    if (SwearType==1) {
        log_to_file(g_logFile,"(swear) kicked %s <%s> due to swear punish", name,bantag)
        console_print(id,"* you have been kicked due to swear punish .")
        server_cmd("kick #%d", get_user_userid(id)  )
        return 1
    }
    swearflag[id] = -1
    client_print(id,print_notify,"* You are gagged...")
    return 3
}
public read_wordfile() {
    new line, filename[64]
    build_path(filename,63,wordfile)
    if (!file_exists(filename)) return 0
    while (wnum<MAX_WORD_NUM && read_file(filename,line++,words[wnum],31,wlen[wnum]))
        if (words[wnum][0] != ';') wnum++
    return wnum
}

public client_connect(id)
    swearflag[id]=0
public plugin_init() {
    register_plugin("Amx Max Swear","0.9.2","dra")
    register_concmd("say","handlesay")
    register_concmd("say_team","handlesay")
    register_concmd("amx_say","handlesay")
    register_concmd("amx_chat","handlesay")
    register_concmd("amx_psay","handlesay")
    register_concmd("amx_tsay","handlesay")
    register_concmd("amx_vote","handlesay")
    register_cvar("amx_maxswear","3")
    if (SwearType<0 || SwearType>3) SwearType=1
    get_logfile(g_logFile,15)
    read_wordfile()
    return PLUGIN_CONTINUE
 楼主| 发表于 2004-9-22 11:47:33 | 显示全部楼层 来自 中国–湖南–郴州
我自己顶一下
回复

使用道具 举报

发表于 2004-9-22 19:22:17 | 显示全部楼层 来自 中国–广东–深圳–龙岗区
帮你顶一下!
回复

使用道具 举报

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

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