OnPlayerText [HELP]
#1

Hey guy's erm i was working on a script with OnPlayerText & if the player swears for this example its "fuck you"


heres my code



Код:
public OnPlayerText(playerid, text[])
{
  if (strfind(text, "fuck you") != -1)
  {
   new string[80], name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, sizeof(name));
   format(string, sizeof(string), "%s! Has been muted for 5 seconds for flaming.", name);
   SendClientMessageToAll(0xFFFF00FF,string);
    

  }
	return 1;
}
So how can i make this mute the player if he says fuck you?

Reply if ya can help thanks.
Reply
#2

In this way, it's slower and longer.
Create a multidimensional array and put all words that are disabled in it.
Then use a loop to check if it's in there.
So if use PVar to set muted to 1.
Then under OnPlayerText
if muted == 1 then return 0;

Understand the point of it?
So actually return 0; it to let him mute.
Reply
#3

Use a variable.
Reply
#4

Quote:
Originally Posted by » RyDeR «
In this way, it's slower and longer.
Create a multidimensional array and put all words that are disabled in it.
Then use a loop to check if it's in there.
So if use PVar to set muted to 1.
Then under OnPlayerText
if muted == 1 then return 0;

Understand the point of it?
So actually return 0; it to let him mute.
Sorry i'm a begginer i have no idea what you mean i'm trying to do it this way.

But maybe a example?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)