Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.78 KB | None | 0 0
  1. local CircleMat = Material( "sgm/playercircle" )
  2. local enable = CreateConVar( "cl_upc_enable", "1", FCVAR_ARCHIVE, "Enable/Disable Under Player Circle (clientside)" )
  3. -- local alpha = "190" -- Set Alpha
  4.  
  5. -- local cameraon = 0
  6.  
  7. local enableserv = CreateConVar( "sv_upc_enable", "1", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Enable/Disable Under Player Circle (serverside)" )
  8.  
  9. local operator_size = 50
  10. local admin_size = 60
  11. local headadmin_size = 70
  12. local superadmin_size = 80
  13. local manager_size = 90
  14. local owner_size = 100
  15.  
  16. CreateConVar( "sv_upc_colormode", "1", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Enable/Disable Player Color for UPC" )
  17. CreateConVar( "sv_upc_light", "0", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Enable/Disable light with UPC" )
  18. CreateConVar( "sv_upc_voice", "1", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Enable/Disable voice volume size with UPC" )
  19. CreateConVar( "sv_upc_voice_volume", "50", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Set the voice volume for UPC" )
  20. CreateConVar( "sv_upc_alpha", "190", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Set the alpha for UPC colors" )
  21. CreateConVar( "sv_upc_radius", ply:GetUserGroup() .. "_size", FCVAR_SERVER_CAN_EXECUTE + FCVAR_REPLICATED + FCVAR_ARCHIVE, "Set the radius for UPC" )
  22.  
  23. local alpha = GetConVar( "sv_upc_alpha" ):GetInt() -- Set Alpha
  24.  
  25. AddCSLuaFile()
  26. if(SERVER) then
  27. print("Admin Circle Loaded (Edited By Gaerission | Re-Edited By Kaden")
  28.  end
  29.  
  30. hook.Add( "PrePlayerDraw", "UPC", function( ply )
  31.  
  32. if enable:GetBool() and enableserv:GetBool() then
  33.  
  34.     ---------------------------------------------------------------
  35.    
  36.     if ( !ply:Alive()) then return end
  37.     if ( !ply:IsValid()) then return end
  38.     if ( ply:InVehicle()) then return end
  39.     if not (ply:CheckGroup("operator")) then return end
  40.     if not (ply:HasWeapon("god_s") and ply:GetActiveWeapon():GetClass() == ("god_s")) then return end
  41.    
  42.    
  43.  
  44.     ---------------------------------------------------------------
  45.  
  46. --------UPC PLAYERCOLOR--------
  47. cvars.AddChangeCallback( "sv_upc_alpha", function( convar , oldValue , newValue  )
  48.     alpha = newValue
  49. end )
  50.  
  51.  
  52.  
  53. --Player Color/Team Color
  54. if GetConVar( "sv_upc_colormode" ):GetInt() == 1 then
  55. getcolor = ply:GetPlayerColor()
  56. colour = Color(getcolor.r * 255, getcolor.g * 255, getcolor.b * 255, alpha)
  57.  
  58. --MULTICOLOr
  59.     elseif GetConVar( "sv_upc_colormode" ):GetInt() == 2 then
  60.         local col = HSVToColor( CurTime() % 6 * 60, 1, 1 )
  61.         getcolor = Vector( col.r / 255, col.g / 255, col.b / 255 )
  62.     colour = Color(getcolor.r * 255, getcolor.g * 255, getcolor.b * 255, alpha)
  63.  
  64. --Custom Color
  65.     elseif GetConVar( "sv_upc_colormode" ):GetInt() == 0 then
  66.        
  67.  
  68.  
  69.  
  70. if ( ply:IsUserGroup( "operator" )) then
  71.         colour = Color(10,250,math.abs(math.sin(3.2*RealTime())*240),alpha)
  72.         size = (num +50) + math.sin(CurTime() * 3) * 11  
  73. end
  74.  
  75. if ( ply:IsUserGroup( "admin" )) then
  76.         colour = Color(0,math.abs(math.sin(3.2*RealTime())*240),255,alpha)
  77.         size = (num +60) + math.sin(CurTime() * 3) * 11  
  78. end
  79.  
  80. if ( ply:IsUserGroup( "headadmin" )) then
  81.         colour = Color(0,math.abs(math.sin(3.2*RealTime())*240),255,alpha)
  82.         size = (num +70) + math.sin(CurTime() * 3) * 11    
  83.  
  84. end
  85.  
  86. if ( ply:IsUserGroup( "superadmin" )) then
  87.         colour = Color(0,math.abs(math.sin(3.2*RealTime())*240),255,alpha)
  88.         size = (num +80) + math.sin(CurTime() * 3) * 11    
  89.  
  90. end
  91.  
  92. if ( ply:IsUserGroup( "manager" )) then
  93.         colour = Color(0,math.abs(math.sin(3.2*RealTime())*240),255,alpha)
  94.         size = (num +90) + math.sin(CurTime() * 3) * 11    
  95.  
  96. end
  97.  
  98. if ( ply:IsUserGroup( "owner" )) then
  99.         colour = Color(0,math.abs(math.sin(3.2*RealTime())*240),255,alpha)
  100.         size = (num +100) + math.sin(CurTime() * 3) * 11    
  101.  
  102. end
  103.  
  104.  
  105. end
  106.  
  107. --If light enable
  108. if GetConVar("sv_upc_light"):GetInt() == 1 then
  109. if GetConVar("sv_upc_colormode"):GetInt() == 0 then
  110. getcolor = Vector( colour.r / 255, colour.g / 255, colour.b / 255 )
  111. end
  112.  
  113.         --show me your light
  114.             local circlelight = DynamicLight( ply:EntIndex() )
  115.             if ( circlelight ) then
  116.                 circlelight.pos = ply:GetPos()
  117.                 circlelight.r = getcolor.r * 255
  118.                 circlelight.g = getcolor.g * 255
  119.                 circlelight.b = getcolor.b * 255
  120.                 circlelight.brightness = 4
  121.                 circlelight.Size = ply:GetModelScale() * 50
  122.                 -- circlelight.Decay = 1000
  123.                 circlelight.DieTime = CurTime() +1
  124.                 circlelight.NoWorld = false
  125.                 -- circlelight.NoModel = true
  126.             end
  127.  
  128. end
  129.  
  130.     ---------------------------------------------------------------
  131.     local radius = ply:GetModelScale() * GetConVar("sv_upc_radius"):GetInt()                                                --  You can set the radius for the circle, edit the 50 value !
  132.    
  133.     if GetConVar("sv_upc_voice"):GetInt() == 1 then
  134.         radius = ply:GetModelScale() * GetConVar("sv_upc_radius"):GetInt() + ply:VoiceVolume() * GetConVar("sv_upc_voice_volume"):GetInt()    --    You can set the radius for the circle, edit the first 50 value !
  135.     end
  136.     ---------------------------------------------------------------
  137.    
  138. ------------ Do not edit from here if you don't know lua base ------------
  139.  
  140.     local trace = {}
  141.     trace.start = ply:GetPos() + Vector(0,0,50)
  142.     trace.endpos = trace.start + Vector(0,0,-130)
  143.     trace.filter = ply
  144.     local tr = util.TraceLine( trace )
  145.     if !tr.HitWorld then
  146.         tr.HitPos = ply:GetPos()
  147.     end
  148.     render.SetMaterial( CircleMat )
  149.     render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, radius, radius, colour )
  150.    
  151. end
  152. end )
  153. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement