Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2024, 02:26:56 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: TTT Problem
Pages: [1]
Author Topic: TTT Problem  (Read 5507 times)
Senor Penguino
Poster

Posts: 6


« on: February 12, 2012, 12:03:30 PM »

Im using this code for my TTT to show colors on the scoreboard.
I am using ULX admin mod. I just can't get this to work.


if SERVER then
    AddCSLuaFile("scoreboardcolors.lua")
else
    function MySBColors(ply)
        if ply:IsUserGroup("superadmin") then
                return Color(230, 19, 230)
        else
            if ply:IsUserGroup("admin") then
            return Color(17, 77, 5)
else
if ply:IsUserGroup("platinum") then
            return Color(8, 126, 243)
else
if ply:IsUserGroup("vip") then
            return Color(228, 243, 9)
            end
        end
    end
    hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end
sniperduck
Poster

Posts: 178


|:NxS:| Staff! :D


« Reply #1 on: February 12, 2012, 04:09:48 PM »

if SERVER then
  AddCSLuaFile("scoreboardcolors.lua") //give them some files
else
  function MySBColors(ply)
if ply:IsUserGroup("admin") then  //admin colours
return Color(113, 198, 113)
       end

if ply:IsUserGroup("superadmin") then //then the SA
return Color(230, 19, 230)
       end

if ply:IsUserGroup("vip") then  //and the vip
return Color(0,178,238)
       end

   end //end the functions
end  //end the if
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)


Use single if/then statements or an elseif. You did else and an if in the next line, Lua takes care of this with elseif. Or you could go with what I have here and just use single if statements.

example of elseif:
if blah blah blah then
            blah.blah:blah()
elseif blah blah == blah then
            blah.blah:blah2()
end
« Last Edit: February 12, 2012, 06:04:00 PM by sniperduck »

Overtime these forums have made me an asshole. ;D (TTT subforum)
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27016
|:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016
|:NxS:| Fretta: <COMING SOON>
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: TTT Problem « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.