搜索
查看: 1664|回复: 4

[求助] 插件程序员请进,骂人过滤而且扣钱的插件源码有错误无法编译,请帮忙!

[复制链接]
发表于 2003-8-14 12:03:52 | 显示全部楼层 |阅读模式 来自 中国–湖北–襄阳
非常好的插件,可惜有错误: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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2003-8-14 13:47:02 | 显示全部楼层 来自 中国–福建–厦门

没有关系

又不是error警告,warning不要紧的,出现的是不影响插件运行的小错误,直接用就是了
回复

使用道具 举报

 楼主| 发表于 2003-8-14 14:27:43 | 显示全部楼层 来自 中国–湖北–襄阳
关键是不过滤坏词,而且不扣钱
回复

使用道具 举报

发表于 2003-8-23 21:11:11 | 显示全部楼层 来自 中国–江西–萍乡
编译没有问题。但是我不明白
if ((get_cvar_num("sw_admin") > 0) && (get_user_flags(id) > 0))
return PLUGIN_CONTINUE
那个get_user_flags是干什么用的呢?我设置sw_admin=1时好象过滤的功能就无效了
回复

使用道具 举报

发表于 2003-8-23 21:28:35 | 显示全部楼层 来自 中国–北京–北京
难到是TFC的插件?
回复

使用道具 举报

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

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