Posts: 110
Threads: 17
Joined: Mar 2016
I am stocked on a function, that get always bug when i try to test and script it.
A function that detects the numbers in a string, on OnPlayerText, main chat.
If the player input in the chat-text (string) more than 5 numbers the chat return 0;, also if numbers are separate between spaces or other symbols.
How can i implement this idea? Any helps?
Thanks.
+ REP to all helpers.
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
So basically an anti advertisement system?
Posts: 110
Threads: 17
Joined: Mar 2016
Unfortunately, this is an older idea that i tried to implement many times on the past weeks; for some days i leaved it, then when i saw more ip spam on my server, that can't be handled by the anti adv system, i started thinking again. Btw i was trying to make this using strfind.
Thanks to be interest.
Posts: 110
Threads: 17
Joined: Mar 2016
Your code detects something such as an ip, or have numeric symbol limit for every text string?
Because my idea was to make a numeric limit on every message, that the player sends to the main server chat.
Thanks.
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
It detects VALID IPs and blocks them from being sent to the chat. If an invalid IP is detected, it just sends the message to the chat, as it can be anything. Just note that it's a strict detection.
Posts: 110
Threads: 17
Joined: Mar 2016
And what about the 5 numeric symbols limit for every sent string?
It's more easy to implement?
Thanks.
Posts: 110
Threads: 17
Joined: Mar 2016
This will not work, and it's just the mind most simple idea, but something like this, naturally implemed.
Код:
OnPlayerText{
if(IsNumeric[text] >= 5) return 0;
return 1;
}
Thanks again.
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
That's a stupid idea. It will be annoying when chatting.
Hello, I am 55 years-old. When I was 22, I moved to Canada. But then moved back to my native country when I was 32. How about you guys?
Guess, what...
Blocked
And, no that won't work. You gotta loop through the whole string, and count the numbers.