Hello, Im trying to add ranks to display on the scoreboard. So i started to recode the scoreboard and am starting to use the VIP Rank or Group. So i made it display a Silkicon on those who are VIP but it just makes the icon visible to all players. Meaning all players have the icon turned on.
Someone help, Thanks in Advance.
[lua] self.lblVIP:SetImage("gui/silkicons/star")
if self.Player:GetNWString("VIP") then
self.lblVIP:SetVisible(true)
elseif not self.Player:GetNWString("VIP") then
self.lblVIP:SetVisible(false)
end
[/lua]
Someone who hasn't read the Lua tutorial good enough once again... You are doing this:
[lua]self.Player:GetNWString("VIP")[/lua]
That tells Lua to call the function GetNWString with the argument "VIP" which returns the value of "VIP". However, since a string is always 'true' in Lua, this expression will always return true. You want the following:
[lua]if ( self.Player:GetNWBool( "VIP", false ) ) then[/lua]
This checks if "VIP" is true and if it is not set yet, takes it as false.
Did not work..... Still enabled all stars >_>
You still have to set it invisible if it's false, stukie.
You could do:
[lua]self.lblVIP:SetVisible( self.Player:GetNWBool( "VIP", false ) )[/lua]
Makes it a bit less easy to read, but saves some extra lines.
Sorry, you need to Log In to post a reply to this thread.