Raised This Month: $ Target: $400
 0% 

containi() always seems to match


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
[DumB]Steamsucks
Junior Member
Join Date: Feb 2006
Location: uk
Old 03-03-2006 , 12:13   containi() always seems to match
Reply With Quote #1

i have an ini file { minus the stars u know why there in there ) like so

f*ck|c*n8|nob|assh*le
sh*t|dick|wan*a|bas*ard

and the code i have is

Code:
#include <amxmodx> #include <amxmisc> #include <file> #include <cstrike> new Sarray[3][300] new inifile[101] new arg[192] new readdata[401]         // the data on the line it is reading new linelength = 0       // how long the line is new currline=0 stock explode( output[][], input[], delimiter, textlen, maxMatches )     {     new nIdx = 0     new nLen = (1 + copyc( output[nIdx], textlen, input, delimiter ))     new len = strlen(input)         while( nLen < len && nIdx < maxMatches )         nLen += (1 + copyc( output[++nIdx], textlen, input[nLen], delimiter ))     return nIdx + 1 } public plugin_init() {     register_plugin("Speak English", "0.1a", "[DumB]SteamSucks")         register_clcmd("say", "cmd_say")     register_clcmd("say_team", "cmd_sayteam")         inifile ="words.txt"    } public cmd_say(id)     {         new szFile[100]         get_configsdir( szFile , 99 )         format(szFile , 99 , "%s/%s", szFile, inifile)               read_args(arg, 191)     remove_quotes(arg) // Say Message are encase in Quotes           while(read_file(szFile,currline,readdata,400,linelength) != 0){  //checks every line in inifile, stores what it finds in readdata, and what line its on in currline                 explode(Sarray,readdata,'|',linelength,3)                 server_print("Badwords so far are: %s | %s | %s",Sarray[0],Sarray[1],Sarray[2])         server_print("words said are: %s",arg)                 if( !containi(arg,Sarray[2]) || !containi(arg,Sarray[1])  || !containi(arg,Sarray[2])) {             currline = 0             return PLUGIN_CONTINUE             } else {             client_print(id, print_chat, "Speak english only on this server please!!!")             server_cmd("kick %d Speak english",id)             client_cmd(id , "disconnect")             return PLUGIN_HANDLED           }                 currline++ //goes to the next line       }     currline = 0     return PLUGIN_HANDLED

when i say hi there in game in say it kicks me and i get this from console debug

Code:
Badwords so far are: f*ck | c*nt | w*nk*
words said are: hi there
Dropped ss from server
Reason:  Client sent 'drop'
none of the words i said where contained in any of the sarry items so why has it matched them any ideas any one ?

regards
__________________
If it works then i wrote it if it erros on less then 50 lines i had help with it if it breaks totally it wasnt me..
[DumB]Steamsucks is offline
Send a message via MSN to [DumB]Steamsucks
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode