Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: umar4911 on Nov 16, 2017, 01:24 PM

Title: Color player.Name
Post by: umar4911 on Nov 16, 2017, 01:24 PM
When I use player.Name in MessagePlayer, the name is shown in white. How to make it color using skin color
Title: Re: Color player.Name
Post by: D4rkR420R on Nov 16, 2017, 05:45 PM
https://forum.vc-mp.org/?topic=3834.msg28608#msg28608
You should get an idea from this.
Title: Re: Color player.Name
Post by: 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
Title: Re: Color player.Name
Post by: SAzEe21 on Nov 16, 2017, 07:07 PM
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 );
}
Title: Re: Color player.Name
Post by: D4rkR420R 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.
Title: Re: Color player.Name
Post by: umar4911 on Nov 18, 2017, 06:55 AM
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
Title: Re: Color player.Name
Post by: umar4911 on Nov 18, 2017, 07:25 AM
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
Title: Re: Color player.Name
Post by: ! on Nov 18, 2017, 12:26 PM
Quote from: umar4911 on Nov 18, 2017, 07:25 AMerror
Post it here
Title: Re: Color player.Name
Post by: 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)
Title: Re: Color player.Name
Post by: 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?
Title: Re: Color player.Name
Post by: umar4911 on Nov 18, 2017, 01:16 PM
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
Title: Re: Color player.Name
Post by: ! 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);
Title: Re: Color player.Name
Post by: umar4911 on Nov 18, 2017, 01:57 PM
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
Title: Re: Color player.Name
Post by: umar4911 on Nov 21, 2017, 01:48 PM
I solved it my myself