Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. local x = {
  2. ["Console"] = ":"..getResourceName(resource).."/image/Console.png",
  3. ["Head.Admin"] =":"..getResourceName(resource).."/image/Head.Admin.png",
  4. ["LeveL.1"] = ":"..getResourceName(resource).."/image/Level1.png",
  5. ["LeveL.2"] = ":"..getResourceName(resource).."/image/Level2.png",
  6. ["LeveL.3"] = ":"..getResourceName(resource).."/image/Level3.png",
  7. ["LeveL.4"] = ":"..getResourceName(resource).."/image/Level4.png",
  8. ["LeveL.5"] = ":"..getResourceName(resource).."/image/Level5.png",
  9. ["LeveL.6"] = ":"..getResourceName(resource).."/image/Level6.png",
  10. }
  11.  
  12. exports.scoreboard:addScoreboardColumn('Rank')
  13. exports.scoreboard:scoreboardSetColumnPriority ('Rank',1)
  14. function aclGetAccountGroups ( account )
  15. local acc = getAccountName ( account )
  16. if ( not acc ) then return false end
  17. local res = {}
  18. acc = "user."..acc
  19. local all = "user.*"
  20. for ig, group in ipairs ( aclGroupList() ) do
  21. for io, object in ipairs ( aclGroupListObjects ( group ) ) do
  22. if ( ( acc == object ) or ( all == object ) ) then
  23. table.insert ( res, aclGroupGetName ( group ) )
  24. break
  25. end
  26. end
  27. end
  28. return res
  29. end
  30.  
  31. addEventHandler("onPlayerLogin",root,
  32. function(_,theCurrentAccount)
  33. local Groups = aclGetAccountGroups(theCurrentAccount)
  34. setElementData(source,"Rank",x[Groups[#Groups]] or Groups[#Groups])
  35. end
  36. )
  37.  
  38. addEventHandler("onResourceStart",resourceRoot,
  39. function()
  40. for i,v in ipairs(getElementsByType("player")) do
  41. if not isGuestAccount(getPlayerAccount(v)) then
  42. local Groups = aclGetAccountGroups(getPlayerAccount(v))
  43. setElementData(v,"Rank",x[Groups[#Groups]] or Groups[#Groups])
  44. end
  45. end
  46. end
  47. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement