[Code] If Statement AND/OR

Status
Not open for further replies.

JayC

Always Learning
Aug 8, 2013
5,493
1,398
CLOSE THREAD FIXED
Right so I am updating my emulator so when people advertise they get muted for 25 seconds, which works, and after 2 attempts they get auto banned, which works. Here's the problem though.
Code:
if (System.Text.RegularExpressions.Regex.IsMatch(str, linkRegex, System.Text.RegularExpressions.RegexOptions.IgnoreCase) && (!str.Contains("facebook") || !str.Contains("prntscr") || !str.Contains("snog") || !str.Contains("devbest") || !str.Contains("limit-hotel") || !str.Contains("youtube")))
This if statement tests to see if it is an advertisement
YES -
If the string does not contain facebook OR
If the string does not contain prntscr OR
If the string does not contain snog OR
If the string does not contain devbest OR
If the string does not contain limit-hotel OR
If the string does not contain youtube

THEN -
Warn, Flood them, Ban them if attempt = 3

NO -
DO NOTHING
------
Problem:
If it it does contain any of those links, its still flooding and warning.

Solution:
Switch the OR's to AND's I just had to think about it a little bit more
 
Status
Not open for further replies.

Users who are viewing this thread

Top