Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. local ranks = {}
  2. ranks["VIP"] = 75000
  3. ranks["Silver VIP"] = 250000
  4. ranks["Gold VIP"] = 500000
  5. ranks["Diamond VIP"] = 5000000
  6. ranks["Platinum VIP"] = 15000000
  7.  
  8. local rankNames = {}
  9. for k, v in pairs( ranks ) do
  10. table.insert( rankNames, k )
  11. end
  12.  
  13. function ulx.setvip( calling_ply, target_ply, rank, giveMoney )
  14.  
  15. if !table.HasValue( rankNames, rank ) then
  16. calling_ply:ChatPrint("Invalid Rank")
  17. return false
  18. end
  19.  
  20. if target_ply:GetUserGroup() == rank then
  21. calling_ply:ChatPrint("User already has " .. rank)
  22. return false
  23. end
  24.  
  25. local userInfo = ULib.ucl.authed[ target_ply:UniqueID() ]
  26. local id = target_ply:SteamID()
  27.  
  28. if giveMoney then
  29. target_ply:addMoney( ranks[rank] )
  30. end
  31.  
  32. ULib.ucl.addUser( id, userInfo.allow, userInfo.deny, rank )
  33.  
  34. if FAdmin != nil then
  35. FAdmin.Access.PlayerSetGroup( target_ply, rank )
  36. end
  37.  
  38. ulx.fancyLogAdmin( calling_ply, "#A gave #T #s", target_ply, rank )
  39.  
  40. end
  41.  
  42. local setvip = ulx.command( CATEGORY_NAME, "ulx setvip", ulx.setvip, "!setvip" )
  43. setvip:addParam{ type=ULib.cmds.PlayerArg }
  44. setvip:addParam{ type=ULib.cmds.StringArg, hint="VIP Rank", completes=rankNames }
  45. setvip:addParam{ type=ULib.cmds.BoolArg, hint="Give Money?", ULib.cmds.optional }
  46. setvip:defaultAccess( ULib.ACCESS_ADMIN )
  47. setvip:help( "Sets targets rank to a vip rank." )
  48.  
  49. function ulx.removevip( calling_ply, target_ply )
  50.  
  51. local rank = target_ply:GetUserGroup()
  52.  
  53. if !table.HasValue( rankNames, rank ) then
  54. calling_ply:ChatPrint("User does not have a VIP rank")
  55. return false
  56. end
  57.  
  58. ULib.ucl.removeUser( target_ply:UniqueID() )
  59.  
  60. if FAdmin != nil then
  61. FAdmin.Access.PlayerSetGroup( target_ply, "user" )
  62. end
  63.  
  64. ulx.fancyLogAdmin( calling_ply, "#A removed #T's #s", target_ply, rank )
  65.  
  66. end
  67.  
  68. local removevip = ulx.command( CATEGORY_NAME, "ulx removevip", ulx.removevip, "!removevip" )
  69. removevip:addParam{ type=ULib.cmds.PlayerArg }
  70. removevip:defaultAccess( ULib.ACCESS_ADMIN )
  71. removevip:help( "Removes targets rank if they are vip." )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement