Double text issues
#1

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.
Reply
#2

Do you want to leave the chat by default or the two chats separately for example using "!"?
Reply
#3

Change first return 1; to return 0; to prevent double msgs
Reply
#4

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;
}
Reply
#5

Put the last return to return 0;

So return 1; should be return 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)