Chat problem! +Rep
#1

Hello fellas, so I have this under OnPlayerText (removing the underscores from players names) -

Код:
new string[128];
    format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
    NearMessageSender(playerid, 8, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
Its alright, but the problem is that its showing both chats, the "global" one and the one its under OnPlayerText (above)

Ex: Im typing "test" and it shows -

Fname Lname: test (once with name colour)
Fname Lname: test (twice with white colour which is COLOR_FADE2)

I made this before and it wasnt like that, but I've forgotten many things... anyway, everyone who tries to help will be greatly Reputated!
Reply
#2

Are you returning a value so that it doesn't continue through the whole OnPlayerText function?
Reply
#3

Whole OnPlayerText

Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
    NearMessageSender(playerid, 8, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	
    new textv2[128];
    if(IsMasked[playerid] == true)
	{
    format(textv2, sizeof (textv2), "Stranger says: %s",text);
    NearMessageSender(playerid, 8, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	return 0;
	}
	else
	if(IsMasked[playerid] == false)
	{
	return 1;
	}
 	return 1;
}
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
    NearMessageSender(playerid, 8, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
   
    new textv2[128];
    if(IsMasked[playerid] == true)
    {
    format(textv2, sizeof (textv2), "Stranger says: %s",text);
    NearMessageSender(playerid, 8, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
    return 1;
    }
    else
    if(IsMasked[playerid] == false)
    {
    return 1;
    }
    return 1;
}
Reply
#5

Nevermind, fixed it myself, thanks Divergent for reminding me about the return I've forgotten to add lol, and Clad for trying to help, both +Repped, thank you !

Код:
new string[128];
if(!IsMasked[playerid] == true)
{
format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
NearMessageSender(playerid, 8, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
return 0;
}
Reply
#6

return 0; because you're modifiying the actual OnPlayerText.
Reply
#7

Quote:
Originally Posted by Dizzle
Посмотреть сообщение
Nevermind, fixed it myself, thanks Divergent for reminding me about the return I've forgotten to add lol, and Clad for trying to help, both +Repped, thank you !

Код:
new string[128];
if(!IsMasked[playerid] == true)
{
format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
NearMessageSender(playerid, 8, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
return 0;
}
No problem thanks for the rep man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)