How can I make people's names colorable in chat regarding to their current name color
#1

Tittle says it all, can someone show me an example on how to make it? Is there something that detects the color? I am new to scripting so I don't know too much.
Reply
#2

heres some link that will help u
https://sampwiki.blast.hk/wiki/GetPlayerColor
https://sampwiki.blast.hk/wiki/SetPlayerColor
Quote:

GetPlayerColor(playerid)
SetPlayerColor(playerid,color)

ex:
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid,0xFF0000FF);this will set player color to RED
return 1:
}
Quote:
pawn Код:
SendClientMessage(playerid, GetPlayerColor(playerid), "This message is in your color :)");
 
new output[144];
format(output, sizeof(output), "You can also use the player's color for {%06x}color embedding!", GetPlayerColor(playerid) >>> 8);
SendClientMessage(playerid, -1, output);
// will output the message in white, with ''color embedding'' in the player's color
Reply
#3

Quote:
Originally Posted by Quickie
Посмотреть сообщение
heres some link that will help u
https://sampwiki.blast.hk/wiki/GetPlayerColor
https://sampwiki.blast.hk/wiki/SetPlayerColor

ex:
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid,0xFF0000FF);this will set player color to RED
return 1:
}
So, I have to put {%06x}%s{FFFFFF}says %s", GetPlayerColor, sendername, text and then it's done?
Reply
#4

something like this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new pname[30],string[128];// declaring a variable which we can store our player name and formatted string
    GetPlayerName(playerid,pname,sizeof(pname));// getting the player name
    format(string,sizeof(string),"%s {FFFFFF}says :%s"pname,text);// formatting
    SendClientMessageToAll(GetPlayerColor(playerid),text);
    return 0;
}

CMD:say(playerid,params[])
{
    new pname[30],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s {FFFFFF}says %s",pname,params);
    SendClientMessageToAll(GetPlayerColor(playerid),string);
    return 1;
}
Reply
#5

Quote:
Originally Posted by Quickie
Посмотреть сообщение
something like this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new pname[30],string[128];// declaring a variable which we can store our player name and formatted string
    GetPlayerName(playerid,pname,sizeof(pname));// getting the player name
    format(string,sizeof(string),"%s {FFFFFF}says :%s"pname,text);// formatting
    SendClientMessageToAll(GetPlayerColor(playerid),text);
    return 0;
}

CMD:say(playerid,params[])
{
    new pname[30],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s {FFFFFF}says %s",pname,params);
    SendClientMessageToAll(GetPlayerColor(playerid),string);
    return 1;
}
Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)