So i have been getting many problems and setbacks with my scoreboard on Trouble in terrorist town, what im trying to do is make my name the same colour as the rank, then also move the actual rank over to the left by quite a bit now im new at lua coding so i will need well explained comments because like i said im not that familiar with this :s, i'll post a picture showing what i mean, also i have looked around for help on multiple wiki's and support forums, and no one has been able to help me. Now i got banned for posting this under the gmod section because i didnt realize the small faded out sticky saying dont post help here, (could of moved my thread or warned me) :) but anyways here is my sb_row.lua and sb_main.lua along with what im trying to accomplish
sb_row.lua - [url]http://pastebin.com/6carTVp2[/url]
sb_main.lua - [url]http://pastebin.com/L8bHAasF[/url]
Please help me fix this, i have been trying to find fixes for days now.
[IMG]http://i39.tinypic.com/23mstts.png[/IMG]
-snip-
Not sure if im even allowed to post external links but here:
[url]http://omgili.com/thread/jHIAmI4hxg.XYMElmOfZIpg.zB_zq.VobPY4NyKuZfYufSQRcTZBnThLKnOUdrmQ6l8Llz3MTHV.wt_5eQ6qiQ--/[/url]
I will give you my script for the scoreboard name colours and its pretty easy to change the colours too!
[code] if SERVER then
AddCSLuaFile("scoreboardcolours.lua")
end
function colourName( ply )
if ply:IsUserGroup("owner") then
local time = CurTime() // this is just so we don't invoke 3 times
local r = math.abs(math.sin(time * 2) * 255);
local g = math.abs(math.sin(time * 2 + 2) * 255);
local b = math.abs(math.sin(time * 2 + 4) * 255);
return Color(r,g,b)
elseif ply:IsUserGroup("superadmin") then
return Color(255, 0, 0)
elseif ply:IsUserGroup("admin") then
return Color(0, 100, 255)
elseif ply:IsUserGroup("mod") then
return Color(255, 197, 4)
elseif ply:IsUserGroup("donator") then
return Color(255, 4, 164)
elseif ply:IsUserGroup("known") then
return Color(100, 255, 0)
elseif ply:IsUserGroup("admin donator") then
return Color(150, 100, 255)
elseif ply:IsUserGroup("mod donator") then
return Color(148, 23, 243)
elseif ply:IsUserGroup("retired staff") then
return Color(50, 150, 152)
elseif ply:IsUserGroup("jr.admin") then
return Color(31, 123, 53)
elseif ply:IsUserGroup("head admin") then
return Color(148, 23, 243)
elseif ply:IsUserGroup("admin mega donator") then
return Color(169, 182, 201)
elseif ply:IsUserGroup("mod mega donator") then
return Color(207, 199, 155)
elseif ply:IsUserGroup("mega donator") then
return Color(166, 166, 166)
elseif ply:IsUserGroup("advisor") then
return Color(203, 31, 157)
elseif ply:IsUserGroup("Electrified Admin") then
return Color(0, 0, 153)
end
end
hook.Add("TTTScoreboardColorForPlayer", "Colour Scoreboard Names", colourName)
[/code]
Edit for your own pleasure. Make a new file in lua/autorun called scoreboardcolours.lua .
How many ranks do you need?
[QUOTE=Sm63;43292418]I will give you my script for the scoreboard name colours and its pretty easy to change the colours too!
[code] if SERVER then
AddCSLuaFile("scoreboardcolours.lua")
end
function colourName( ply )
if ply:IsUserGroup("owner") then
local time = CurTime() // this is just so we don't invoke 3 times
local r = math.abs(math.sin(time * 2) * 255);
local g = math.abs(math.sin(time * 2 + 2) * 255);
local b = math.abs(math.sin(time * 2 + 4) * 255);
return Color(r,g,b)
elseif ply:IsUserGroup("superadmin") then
return Color(255, 0, 0)
elseif ply:IsUserGroup("admin") then
return Color(0, 100, 255)
elseif ply:IsUserGroup("mod") then
return Color(255, 197, 4)
elseif ply:IsUserGroup("donator") then
return Color(255, 4, 164)
elseif ply:IsUserGroup("known") then
return Color(100, 255, 0)
elseif ply:IsUserGroup("admin donator") then
return Color(150, 100, 255)
elseif ply:IsUserGroup("mod donator") then
return Color(148, 23, 243)
elseif ply:IsUserGroup("retired staff") then
return Color(50, 150, 152)
elseif ply:IsUserGroup("jr.admin") then
return Color(31, 123, 53)
elseif ply:IsUserGroup("head admin") then
return Color(148, 23, 243)
elseif ply:IsUserGroup("admin mega donator") then
return Color(169, 182, 201)
elseif ply:IsUserGroup("mod mega donator") then
return Color(207, 199, 155)
elseif ply:IsUserGroup("mega donator") then
return Color(166, 166, 166)
elseif ply:IsUserGroup("advisor") then
return Color(203, 31, 157)
elseif ply:IsUserGroup("Electrified Admin") then
return Color(0, 0, 153)
end
end
hook.Add("TTTScoreboardColorForPlayer", "Colour Scoreboard Names", colourName)
[/code]
Edit for your own pleasure. Make a new file in lua/autorun called scoreboardcolours.lua .[/QUOTE]
That's a horrible way to do it...
Plus that's not even what he's asking for.
[QUOTE=brandonj4;43292717]That's a horrible way to do it...
Plus that's not even what he's asking for.[/QUOTE]
He asked for his name to be coloured AND the ranks to be shifted to the left. Encrypted gave a link that was legit so I did the rest.
Sorry that i didnt reply soon enough, merry christmas all and also i tried using that scoreboardcolour.lua Sm63 but it just gave me this
[ERROR] lua/autorun/scoreboardcolour.lua:14: 'end' expected (to close 'if' at line 8) near 'if'
1. unknown - lua/autorun/scoreboardcolour.lua:0
Heres how i have it - [url]http://pastebin.com/aT1eKCsW[/url]
[lua]if ply:IsUserGroup("superadmin") then[/lua]
not
[lua] if ply: IsUserGroup("superadmin") the[/lua]
You shouldn't even be using if statements. You should be using a table.
[lua]local RANKS = {}
function AddRank(usergroup, name, color)
RANKS[usergroup] = {
name = name,
color = color
}
end
AddRank("superadmin", "Super Admin", Color(255, 0, 0))[/lua]
[lua]local rank = RANKS[ply:GetNWString("usergroup")]
if (RANKS[rank]) then
self.cols[5]:SetText(rank.name)
self.cols[5]:SetTextColor(rank.color)
end[/lua]
Something like that. I don't know, I don't do anything for TTT.
Sorry, you need to Log In to post a reply to this thread.