Color player.Name

Started by umar4911, Nov 16, 2017, 01:24 PM

Previous topic - Next topic

umar4911

When I use player.Name in MessagePlayer, the name is shown in white. How to make it color using skin color
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

D4rkR420R


umar4911

Quote from: KuRiMi on Nov 16, 2017, 05:45 PMhttps://forum.vc-mp.org/?topic=3834.msg28608#msg28608
You should get an idea from this.
this is accually addung class using on scrupt load which I dont want. A direct method I want to know. Cant be their a variable named player.name = player. Colour and and name. If then what would be the syntax
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

SAzEe21

#3
First create a new function like
function GetPlayerTeamColor( Color )
{
if ( Team == 0 )
return "[#00FF50]";
else if ( Team == 1 )
return "[#1E90FF]";
else if ( Team == 2 )
return "[#FFD700]";
else if ( Team == 3 )
return "[#FF0000]";
}
and set each team colors here like I did here

after that, use "+GetPlayerTeamColor( player.Color )+" inside MessagePlayer

try this for example

if ( cmd == "color" )
{
MessagePlayer("Your team color is, "+GetPlayerTeamColor( player.Color ), player );
}

D4rkR420R

Quote from: umar4911 on Nov 16, 2017, 05:57 PM
Quote from: KuRiMi on Nov 16, 2017, 05:45 PMhttps://forum.vc-mp.org/?topic=3834.msg28608#msg28608
You should get an idea from this.
this is accually addung class using on scrupt load which I dont want. A direct method I want to know. Cant be their a variable named player.name = player. Colour and and name. If then what would be the syntax

Are you blind? The one who made that topic literally is asking thing you are.

umar4911

Quote from: KuRiMi on Nov 16, 2017, 10:46 PM
Quote from: umar4911 on Nov 16, 2017, 05:57 PM
Quote from: KuRiMi on Nov 16, 2017, 05:45 PMhttps://forum.vc-mp.org/?topic=3834.msg28608#msg28608
You should get an idea from this.
this is accually addung class using on scrupt load which I dont want. A direct method I want to know. Cant be their a variable named player.name = player. Colour and and name. If then what would be the syntax

Are you blind? The one who made that topic literally is asking thing you are.
You did not understand. My colours come in chat but not when using command example /mute player. Message comes Admin muted player. I want that the "player" colour should be changed to player colour
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

umar4911

I made a code
local plrName = playernamecolorshow(plr, plr.Team) + plr.Name + "[#FFFFFF]";
local playerName = playernamecolorshow(player, player.Team) + player.Name + "[#FFFFFF]";
the playerName worked but plrName gives error
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

!


Discord: zeus#5155

umar4911

#8
Quote from: zeus on Nov 18, 2017, 12:26 PM
Quote from: umar4911 on Nov 18, 2017, 07:25 AMerror
Post it here
The index plr does not exist

then I used if(!plr) but still not

Off topic: 100 post 8)
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

NicusorN5

Quote from: umar4911 on Nov 18, 2017, 12:47 PM
Quote from: zeus on Nov 18, 2017, 12:26 PM
Quote from: umar4911 on Nov 18, 2017, 07:25 AMerror
Post it here
The index plr does not exist

then I used if(!plr) but still not

Off topic: 100 post 8)
Have you declared the plr variable?

umar4911

Quote from: NicusorN5 on Nov 18, 2017, 12:55 PM
Quote from: umar4911 on Nov 18, 2017, 12:47 PM
Quote from: zeus on Nov 18, 2017, 12:26 PM
Quote from: umar4911 on Nov 18, 2017, 07:25 AMerror
Post it here
The index plr does not exist

then I used if(!plr) but still not

Off topic: 100 post 8)
Have you declared the plr variable?
I used local plr = 0
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

!

Quote from: umar4911 on Nov 18, 2017, 07:25 AMI made a code
local plrName = playernamecolorshow(plr, plr.Team) + plr.Name + "[#FFFFFF]";
local playerName = playernamecolorshow(player, player.Team) + player.Name + "[#FFFFFF]";
the playerName worked but plrName gives error
Quote from: umar4911 on Nov 18, 2017, 01:16 PMI used local plr = 0
You have set the index plr to integer and tried to get an instance value plr.Team
Use
local plr = player;
if it doesn't solve your problem use
local plr = FindPlayer(0);

Discord: zeus#5155

umar4911

Quote from: zeus on Nov 18, 2017, 01:40 PM
Quote from: umar4911 on Nov 18, 2017, 07:25 AMI made a code
local plrName = playernamecolorshow(plr, plr.Team) + plr.Name + "[#FFFFFF]";
local playerName = playernamecolorshow(player, player.Team) + player.Name + "[#FFFFFF]";
the playerName worked but plrName gives error
Quote from: umar4911 on Nov 18, 2017, 01:16 PMI used local plr = 0
You have set the index plr to integer and tried to get an instance value plr.Team
Use
local plr = player;
if it doesn't solve your problem use
local plr = FindPlayer(0);
Actually I have local plr in many other cmds and both didnot work
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

umar4911

I solved it my myself
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter