[HELP]Player Chat Format
#1

Hey Guys I Want To Ask How to Make Player Chat Format Like (playername[id] : Text )

I Have a Script But The Problem Is Player Color In Chat Always White Why

pawn Код:
public OnPlayerText(playerid, text[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s[%i]: %s" ,pName,playerid,text);
printf(string);
SendClientMessageToAll(-1,string);
return 0;
}
Sorry For My Bad English
Reply
#2

Quote:
Originally Posted by ROXYhunter
Посмотреть сообщение
Hey Guys I Want To Ask How to Make Player Chat Format Like (playername[id] : Text )

I Have a Script But The Problem Is Player Color In Chat Always White Why

pawn Код:
public OnPlayerText(playerid, text[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s[%i]: %s" ,pName,playerid,text);
printf(string);
SendClientMessageToAll(-1,string);
return 0;
}
Sorry For My Bad English
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
name[MAX_PLAYER_NAME],string[265];
    
GetPlayerName(playerid,name,sizeof(name));
    
format(string,sizeof(string),"%s[%d]: {FFFFFF}%s",name,playerid,text);
    
SendClientMessageToAll(GetPlayerColor(playerid),string);
    
SetPlayerChatBubble(playeridtextRED100.08000);
    return 
0;

Reply
#3

You have to set a player's color first.

pawn Код:
public OnGameModeInit()
{
    SetPlayerColor(playerid, COLOR_RED); // Change to your preference
    return 1;
}
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYER_NAME], str[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s[%d]: {FFFFFF}%s", name, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 1;
}
Reply
#4

Quote:
Originally Posted by Affan
Посмотреть сообщение
You have to set a player's color first.

pawn Код:
public OnGameModeInit()
{
    SetPlayerColor(playerid, COLOR_RED); // Change to your preference
    return 1;
}
Can I Change it To Random Color ?
Reply
#5

Quote:
Originally Posted by ROXYhunter
Посмотреть сообщение
Can I Change it To Random Color ?
yup change to the color u want
Reply
#6

Use something like this:

pawn Код:
public OnPlayerText(playerid, text[])
{
new String[128];
GetPlayerName(playerid, String, sizeof(String));
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", String, playerid, text);
Message(String);
return 0;
}
Then define this public:

pawn Код:
forward Message(const string[]);
public Message(const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) SendClientMessage(i, GetPlayerColor(i), string);
}
return 1;
}
Good luck
Reply
#7

Quote:
Originally Posted by youssefehab500
Посмотреть сообщение
yup change to the color u want
i mean if player connect

id 0 = color red
id 1 = color blue
id 2 = color yelow
etc
Reply
#8

pawn Код:
public OnPlayerConnect(playerid)
{
    if (playerid == 0)
        SetPlayerColor(playerid, color);
    else if(playerid == 1)
        SetPlayerColor(playerid, color);
    return 1;
}
Reply
#9

SOLVED...... Thanks Affan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)