Advertisement
HK47

radar2

Oct 23rd, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.57 KB | None | 0 0
  1. local function clear()
  2.     if _MAIN_RADAR_ then
  3.         if _MAIN_RADAR_.players then
  4.             for k, v in pairs(_MAIN_RADAR_.players) do
  5.                 if v.model then v.model:Remove() end
  6.             end
  7.         end
  8.        
  9.         if _MAIN_RADAR_.plat then _MAIN_RADAR_.plat:Remove() end
  10.     end
  11. end
  12.  
  13. if CLIENT then
  14.     clear()
  15.    
  16.     _MAIN_RADAR_ = {}
  17.    
  18.     _MAIN_RADAR_.pos = Vector(560, -300, -140)
  19.     _MAIN_RADAR_.players = {}
  20.    
  21.     _MAIN_RADAR_.plat = ClientsideModel("models/props_phx/construct/windows/window1x1.mdl")
  22.     _MAIN_RADAR_.plat:SetModelScale(3, 0)
  23.        
  24.     _MAIN_RADAR_.think = function()
  25.         if _MAIN_RADAR_.plat then
  26.             _MAIN_RADAR_.plat:SetPos(_MAIN_RADAR_.pos + vector_up * math.sin(CurTime() * 2))
  27.         end
  28.     end
  29.    
  30.     hook.Add("Think", "radar_think_cl", function()
  31.         if _MAIN_RADAR_.think then _MAIN_RADAR_.think() end
  32.        
  33.         for k, v in pairs(_MAIN_RADAR_.players) do
  34.             if not IsValid(v.entity) and v.model then
  35.                 v.model:Remove()
  36.             end
  37.            
  38.             if IsValid(v.entity) and v.model then
  39.                 v.model:SetPos(v.entity:GetPos())
  40.             end
  41.         end
  42.        
  43.         for k, v in pairs(player.GetAll()) do
  44.             if not _MAIN_RADAR_.players[v:UniqueID()] then
  45.                 _MAIN_RADAR_.players[v:UniqueID()] = {}
  46.                 _MAIN_RADAR_.players[v:UniqueID()].model = ClientsideModel(v:GetModel())
  47.                 _MAIN_RADAR_.players[v:UniqueID()].entity = v
  48.             end
  49.         end
  50.     end)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement