Jump to content

Script doesn´t change in scoreboard when it should


Adde

Recommended Posts

I have a script that works fine but have one small problem. If a player is set as "player" in scoreboard and then is being moved to acl group moderator, it doesn´t change to "Mod". Same problem however i try to change. :/

I got help with an other problem with this script before when I made it, so I´m sry if I shouldn´t have created a new topic for this.

And yes, I have edited "zombie_ranks" a bit to create this kind of script.

This is the script:

exports.scoreboard:addScoreboardColumn('SALA') 
  
function thesala() 
    local accName1 = getAccountName(account) 
    local account = getPlayerAccount(source) 
if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Owner" ) ) then 
setAccountData ( account, "SALA", "Owner" ) 
elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Admin" ) ) then 
setAccountData ( account, "SALA", "Admin" ) 
elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "SuperModerator" ) ) then 
setAccountData ( account, "SALA", "Super Mod." ) 
elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Moderator" ) ) then 
setAccountData ( account, "SALA", "Mod." ) 
elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Trial Moderator" ) ) then 
setAccountData ( account, "SALA", "Trial Mod." ) 
elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Everyone" ) ) then 
setAccountData ( account, "SALA", "Player" ) 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), thesala) 
  
function something() 
    local Guest = getPlayerAccount(source) 
    if isGuestAccount(Guest) then return end 
    local sala = getAccountData(Guest,"SALA") 
    if sala then 
        setElementData(source,"SALA", sala) 
end 
end 
addEventHandler("onPlayerLogin",root,something) 
  

Link to comment
exports.scoreboard:addScoreboardColumn ( 'SALA' ) 
  
function thesala ( _, account ) 
    local accName1 = getAccountName ( account ) 
    local rank = "Player" 
    if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Owner" ) ) then 
        rank = "Owner" 
    elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Admin" ) ) then 
        rank = "Admin" 
    elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "SuperModerator" ) ) then 
        rank = "Super Mod." 
    elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Moderator" ) ) then 
        rank = "Mod." 
    elseif isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Trial Moderator" ) ) then 
        rank = "Trial Mod." 
    end 
    setAccountData ( account, "SALA", rank ) 
    setElementData ( source, "SALA", rank ) 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), thesala ) 

Try that.

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...