Jump to content

Scoreboard rank


TorNix~|nR

Recommended Posts

Hello guys I made a vip rank on scoreboard, it works fine, but sometimes when a player join

it becomes empety, but I want it to become "None" help please?

call(getResourceFromName("global"),"scoreboardAddColumn","VIP",1,75)

function setRank()
for _,player in ipairs(getElementsByType("player")) do
local account = getPlayerAccount(player)
if isGuestAccount(account) then
setElementData(player,"VIP","None")
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("PLATINUM VIP")) then
setElementData(player,"VIP","Platinum VIP")
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("RICH VIP")) then
setElementData(player,"VIP","Rich VIP")
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("VIP")) then
setElementData(player,"VIP","Simple VIP")
elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Everyone")) then
setElementData(player,"VIP","None")
    end
  end
end
setTimer(setRank,500,0)

 

Link to comment
call(getResourceFromName("global"),"scoreboardAddColumn","VIP",1,75)

function setRank()
    for _,player in ipairs(getElementsByType("player")) do
        local account = getPlayerAccount(player)
        
        if isGuestAccount(account) then
            setElementData(player,"VIP","None")
         end    
        
        if isPlayerInACL(player, "PLATINUM VIP") then    
            setElementData(player,"VIP","Platinum VIP")
        end
        
        if isPlayerInACL(player, "RICH VIP") then
            setElementData(player, "VIP","Rich VIP")
        end
        
        if isPlayerInACL(player, "VIP") then
            setElementData(player, "VIP","Simple VIP")
        end
        
        if isPlayerInACL(player, "Everyone") then
            setElementData(player, "VIP","None")            
        end
    end
end
setTimer(setRank,500,0)


function isPlayerInACL(player, acl)
   local accountName = getAccountName( getPlayerAccount(player) )
   if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then
      return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) )
   end
   return false
end

Check /debugscript 3 pls

  • Thanks 1
Link to comment
On 05/10/2017 at 22:45, TheMOG said:

call(getResourceFromName("global"),"scoreboardAddColumn","VIP",1,75)

function setRank()
    for _,player in ipairs(getElementsByType("player")) do
        local account = getPlayerAccount(player)
        
        if isGuestAccount(account) then
            setElementData(player,"VIP","None")
         end    
        
        if isPlayerInACL(player, "PLATINUM VIP") then    
            setElementData(player,"VIP","Platinum VIP")
        end
        
        if isPlayerInACL(player, "RICH VIP") then
            setElementData(player, "VIP","Rich VIP")
        end
        
        if isPlayerInACL(player, "VIP") then
            setElementData(player, "VIP","Simple VIP")
        end
        
        if isPlayerInACL(player, "Everyone") then
            setElementData(player, "VIP","None")            
        end
    end
end
setTimer(setRank,500,0)


function isPlayerInACL(player, acl)
   local accountName = getAccountName( getPlayerAccount(player) )
   if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then
      return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) )
   end
   return false
end

Check /debugscript 3 pls

No bugs on /debugscript 3

but it's always "None"

Link to comment

It still the problem, sometimes a player join, but it set to blank " ", not "none"

Code

call(getResourceFromName("global"),"scoreboardAddColumn","VIP",1,75)

function setRank()
    for _,player in ipairs(getElementsByType("player")) do
        local account = getPlayerAccount(player)
        
        if isGuestAccount(account) then
            setElementData(player,"VIP","None")         
        elseif isPlayerInACL(player, "PLATINUM VIP") then    
            setElementData(player,"VIP","Platinum VIP")
        elseif isPlayerInACL(player, "RICH VIP") then
            setElementData(player, "VIP","Rich VIP")
        elseif isPlayerInACL(player, "VIP") then
            setElementData(player, "VIP","Simple VIP")
        elseif isPlayerInACL(player, "Everyone") then
            setElementData(player, "VIP","None")            
        end
    end
end
setTimer(setRank,500,0)


function isPlayerInACL(player, acl)
   local accountName = getAccountName( getPlayerAccount(player) )
   if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then
      return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) )
   end
   return false
end

 

help please?

Edited by TorNix~|nR
Link to comment

test.

call(getResourceFromName("global"),"scoreboardAddColumn","VIP",1,75)
function updatePlayerVIP()
    for _ , player in ipairs(getElementsByType("player")) do
    
        if isPlayerInACL(player, "PLATINUM VIP") then
            setElementData(player, "VIP", "Platinum VIP")
        end
    
        if isPlayerInACL(player, "RICH VIP") then
            setElementData(player, "VIP", "Rich VIP")
        end

        if isPlayerInACL(player, "VIP") then
            setElementData(player, "VIP", "Simple VIP")
        end        

        if isPlayerInACL(player, "Everyone") then
            setElementData(player, "VIP" , "None")
        end        
        
    end
    
    outputChatBox("Checked")
end
setTimer(updatePlayerVIP,50,0)


function isPlayerInACL(player, acl)
   local accountName = getAccountName( getPlayerAccount(player) )
   if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then
      return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) )
   end
   return false
end

 

Edited by TheMOG
  • Thanks 1
Link to comment

try

---Note: if doesn't work , please check the acl.xml file must be have in acl.xml VIP etc..
exports["global"]:scoreboardAddColumn("vip")





function getRankName (player)
if( getElementType(player) == "player" ) then
account = getAccountName ( getPlayerAccount ( player ) )
if (isObjectInACLGroup ("user."..account,aclGetGroup ("VIP")) )then
rank = "VIP"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("RICH VIP")) )then
rank = "RICH VIP"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("Simple VIP")) )then
rank = "Simple VIP"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("Everyone")) )then
rank = "Everyone"
end
else
error("Bad Argmuent at Argument 1 Must be a Player")
end
return rank
end





function onResourceStarted ()
for _,v in ipairs ( getElementsByType ( "player" ) ) do
accs = getPlayerAccount(v)
if not isGuestAccount(accs) then
setElementData(v,"vip",getRankName(v))
end
end
end
setTimer(onResourceStarted,3000,0)

 

Edited by Ahmed Ly
  • Thanks 1
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...