• Help with my scoreboard
    4 replies, posted
Hey Im a LUA noob, and would like to know how i can get the jobs to show up in this scoreboard. It is returing a lua error, can anyone help? [CODE]local Columns = {} Columns[1] = {name="Name", command=function(self, arg) return tostring(arg:Name()) end} Columns[2] = {name="Team", command=function(self.Player.DarkRPVars and self.Player.DarkRPVars.job or team.GetName(self.Player:Team()) end} Columns[3] = {name="Ping", command=function(self, arg) return tostring(arg:Ping()) end} [/CODE]
[LUA] Columns[2] = {name="Team", command=function(self.Player.DarkRPVars and self.Player.DarkRPVars.job or team.GetName(self.Player:Team())) end} [/LUA] You forgot a )
Thank you so much. However it's returning this [CODE] [ERROR] lua/autorun/sh_scoreboard.lua:34: ')' expected near '.' 1. unknown - lua/autorun/sh_scoreboard.lua:0 [/CODE]
[LUA] Columns[2] = { name = "Team", command = function( self ) return self.Player.DarkRPVars and self.Player.DarkRPVars.job or team.GetName( self.Player:Team() ) end } [/LUA] Is probably what you want. Although I don't know why you would need "self.Player.DarkRPVars and self.Player.DarkRPVars.job". [LUA] return team.GetName( self.Player:Team() ) or "Unknown" [/LUA] This should work just as well, but I don't know anything about DarkRP so who knows.
He could just simply do [lua] Columns[2] = { name="Team", command=function(self, arg) return tostring(team.GetName(arg:Team())) end} [/lua]
Sorry, you need to Log In to post a reply to this thread.