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



Bug - JesusChrysler - 05.08.2015

Can someone tell/show me why this isn't working? It is repeating the message when I speak in-game.

Код HTML:
public OnPlayerText(playerid, text[])
{
	new string[132];
	if(PlayerInfo[playerid][pAccent] != 0)
	{
		format(string, sizeof(string), "[%s Accent] %s says: %s", PlayerInfo[playerid][pAccent], GetPlayerNameEx(playerid), text);
		Log("logs/chat.log", string);
		SetPlayerChatBubble(playerid, text, COLOR_WHITE, 20.0, 10000);
	    ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
		return 1;
    }
	format(string, sizeof(string), "%s says: %s", GetPlayerNameEx(playerid), text);
	Log("logs/chat.log", string);
	SetPlayerChatBubble(playerid, text, COLOR_WHITE, 20.0, 10000);
 	ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
}
For example, in-game it says:
[British Accent] John Walker says: Yo.
John Walker: Yo.

How do I make it so it doesn't repeat itself after?


Re: Bug - Jefff - 05.08.2015

return 0 instead of return 1


Re: Bug - SpikeSpigel - 05.08.2015

Код:
public OnPlayerText(playerid, text[])
{
	new string[132];
	if(PlayerInfo[playerid][pAccent] != 0)
	{
		format(string, sizeof(string), "[%s Accent] %s says: %s", PlayerInfo[playerid][pAccent], GetPlayerNameEx(playerid), text);
		Log("logs/chat.log", string);
		SetPlayerChatBubble(playerid, text, COLOR_WHITE, 20.0, 10000);
		ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
		return 1;
	}
	else
	{
		format(string, sizeof(string), "%s says: %s", GetPlayerNameEx(playerid), text);
		Log("logs/chat.log", string);
		SetPlayerChatBubble(playerid, text, COLOR_WHITE, 20.0, 10000);
		ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
	}
	return 1;
}
This is it, you had to put an ELSE betwen pAccent functions :P to trigger betwen 'em