OnPlayerText
#1

Hello, I wonder how to put so kind when talking in chat:

• [ID] Nick text

until now I could not always .. when I put looks like this:

Nick: [ID] Nick: text

That is wrong, does anyone know by the way I asked first?
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    new Text[144],name[64];
    GetPlayerName(playerid,name,sizeof(name));
    format(Text, sizeof (Text), "[%d] %s: %s", playerid,name, text);
    SendClientMessageToAll(-1, Text);
    return 0; // this should be return 0;
}
Reply
#3

Quote:
Originally Posted by Rittik
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    new Text[144],name[64];
    format(Text, sizeof (Text), "[%d] %s: %s", playerid,name, text);
    SendPlayerMessageToAll(playerid, Text);
    return 0; // this should be return 0;
}
^ You forgot to get the name of the player.
pawn Код:
GetPlayerName(playerid, name, sizeof(name));
And why are you using 64 cells for the name? "name[64];"

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[144], name[MAX_PLAYER_NAME + 1], playercolor = GetPlayerColor(playerid);
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[%d] %s: %s", playerid, name, text);
    SendClientMessageToAll(playercolor, string);
    return 0;
}
Reply
#4

@Sick: I was editing at the moment for GetPlayerName.
Reply
#5

Your problem is "return 1;"
It must be "return 0;" so the original text won't be shown
Reply
#6

Sick Attack works but all the text was black, everything was black on the line .. D:
Reply
#7

Quote:
Originally Posted by Ts3
Посмотреть сообщение
Sick Attack works but all the text was black, everything was black on the line .. D:
GetPlayerColor returns 0 (which is colour black) if it hasn't set the player's colour before.

@SickAttack: He had used SendPlayerMessageToAll which sends the name with the player's colour itself.
Reply
#8

But not only the color and the text of the player is also getting black .. would like to stay just the id and nick black white text, and after that would see how to set the color of the player .. If I'm wrong ententend, sorry I'm new at this .. '-'
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)