Chat text is not working - Help needed -
Mowgli - 20.06.2009
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
Re: Chat text is not working - Help needed -
Grim_ - 20.06.2009
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;
}
Re: Chat text is not working - Help needed -
Correlli - 20.06.2009
@Swift_: %i stands for the same thing as %d.
Re: Chat text is not working - Help needed -
Grim_ - 20.06.2009
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;
Re: Chat text is not working - Help needed -
Joe Staff - 20.06.2009
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:
Re: Chat text is not working - Help needed -
Correlli - 20.06.2009
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.
Re: Chat text is not working - Help needed -
Mowgli - 20.06.2009
how do i make it so there is no color for 'Sendclientmessagetoall' ??
Re: Chat text is not working - Help needed -
Correlli - 20.06.2009
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.
Re: Chat text is not working - Help needed -
Joe Staff - 20.06.2009
My method will look like
Re: Chat text is not working - Help needed -
Mowgli - 20.06.2009
yes but were it says
Sendclientmessagetoall(color,blah(
wat do i have on color, if i dont want it to be any color?