Chat text is not working - Help needed
#1

i got this code:

Код:
	if (PlayerInfo[playerid][pReborn] == 0)
	{
  		new sendername[MAX_PLAYER_NAME];
  		new string[128];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "%s [%d]: %s", sendername,playerid, text);
		SendPlayerMessageToAll(playerid, string);
	}
but then it comes out as....

Код:
Mowgli: Mowgli[0]: test
so all of '%s [%d]: %s' is what i am saying... how do i fix this? so its

Код:
Mowgli[0]: test
Reply
#2

pawn Код:
if(PlayerInfo[playerid][pReborn] == 0)
{
  new sendername[MAX_PLAYER_NAME], string[128];
  GetPlayerName(playerid, sendername, sizeof sendername);
  format(string, sizeof strin, "%s [%i]: %s", sendername, playerid, text);
  SendClientMessageToAll(colorhere, string);
  return 0;
}
Reply
#3

@Swift_: %i stands for the same thing as %d.
Reply
#4

I know, I just like using it instead for playerid. /habit?
But I added his problems in, which were he was using "SendPlayerMessage"? and he didn't return 0;
Reply
#5

I prefer to have this script:
pawn Код:
public OnPlayerText(playerid,text[])
{
    new string[2][MAX_PLAYER_NAME];
    GetPlayerName(playerid,string[0],sizeof(string[]));
    GetPlayerName(playerid,string[1],sizeof(string[]));
    format(string[0],sizeof(string[]),"[%d]%s",playerid,string[0]);
    SetPlayerName(playerid,string[0]);
    SendPlayerMessageToAll(playerid,text);
    SetPlayerName(playerid,string[1]);
    return 0;
}
That way the player can have 2 lines of text without it getting cut off AND the text is white while keeping the player name it's normal color.

Ex:
Reply
#6

Quote:
Originally Posted by Swift_
I know, I just like using it instead for playerid. /habit?
But I added his problems in, which were he was using "SendPlayerMessage"? and he didn't return 0;
Ah sorry, didn't saw that he was using SendPlayerMessageToAll function.
Reply
#7

how do i make it so there is no color for 'Sendclientmessagetoall' ??
Reply
#8

Quote:
Originally Posted by Mowgli
how do i make it so there is no color for 'Sendclientmessagetoall' ??
What do you mean by that?


You need to add in which color the text will be displayed.
Reply
#9

My method will look like
Reply
#10

yes but were it says

Sendclientmessagetoall(color,blah(

wat do i have on color, if i dont want it to be any color?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)