Double text issues - 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: Double text issues (
/showthread.php?tid=623324)
Double text issues -
SsHady - 30.11.2016
Hey!,
So, We basically tried to add the gang tag before every chat msg of a person who's in a gang, but it somehows sends 2 messages, at once one with and one without the tag. Here's my piece of code.
Код:
public OnPlayerText(playerid, text[])
{
new i = Player[playerid][PlayerGang];
if(i != -1)
{
new nameS[MAX_PLAYER_NAME], string2[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, nameS, sizeof(nameS));
format(string2, sizeof(string2), "[%s] %s: %s", Gang[i][GangTag],GetName(playerid),text);
SendClientMessageToAll(0xC4C4C4FF, string2);
return 1;
}
return 1;
}
And here's how it looks.
Any know-how on how to fix this?
Any help will be appreciated, thanks.
Re: Double text issues -
BrianFaria - 30.11.2016
Do you want to leave the chat by default or the two chats separately for example using "!"?
Re: Double text issues -
Jefff - 30.11.2016
Change first return 1; to return 0; to prevent double msgs
Re: Double text issues -
SoFahim - 30.11.2016
Use
Код:
public OnPlayerText(playerid, text[])
{
new i = Player[playerid][PlayerGang];
if(i != -1)
{
new nameS[MAX_PLAYER_NAME], string2[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, nameS, sizeof(nameS));
format(string2, sizeof(string2), "[%s] %s: %s", Gang[i][GangTag],GetName(playerid),text);
SendClientMessageToAll(0xC4C4C4FF, string2);
return 1;
}
return 0;
}
Re: Double text issues -
aoky - 30.11.2016
Put the last return to return 0;
So return 1; should be return 0;