Blocking language at OnPlayerText
#1

Someone knows how to block some language on OnPlayerText?
So someone will not talk Spanish on chat.
Reply
#2

Return 0 to prevent it from appearing in chat.
Reply
#3

You can't really block a whole language but you can block characters.
Reply
#4

You would need to actually check the text that is passed to OnPlayerText and see if it contains Spanish words or symbols. If it does, you can return 0, as Retardedwolf said, to prevent the text from being sent.

Unless you want to write an array of all the Spanish words, then just check for a few common ones or Spanish symbols (for example, n with tilt symbol). Besides that, I cannot think of another way of preventing it. It may have gotten past me here at 2AM, however.
Reply
#5

Look what I tried to do :
if(text[45] == "§") return SendClientMessage(playerid,WHITE,"You can't use this language");
§ is only for example

Now I tried to type something and it just writes the text to all of the server(Global), It's a RP server..
Reply
#6

pawn Код:
if( text[ 45 ] == '§' )
{
   SendClientMessage( playerid, WHITE, "You can't use this language" );
   return 0;
}
- You need to use single quotes in order to check for a single symbol.
- You need to return 0 to prevent the text.
Reply
#7

Its still fucking up my OnPlayerText :[
Reply
#8

The problem is most likely that you are checking the 45th character in the text passed to OnPlayerText. Are you trying to see if the text is just simply in there? If so:
pawn Код:
if( strfind( text, "§", true ) != -1 )
{
   SendClientMessage( playerid, WHITE, "You can't use this language!" );
   return 0;
}
What exactly are you trying to accomplish? If you provide me with an answer to that question, along with your OnPlayerText callback, I may be able to assist you further.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)