• HUD Development Issues
    2 replies, posted
Hello, I have made my HUD to show the current ULX Group that the player is in, but i would also like to be able to change 1. The color of the rank when it shows and 2. The wording/Capitilization This is ONLY the rank code. [CODE] local Rank = (ply.GetUserGroup and ply:GetUserGroup()) --ULX newx, newy = draw.SimpleText( "Rank: "..Rank, "FONT", spacer + 125, 7, Color(100,100,255), 0 ) E_Rect( (spacer + newx) - 17, 6, 20, 20, iconcolor, shield ) spacer = (spacer + newx) + 50 [/CODE] Here is what im looking for: [CODE] //For the Usergroup colors im looking for how to do this UsergroupColors = { superadmin = "rainbow", admin = Color(255, 55, 55) } //The user group styling something the same UsergroupsStyle = { superadmin = "Owner", admin = "Admin" } [/CODE] All help is greatly appreciated, this is what it looks like right now [url]https://gyazo.com/b6fd7225eb64c17b4b9f02b450a8b2ce[/url]
For capitalizing the first character a table would be faster but if you don't want a table you can do "[URL="http://wiki.garrysmod.com/page/string/upper"]string.upper[/URL]([URL="http://wiki.garrysmod.com/page/string/sub"]string.sub[/URL](rank, 1, 1)) .. [URL="http://wiki.garrysmod.com/page/string/sub"]string.sub[/URL](rank, 2)". [code]function string.TylerWearing(self) return (self:gsub("[^ ]+", function(word) return word:sub(1, 1):upper() .. word:sub(2) end)) end print(string.TylerWearing("nyello there friendo")) -- Output: Nyello There Friendo [/code]
[QUOTE=txike;52882493]For capitalizing the first character a table would be faster but if you don't want a table you can do "[URL="http://wiki.garrysmod.com/page/string/upper"]string.upper[/URL]([URL="http://wiki.garrysmod.com/page/string/sub"]string.sub[/URL](rank, 1, 1)) .. [URL="http://wiki.garrysmod.com/page/string/sub"]string.sub[/URL](rank, 2)". [code]function string.TylerWearing(self) return (self:gsub("[^ ]+", function(word) return word:sub(1, 1):upper() .. word:sub(2) end)) end print(string.TylerWearing("nyello there friendo")) -- Output: Nyello There Friendo [/code][/QUOTE] He said he did want a table. You would just do UsergroupsStyle[ply:GetUserGroup()] etc.
Sorry, you need to Log In to post a reply to this thread.