|
 非常好的插件,可惜有错误:confused:
/* AMX Mod script.
*
* Based on a script by RAV
* Made By AssKicR
* Modified by deadBeat May - June 2003
*/
//Uncomment If You Want Swearers to loose SuperHeroMod XP :)
//#define RUN_WITH_SHM
#include <amxmod>
#if defined(RUN_WITH_SHM)
#include <superheromod>
#endif
// max number of words in word list
#define MAX_WORDS 192
// file to read words from
new g_swearsFile[] = "addons/amx/wordlist.cfg"
new g_swearsNames[MAX_WORDS][32]
new g_swearsNum
public plugin_init() {
register_plugin("Swear Filter","1.10","AssKicR/deadBeat")
register_clcmd("say","swearFilter")
register_clcmd("say_team","swearFilter")
register_cvar("sw_admin","1.0")
register_cvar("sw_warn","0.0")
register_cvar("sw_cashloss", "100")
readList( g_swearsFile )
return PLUGIN_CONTINUE
}
readList(filename[]) {
if(!file_exists(filename) ){
log_message("Swear Filter: file %s not found", filename)
return
}
new iLen
while ( (g_swearsNum < MAX_WORDS) &&
(read_file(filename, g_swearsNum, g_swearsNames[g_swearsNum][1],30,iLen))) {
g_swearsNames[g_swearsNum][0] = iLen
++g_swearsNum
}
log_message("Swear Filter: loaded %d words",g_swearsNum )
}
public swearFilter(id) {
if ((get_cvar_num("sw_admin") > 0) && (get_user_flags(id) > 0))
return PLUGIN_CONTINUE
new szSaid[192]
read_args(szSaid,191)
new bool:found = false
new pos, i = 0
while (i < g_swearsNum) {
if ((pos = containi(szSaid,g_swearsNames[1])) != -1 ){
new len = g_swearsNames[0]
while(len--) szSaid[pos++] = '*'
found = true
continue
}
++i
}
if (found) {
new cmd[32]
new money = get_user_money(id)
new loss = get_cvar_num("sw_cashloss")
if (money < loss)
loss = money
set_user_money(id, money - loss,1)
#if defined(RUN_WITH_SHM)
shAddXP(id, id, -1)
#endif
if (loss > 0)
client_print(id,print_chat,"[AMX] You have been fined $%i for swearing.",loss)
read_argv(0,cmd,31)
engclient_cmd(id,cmd,szSaid)
if (get_cvar_num("sw_warn") > 0) {
set_hudmessage(220,80,0, 0.05, 0.50, 2, 0.1, 3.0, 0.02, 0.02, 10)
show_hudmessage(id,"WATCH YOUR LANGUAGE^nYou have been fined $%i for swearing!",loss)
}
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
编译后出现错误:
Small compiler 2.1.0 Copyright (c) 1997-2002, ITB CompuPhase
swearfilter.sma(110) : warning 217: loose indentation
swearfilter.sma(121) : warning 217: loose indentation
2 Warnings.
Press any key to continue . . .
插件地址
http://amxmod.net/forums/viewtopic.php?t=16080&postdays=0&postorder=asc&start=0 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|