TorNix~|nR Posted October 5, 2017 Share Posted October 5, 2017 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
itHyperoX Posted October 5, 2017 Share Posted October 5, 2017 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 1 Link to comment
TorNix~|nR Posted October 6, 2017 Author Share Posted October 6, 2017 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
WorthlessCynomys Posted October 7, 2017 Share Posted October 7, 2017 (edited) When you set the VIP ranks. Try to make a simple "else" after that bunch of "elseif"s so if something else happens then your conditions, than VIP rank is none. Edited October 7, 2017 by Randomly 1 Link to comment
TorNix~|nR Posted October 9, 2017 Author Share Posted October 9, 2017 (edited) 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 October 9, 2017 by TorNix~|nR Link to comment
itHyperoX Posted October 9, 2017 Share Posted October 9, 2017 (edited) 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 October 9, 2017 by TheMOG 1 Link to comment
TorNix~|nR Posted October 10, 2017 Author Share Posted October 10, 2017 Same, sometimes when player enter, it becomes blank, what about using? onPlayerJoin Link to comment
Ahmed Ly Posted October 10, 2017 Share Posted October 10, 2017 (edited) 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 October 10, 2017 by Ahmed Ly 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now