SA-MP Forums Archive
str_replace help. - 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: str_replace help. (/showthread.php?tid=533993)



str_replace help. - CEDZIOR - 27.08.2014

I want make anti swear, who replace FUCK -> [site server]

Код:
#include <a_samp>
#include <strlib>

new ZakazaneSlowa[][] =
{
	{"Kurwa"},
	{"Dziwka"},
	{"Szmata"},
	{"Pedał"},
	{"Gej"},
	{"Lesbijka"},
	{"Jebany"},
	{"Kutas"},
	{"Chuj"},
	{"Pizda"},
	{"Cipa"},
	{"Ja pierdole"}
};

new ZakazaneSlowaNowe[][] =
{
	{"Zapraszam na www.server-pps.com"},
	{"Odziedziłeś naszą strone już? www.server-pps.com"},
	{"Jeżeli szukasz pomocy wpisz /help."},
	{"Listę wszystki komend znajdziesz pod /cmd."},
	{"Wszystkie teleporty są na /teles."},
	{"Wiesz że mamy TeamSpeaka serverowego? ts.server-pps.com"},
	{"Widzisz cheatera? Napisz /raport [id]."},
	{"To jest najlepszy server na świecie !"},
	{"Ooooo fajnie tutaj na serverze, zostanie dłużej."},
	{"Jak ja nie lubie przeklinać."},
	{"Wulgaryzmy to nie dla mnie."},
	{"A dodam sobie tag [PPS] do nicku bo fajny server."}
};

public OnPlayerText(playerid, text[])
{
	for(new i; i< sizeof(ZakazaneSlowa); i++)
	{
		if(strfind(text, ZakazaneSlowa[0],true) != -1)
		{
		 	new randMSG = random(sizeof(ZakazaneSlowaNowe));
			str_replace(text, ZakazaneSlowa[0], ZakazaneSlowaNowe[randMSG]);
			SendClientMessage(playerid, -1, "NUNU");
			//str_ireplace(str, ZakazaneSlowa, ZakazaneSlowaNowe[randMSG], &iCount = 0)
			//str_replace(text, ZakazaneSlowa,ZakazaneSlowaNowe[randMSG], _, strlen(text) + 1);
	 	}
	}
	return 0;
}
Not Error.