over nick the player id
#1

How to make PlayerID near player nick in chat?
Reply
#2

Help me!
Reply
#3

SendPlayerMessage I believe.
Reply
#4

pawn Код:
new
                szStr[128],
                szPName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, szPName, MAX_PLAYER_NAME);
            format(szStr, sizeof(szStr), "{4169FF}%s:{FFFFFF} %s", szPName, text[0]);

            for(new i; i < MAX_PLAYERS; i++)//if you use foreach use that, if you don't - then you should start.
                if(IsPlayerConnected(i))
                    SendClientMessageToAll(COLOR_WHITE,szStr);
under OnPlayerText

EDIT: forgot, u can now choose what should be displayed by changeing whatever u want...

f.e
pawn Код:
format(szStr, sizeof(szStr), "{4169FF}%s(%i):{FFFFFF} %s", szPName, playerid,text[0]);
Reply
#5

Thanks
Reply
#6

Quote:
Originally Posted by knackworst
Посмотреть сообщение
pawn Код:
new
                szStr[128],
                szPName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, szPName, MAX_PLAYER_NAME);
            format(szStr, sizeof(szStr), "{4169FF}%s:{FFFFFF} %s", szPName, text[0]);

            for(new i; i < MAX_PLAYERS; i++)//if you use foreach use that, if you don't - then you should start.
                if(IsPlayerConnected(i))
                    SendClientMessageToAll(COLOR_WHITE,szStr);
Your code will send a message to all players each time it finds a connected player causing the chat to be flooded.

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

    new
        cString[128],
        pName[MAX_PLAYER_NAME]
    ;
   
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    format(cString, sizeof(cString), "%s(%d): %s", pName, playerid, text);
    SendClientMessageToAll(-1, cString);
   
    return 0;
}
Reply
#7

I don't believe so, it's copied from my GM, where it works...
Reply
#8

It works, but how do the player's nick color is not white?
Reply
#9

Quote:
Originally Posted by knackworst
Посмотреть сообщение
I don't believe so, it's copied from my GM, where it works...
Have you tested your GM with more than one person on it?

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

    new
        cString[128],
        pName[MAX_PLAYER_NAME]
    ;
   
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    format(cString, sizeof(cString), "%s(%d){FFFFFF}: %s", pName, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), cString);
   
    return 0;
}
Please follow THIS to get it working correctly.
Reply
#10

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

    new
        cString[128],
        pName[MAX_PLAYER_NAME]
    ;
   
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    format(cString, sizeof(cString), "%s(%d): {FFFFFF}%s", pName, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), cString);
   
    return 0;
}
to get the real chat effect...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)