[HELP] show id in chat
#1

Hi all you tell me how do you put the id in chat

Reply
#2

It's no doubt that I will be corrected. But what the heck

pawn Код:
for(new i = 1; i < MAX_CHAT_LINES-1; i++)
    Chat[i] = Chat[i+1];
    new ChatSTR[128];
    GetPlayerName(playerid,ChatSTR,sizeof(ChatSTR));
    format(ChatSTR,128,"[CHAT]%s: %s",ChatSTR, text[0]);
    Chat[MAX_CHAT_LINES-1] = ChatSTR;
    return 1;
}
Reply
#3

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
It's no doubt that I will be corrected. But what the heck

pawn Код:
for(new i = 1; i < MAX_CHAT_LINES-1; i++)
    Chat[i] = Chat[i+1];
    new ChatSTR[128];
    GetPlayerName(playerid,ChatSTR,sizeof(ChatSTR));
    format(ChatSTR,128,"[CHAT]%s: %s",ChatSTR, text[0]);
    Chat[MAX_CHAT_LINES-1] = ChatSTR;
    return 1;
}
What is this? i dont even...

pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new string[128];
            new temp[48];
            GetPlayerName(playerid, temp, sizeof(temp));
            format(string, sizeof(string), "%s (%i) says:{FFFFFF} %s", temp, playerid, text);
            SendClientMessage(i, 0xFFFF00AA, string);
        }
    }
    return 0;
}
Reply
#4

pawn Код:
public OnPlayerText(playerid,text[])
{

    new textstring[128];
    format(textstring, sizeof(textstring), "[%i] %s", playerid, text);
    SendPlayerMessageToAll(playerid, textstring);
    return 0;
}
Or this
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], name[24];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s: {FFFFFF}(%d) %s", name, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    return 0;
}
Reply
#6

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
What is this? i dont even...

pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new string[128];
            new temp[48];
            GetPlayerName(playerid, temp, sizeof(temp));
            format(string, sizeof(string), "%s (%i) says:{FFFFFF} %s", temp, playerid, text);
            SendClientMessage(i, 0xFFFF00AA, string);
        }
    }
    return 0;
}
A shorter and more efficient version would be CyberGhost's.
There is no need to:
a) declare 2 strings and format them for once for every connected player.
b) Use a loop for a function that has an alternative for All Players (SendClientMessageToAll)
c) Use IsPlayerConnected. You can assume that they have to be connected to text, and SendClientMessageToAll already includes this in its internal workings.

Just some tips.
Reply
#7

If I may add to that, using ColdIce's last post would send the message in the color of the player.

Example:

1 ColdIce.

Tee: Hello, how are you?

2. CyberGhosts

Tee: Hello, how are you?

Look good it's there ^
Reply
#8

thanks all
Reply
#9

solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)