Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 11:57:59 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: What the hell is wrong with this code?
Pages: [1]
Author Topic: What the hell is wrong with this code?  (Read 3413 times)
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« on: February 25, 2011, 08:32:36 AM »

if SERVER then
AddCSLuaFile("scoreboardcolors.lua")
else
function MySBColors(ply)
if ply:IsUserGroup("vip") then
            return Color(255, 85, 0)
else
if ply:IsUserGroup("operator") then
return Color(0, 255, 237)
else
if ply:IsUserGroup("designer") then
return Color(1, 1, 1)
end
end
end
hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end

Without the
else
if ply:IsUserGroup("designer") then
return Color(1, 1, 1)

it works perfectly, but when I add it, it breaks. No errors. I know it's some dumbass error that I'm going facepalm over, but I'm assuming people here will have better luck then me.
« Last Edit: February 25, 2011, 09:50:03 AM by Mr. Gash »
Manmax75
Poster

Posts: 254


Programming Guy


« Reply #1 on: February 25, 2011, 09:09:55 AM »

try doing elseif rather then else so:

function MySBColors(ply)
if ply:IsUserGroup("vip") then
            return Color(255, 85, 0)
elseif ply:IsUserGroup("operator") then
return Color(0, 255, 237)
elseif ply:IsUserGroup("designer") then
return Color(1, 1, 1)
end
end

Ride Forward and Thrust Your Pelvis In The Dark Void. The One Induced By Pleasure Yet Cast By The Bigger Picture.
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #2 on: February 25, 2011, 09:50:46 AM »

Still doesn't work. When I did that, it gave me
 [lua\autorun\scoreboardcolors.lua:15] '<eof>' expected near 'end'
(Serverside error)
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #3 on: February 25, 2011, 11:16:01 AM »



if SERVER then
AddCSLuaFile("scoreboardcolors.lua")
else
function MySBColors(ply)
if ply:IsUserGroup("vip") then
return Color(255, 85, 0)
elseif ply:IsUserGroup("operator") then
return Color(0, 255, 237)
elseif ply:IsUserGroup("designer") then
return Color(1, 1, 1)
end
end
hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end


Should work.

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #4 on: February 25, 2011, 12:30:07 PM »

If a file has a syntax error, it will only appear way up in the console where it says it's loading the gamemode. It might even appear only in the server console, because a syntax error would prevent the file from being added to the lua cache and sent to clients.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: What the hell is wrong with this code? « 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 17 queries.