SA-MP Forums Archive
How can I make people's names colorable in chat regarding to their current name color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How can I make people's names colorable in chat regarding to their current name color (/showthread.php?tid=543662)



How can I make people's names colorable in chat regarding to their current name color - dionisak0s - 28.10.2014

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.


Re: How can I make people's names colorable in chat regarding to their current name color - Quickie - 28.10.2014

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



Re: How can I make people's names colorable in chat regarding to their current name color - dionisak0s - 28.10.2014

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?


Re: How can I make people's names colorable in chat regarding to their current name color - Quickie - 28.10.2014

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;
}



Re: How can I make people's names colorable in chat regarding to their current name color - dionisak0s - 28.10.2014

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.