Jump to content

scoreboard


roaddog

Recommended Posts

Hello, I have a problem with this, it doesnt show the gang in scoreboard, no errors, but I have tried all my best but I couldnt solve it

so,,

exports [ "scoreboard" ]:addScoreboardColumn ( "Gang",getRootElement() ,40,80, "Gang" ) 
   function getgang() 
   local group = exports.groupsystem: getPlayerGroup(source) 
            if group then 
            setElementData(source, "Gang", getPlayerGroup(source)) 
                else 
                group = "None" 
            end 
   end 

Link to comment
exports [ "scoreboard" ]:addScoreboardColumn ( "Gang",getRootElement() ,40,80, "Gang" ) 
function getgang() 
    local group = exports.groupsystem:getPlayerGroup(source) 
    if group then 
        outputChatBox(group) 
        setElementData(source, "Gang", group) 
    end 
end 
addCommandHandler ( "getgroup", getgang ) 

You can't call an exported function without including it, I assume that the first exported function returns the name of a group as a string and adds it to the local variable "group", secondly you must add a command handler or similar, otherwise your function will never be triggered. During the test phase it's also good to verify that the exported function actually returns something, if it does you will see that as a chat output. Good luck.

Link to comment

Looks like I forgot to define the player, my mistake, try this:

exports [ "scoreboard" ]:addScoreboardColumn ( "Gang",getRootElement() ,40,80, "Gang" ) 
function getgang(player) 
    local group = exports.groupsystem:getPlayerGroup(player) 
    if group then 
        outputChatBox(group) 
        setElementData(player, "Gang", group) 
    end 
end 
addCommandHandler ( "getgroup", getgang ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...