SA-MP Forums Archive
OnPlayerText (HELP PLEASE) - 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: OnPlayerText (HELP PLEASE) (/showthread.php?tid=156516)



OnPlayerText (HELP PLEASE) - shitstain12 - 23.06.2010

i want to make a script so if someone says a bad word in a sentence it changes it to "****"
so if a person says "hello all you fuckers" it changes it to "hello all you *******"
how can i do this?


Re: OnPlayerText (HELP PLEASE) - bigcomfycouch - 23.06.2010

Код:
new BadWords[][] = {
	"shit",
	"fuck"
	//etc.
};
in onplayertext

Код:
new placeholder;
for(new i = 0; i < sizeof BadWords; i++)
{
	placeholder = strfind(text, BadWords[i], true);
	if(placeholder != -1)
	{
		for(new x = placeholder; x < placeholder + strlen(BadWords[i]); x++)
		{
			text[x] = '*';
		}
	}
}
untested


Re: OnPlayerText (HELP PLEASE) - shitstain12 - 23.06.2010

thanks works well