Disabling the OnPlayerText Through Include? -
ScriptJorkis - 12.01.2012
i'm making a include called "Badword" but accidentally i cannot disable my format text onplayertext which is return 0;
i try to add return 0; in the include code but nothing happens it show like
Код:
ScriptJorkis: [0] Test
The word Bitch has been replace with Anti-badword Replacement
ScriptJorkis: [0] Bitch
how can i fix this problem?
Re: Disabling the OnPlayerText Through Include? -
Mikkel_Pedersen - 12.01.2012
Show some of your code in OnPlayerText which is related to the word censoring
Re: Disabling the OnPlayerText Through Include? -
ScriptJorkis - 12.01.2012
pawn Код:
public OnPlayerText(playerid, text[])
{
  new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  if(GetPVarInt(playerid, "Muted") == 1)
  {
    SendClientMessage(playerid,COLOR_RED, "You cant talk while on Class Selection");
    return 0;
  }
  else if(GetPVarInt(playerid, "Muted") == 0)
  {
    format(text, 1024, "%s: {FFFFFF}[%d] {FFFFFF}%s", PlayerName, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), text);
    return 0;
  }
  ChatLog(playerid, text);
  CreateBadword("Bitch");
  return 0;
}
Re: Disabling the OnPlayerText Through Include? -
[HiC]TheKiller - 12.01.2012
pawn Код:
new badwords[][] =
{
  "Bitch",
  "Whore",
  "Fuck"
};
public OnPlayerText(playerid, text[])
{
 Â
  for (new loop; loop < sizeof(badwords); loop ++)
  {
    new sfind = strfind(text, badwords[loop], true);
    if(sfind == -1) continue;
    while(text[sfind ] != 0 || text[sfind ] != ' ') text[sfind] = '*';
  }
  new PlayerName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  if(GetPVarInt(playerid, "Muted") == 1)
  {
    SendClientMessage(playerid,COLOR_RED, "You cant talk while on Class Selection");
    return 0;
  }
  else if(GetPVarInt(playerid, "Muted") == 0)
  {
    format(text, 1024, "%s: {FFFFFF}[%d] {FFFFFF}%s", PlayerName, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), text);
    return 0;
  }
  return 1;
}
Was a rough idea that I just put together
.
Re: Disabling the OnPlayerText Through Include? -
ScriptJorkis - 12.01.2012
lol i don't want when i type bitch it would became ****.
want to see my include here you go just come of the codes not the full version
pawn Код:
stock CreateBadword(text[])
{
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
  if(IsPlayerConnected(i))
  {
      new string[1052],pname[MAX_PLAYER_NAME];
      new RandomReplace = random(4);
      GetPlayerName(i, pname, sizeof(pname));
      switch(RandomReplace)
      {
        case 0:
        {
          format(string,sizeof(string), "%s: "WHITE"[%d] i love to say badword but i'm so stupid and forgetful", pname, i);
          SendClientMessageToAll(GetPlayerColor(i),string);
        }
        case 1:
        {
          format(string,sizeof(string), "%s: "WHITE"[%d] i'm so stupid i forget that swearing is not good", pname, i);
          SendClientMessageToAll(GetPlayerColor(i),string);
        }
        case 2:
        {
          format(string,sizeof(string), "%s: "WHITE"[%d] i love you guys as i want to say today", pname, i);
          SendClientMessageToAll(GetPlayerColor(i),string);
        }
        case 3:
        {
          format(string,sizeof(string), "%s: "WHITE"[%d] today is the good day no agruments between my playmate", pname, i);      Â
          SendClientMessageToAll(GetPlayerColor(i),string);
        }
      }
      format(string,sizeof(string), "The word %s has been replace with Antibadword Replacement", text);
      SendClientMessage(i,GetPlayerColor(i),string);
    }
   }
   return 1;
}
Re: Disabling the OnPlayerText Through Include? -
Face9000 - 12.01.2012
Simple as fast:
pawn Код:
new BadWords[][] =
{
  "Motherfucker",
  "Nigga",
  "Nigger",
  "Asshole",
  "Bitch",
  "Cunt",
  "Fuckin bastard",
  "Stupid bitch",
  "fuckin nigga!",
  "hijo de puta",
  "puta",
  "/q",
  " /q",
  "/q for free money"
};
OnPlayerText:
pawn Код:
for(new a; a<sizeof(BadWords); a++)
{
  if(strfind(text, BadWords[a], true) != -1)
  {
    return 0;
   }
}