Forbidden Words - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Forbidden Words (
/showthread.php?tid=240043)
Forbidden Words -
wheelman_WM - 15.03.2011
Hey I want the code which i can add to my GM
When player say fuck it will be converted to someother text
Exampe
Player : Shit Server
Change to : I love this server
Re: Forbidden Words - rjjj - 15.03.2011
I did an example for you

.
It will change the word "tool" in the player's text to the word "best".
Look to the comments
pawn Код:
public OnPlayerText(playerid, text[])
{
for(new x = 0; x <= strlen(text); ++x)
{
if(text[(x)]=='t' && text[(x+1)]=='o' && text[(x+2)]=='o' && text[(x+3)]=='l') //Look that "if" checks if the character is part of the word that you choose, and if it is really the word.
{
text[(x)] = 'b';
text[(x+1)] = 'e';
text[(x+2)] = 's';
text[(x+3)] = 't'; //It will change "tool" for "best"
}
}
return 1;
}
There are another maneers to do this too.
I hope that i have helped