Page 1 of 2

filtras

Posted: 2011 Feb 15 18:18
by aurimasko
Kodėl man jis neveikia?

Code: Select all

  #include <amxmodx>#include <amxmisc> #define MAX_WORDS 150 // global variables for storing the swear list and replace list and their respective number of linesnew g_swearWords[MAX_WORDS][300]new g_swearsNamesnew g_swearsNum  public plugin_init() {     register_plugin("Swear Filter","1.0a","SuicideDog")     register_clcmd("say","swearcheck")     register_clcmd("say_team","swearcheck")    readList()} readList() {     new Configsdir[64]    new swear_file[64]    get_configsdir( Configsdir, 63 )    format(swear_file, 63, "%s/swear/swearwords.ini", Configsdir )     if ( !file_exists(swear_file) )    {        server_print ( "==========================================================" )        server_print ( "[Swear Replacement] %s file not found", swear_file )        server_print ( "==========================================================" )        return    }     new len, i=0    while( i < MAX_WORDS && read_file( swear_file, i , g_swearWords[g_swearNum], 19, len ) )    {    i++    if( g_swearWords[g_swearNum][0] == ';' || len == 0 )        continue    g_swearNum++    }    server_print ( "[Swear Replacement] loaded %d Swear words", g_swearNum )  }  public swearcheck(id) {    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[i][1])) != -1 ){         new len = g_swearsNames[i][0]         while(len--)        szSaid[pos++] = '*'        found = true         continue    }    ++i    }    if ( found ){         new cmd[32]        read_argv(0,cmd,31)                  engclient_cmd(id,cmd,szSaid)        }    return PLUGIN_CONTINUE }   

taip sudėti pluginai:

Code: Select all

 ; AMX Mod X plugins ; Admin Base - Always one has to be activated;admin.amxx     ; admin base (required for any admin-related);admin_sql.amxx     ; admin base - SQL version (comment admin.amxx)admin_amxbans.amxxamxbans.amxx ; Basicadmincmd.amxx       ; basic admin console commandsadminhelp.amxx      ; help command for admin console commandsadminslots.amxx     ; slot reservationmultilingual.amxx   ; Multi-Lingual management ; Menusmenufront.amxx      ; front-end for admin menuscmdmenu.amxx        ; command menu (speech, settings)plmenu.amxx     ; players menu (kick, ban, client cmds.);telemenu.amxx      ; teleport menu (Fun Module required!)mapsmenu.amxx       ; maps menu (vote, changelevel)pluginmenu.amxx     ; Menus for commands/cvars organized by plugin ; Chat / Messagesamx_log_advanced.amxxadminchat.amxx      ; console chat commandsswear_filter.amxxantiflood.amxx      ; prevent clients from chat-flooding the serverscrollmsg.amxx      ; displays a scrolling messageimessage.amxx       ; displays information messagesadminvote.amxx      ; vote commands   ....  

Re: filtras

Posted: 2011 Feb 15 18:32
by audimas
gal nerasai i kokius zodzius pakeit keiksmazodzius

Re: filtras

Posted: 2011 Feb 15 18:42
by aurimasko
audimas wrote:gal nerasai i kokius zodzius pakeit keiksmazodzius
čia ir nereikia rašyti....

Re: filtras

Posted: 2011 Feb 15 19:10
by aaarnas
Neveikia, tai rašai keiksmažodį ir neblokuoja ?

Ir po engclient_cmd(id,cmd,szSaid) padėk

Code: Select all

engclient_cmd(id,cmd,szSaid)return PLUGIN_HANDLED;
nes kitaip tau rašys 2 žinutes.

Re: filtras

Posted: 2011 Feb 15 19:12
by aurimasko
taip rašau tą žodį kuris įrašytas į listą, bet neblokuoja

Re: filtras

Posted: 2011 Feb 15 19:17
by aaarnas
Pažiūrėk ar randa keiksmažodį:

Code: Select all

#include <amxmodx>#include <amxmisc> #define MAX_WORDS 150 // global variables for storing the swear list and replace list and their respective number of linesnew g_swearWords[MAX_WORDS][300]new g_swearsNamesnew g_swearsNum  public plugin_init() {     register_plugin("Swear Filter","1.0a","SuicideDog")     register_clcmd("say","swearcheck")     register_clcmd("say_team","swearcheck")    readList()} readList() {     new Configsdir[64]    new swear_file[64]    get_configsdir( Configsdir, 63 )    format(swear_file, 63, "%s/swear/swearwords.ini", Configsdir )     if ( !file_exists(swear_file) )    {        server_print ( "==========================================================" )        server_print ( "[Swear Replacement] %s file not found", swear_file )        server_print ( "==========================================================" )        return    }     new len, i=0    while( i < MAX_WORDS && read_file( swear_file, i , g_swearWords[g_swearNum], 19, len ) )    {    i++    if( g_swearWords[g_swearNum][0] == ';' || len == 0 )        continue    g_swearNum++    }    server_print ( "[Swear Replacement] loaded %d Swear words", g_swearNum )  }  public swearcheck(id) {    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[i][1])) != -1 ){         new len = g_swearsNames[i][0]         while(len--)        szSaid[pos++] = '*'        found = true         continue    }    ++i    }    if ( found ){         new cmd[32]        read_argv(0,cmd,31)                  engclient_cmd(id,cmd,szSaid)        client_print(id, print_chat, "Rastas keiksmazodis")        }    return PLUGIN_CONTINUE }

Re: filtras

Posted: 2011 Feb 15 19:33
by aurimasko
randa

Re: filtras

Posted: 2011 Feb 15 20:43
by aaarnas
Pamėgink engclient_cmd(id, szSaid)
Jei neveiks -
client_cmd(id, szSaid)

Re: filtras

Posted: 2011 Feb 15 20:56
by aurimasko
neveikia nei tas nei tas. bet aš pastebėjau, kad kai parašau keiksmažodį konsolėje atsiranda:


Unknown command: ****

Re: filtras

Posted: 2011 Feb 15 21:14
by newb
Jeigu nieko pats nekeistum o naudotum deffaultini viskas gerai veiktu.