[HELP] I have a problem with regex in my plugin.
Hey everyone..
I've made a plugin that censor a words that written in a text file. The code compiles and everything is allright, but when i test it, and write in the chat for example: "i love my people" and it not doing nothing. PHP Code:
Code:
#include <amxmodx>PHP Code:
Please help me! You'rs, Elad. |
Re: [HELP] I have a problem with regex in my plugin.
The biggest mistake is that g_arrszWords is an array of single cells when it needs to be an array of strings.
I've never had to use "/pattern/", I've only needed "pattern" and case insensitivity can be acheived using a flag on the regex_match function. Also, take a look at this: http://wiki.amxmodx.org/Advanced_Scr...ar_Expressions |
Re: [HELP] I have a problem with regex in my plugin.
PHP Code:
|
Re: [HELP] I have a problem with regex in my plugin.
Thank you both.
I have to go work now so i'll test everything you said when I back. But I have a question to fysiks , What you mean Quote:
Why I need to use [][] array? it will be like new array[32][1] and it's looks pretty stupid O_o. Can you please explain you'r self? Thank you alot again. Elad. Edit: I read in the link wich you gave me (this) and nothing is written there about Sensivity case. also in the AMXx.org functions -> regex_match there is nothing about Sensivity Case. btw, In every language regex pattern is between two "/" and after the second one comes the header flags, 'i' is the one that tells the regex to ignore sensivity case. I really stack now and I don't know what to do. |
Re: [HELP] I have a problem with regex in my plugin.
Quote:
Therefore an array of strings is an array of arrays. Therefore it is a two dimensional array. Line 21: new g_arrszWords[MAX_WORDS + WORDS_OFFSET][LEN_WORDS+1] Line 44: g_arrszWords[i][0] = NULL Line 84: formatex(g_arrszWords[nCount], LEN_WORDS, fData) Line 141: if (g_arrszWords[j][0] == NULL) { Line 134: I'd think it would be more efficient to loop over only nCount and not MAX_WORDS everytime. You could get rid of anything with NULL. Quote:
Code:
/**Quote:
Maybe it will work after you get strings in your array. But I don't know why they would add that flag if you could just use what you describe there. |
Re: [HELP] I have a problem with regex in my plugin.
I tried what you said, and when I looked at it again, it's the same. but your idea is more effectivity.
It still returns me the same error in the server runtime plugin debug. (-debug) I copied it: Code:
L 04/05/2009 - 16:43:15: [AMXX] Plugin file open error (plugin "commands")Any suggestions? (btw if i didn't say that, i appreaciate you'r help! thank!) |
Re: [HELP] I have a problem with regex in my plugin.
From that link:
PHP Code:
Problem fixed :). |
Re: [HELP] I have a problem with regex in my plugin.
Yey! you were right! ;-)
But still it ain't working! and I can't get it! why?! i loop my eyes over the code thousend times and I don't see something wrong. From what I see, you are geniuess ;> Maybe you will find something? The code looks like that. The problem? in badwords.txt there is only one pattern that looks like this: z[o0]na And let's say that the cvar now is on "1" (blocks the message if the word in the sentence), i write "zona" or "z0na" and it not blocking it. the same in the other cvars. Please help! Code:
#include <amxmodx> |
Re: [HELP] I have a problem with regex in my plugin.
I can't tell. I just took your plugin and change it a bit. This works:
PHP Code:
|
Re: [HELP] I have a problem with regex in my plugin.
Wow! thanks alot!
i really appricaite you'r help! Thanks in addition, Elad. |
| All times are GMT -4. The time now is 02:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.