求助屏蔽一些插件广告的代码!
最近在网上下载了一些插件,由于没有sma源文件,装上后,那个插件老是自动发一个网址。有办法用插件来屏蔽掉这个自动发出的网址吗?
是client_print发出的
如果是玩家发出的,还可以判断,插件自己发出的,不知道如何捕捉才好。。。
/* 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[] = {
"三次警告內容!",
"你再發廣告我就踢你出去!",
"你再發廣告我就封你IP!",
"你再發廣告我就長封你IP!"}
// file to read words from
new g_wordList[] = "addons/amx/wordlist.txt"
new g_swears
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,31,len) )
if (len) ++g_swearsNum
}
else log_message(" Swear file not found (name ^"%s^")",g_wordList)
}
public swearFilter(id)
{
new said,says,names,ips,bans
read_args(said,127)
for (new i=0; i<g_swearsNum; ++i)
{
if ( containi(said,g_swears) != -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)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
他说的是插件广告... 谢谢野*人的回复,你那个代码是玩家发出的,那个广告插件应该是服务器自动发出的。 client_print发出的实在难搞,内置在插件里面,没有代码似乎无法去除。
尝试联系插件作者,请求修改。
说起来也是情有可原,这年头白吃的人太多,盗用他人成果的也很多,用这种方法保护自己,或者发插件不发源码,那是无奈之举,如果大家都好好尊重原作者,又何必如此? /* 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[] = {
"三次警告內容!",
"你再發廣告我就踢你出去!",
"你再發廣告我就封你IP!",
"你再發廣告我就長封你IP!"}
// file to read words from
new g_wordList[] = "addons/amx/wordlist.txt"
new g_swears
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,31,len) )
if (len) ++g_swearsNum
}
else log_message(" Swear file not found (name ^"%s^")",g_wordList)
}
public swearFilter(id)
{
new said,says,names,ips,bans
read_args(said,127)
for (new i=0; i<g_swearsNum; ++i)
{
if ( containi(said,g_swears) != -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)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
页:
[1]