#1

Hello.. I need something that would block a player from using HEX codes in the chat..
I need a script or snippet that when a player enters {ffffff} to the chat it does not even show up in the chat.
I tried this :-
pawn Код:
if (!strlen(text)) return (0);
Reply
#2

Well.. The code Isn't really easy.

But here is a tip:
Strings are actually arrays.. Meaing that the variable: string[5] which lets say equals "Johny" will look like :
Код:
0 - J
1 - O
2 - H
3 - N
4 - Y
5 - \0 (The NULL.)
So to loop through the character you can use:
pawn Код:
for(new i; i < strlen(string); i++)
{
    if(string[i] == 'CHAR HERE')
    {
          //CODE HERE
    }
}
Using the same code above... detect the pos of { and the pos of } and than delete all chars between them.
Reply
#3

The client filters out such codes on its own, they're not even sent to the server in the first place.
Reply
#4

Hmm. :/
Then why is that when someone enters hex codes in the chat. They automatically wins the reaction test? :/
Reply
#5

because you are using strcmp in test, use
if(text[0] && !strcmp(text, ...)) // test ok
or add
if (!strlen(text)) return (0);
before test
Reply
#6

Quote:
Originally Posted by Jefff
Посмотреть сообщение
because you are using strcmp in test, use
if(text[0] && !strcmp(text, ...)) // test ok
or add
if (!strlen(text)) return (0);
before test
Ahh yea!
Thanks! It worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)