Anti Swear - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti Swear (
/showthread.php?tid=324706)
Anti Swear -
BaubaS - 10.03.2012
hello. I've used RyDeR's function to make antiswear for cmds. It works for text but not for commands :S It should work for commands like this: Player A writes: /adminchat FUCK, and the text will be ****. Doesnt work, it doesnt gets replaced.
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!iSpawned[playerid])
{
return ShowInfoBox(playerid, "~w~Jus dar ~r~negalite ~w~rasyti, pirmiausia prisijunkite!"), 0;
}
if (iCommandSpam[playerid] + 1000 > GetTickCount() && iCommandSpam[playerid] > 0)
{
return ShowInfoBox(playerid, "~w~Pries naudojant komanda vel, palaukite ~g~sekunde!"), 0;
}
iCommandSpam[playerid] = GetTickCount();
ChangeSwear(cmdtext);
return true;
}
pawn Код:
stock ChangeSwear(Text[], Symbol = '*')
{
new iWords = sizeof(BadWords), i;
for (new BadWord; BadWord != iWords; ++BadWord)
{
while ((i = strfind(Text, BadWords[BadWord], true)) != -1)
{
for (new x = (i + strlen(BadWords[BadWord])); i != x; ++i)
{
Text[i] = Symbol;
}
}
}
return true;
}
Re: Anti Swear -
Calgon - 10.03.2012
cmdtext in zcmd is only passed for reference - you can't change the value of it there.
If you look in zcmd's include code, you can probably paste the code in OnPlayerCommandText to replace the swear words in there.
Re: Anti Swear -
BaubaS - 10.03.2012
Thank you, I'll try that