Advertisement
CapsAdmin

Untitled

Jan 15th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. local ENT = {}
  2.  
  3. ENT.Type = "anim"
  4. ENT.Base = "base_anim"
  5. ENT.ClassName = "server_teleport"
  6.  
  7. ENT.Name = "LAC"
  8. ENT.IP = "88.191.102.162"
  9.  
  10. if CLIENT then
  11.    
  12.     do -- draw
  13.         local font_name = "GotoMeta"
  14.             surface.CreateFont(
  15.                 font_name,
  16.                 {
  17.                     font        = "Roboto",
  18.                     size        = 150,
  19.                     weight      = 650,
  20.             --      antialias   = true,  --true
  21.                 --  additive    = true,  --true
  22.                     outline = true,
  23.                 }
  24.             )
  25.        
  26.         local function draw_text(text, color, x, y)    
  27.             surface.SetFont(font_name)
  28.             surface.SetTextColor(color)
  29.             surface.SetTextPos(x,y)
  30.             surface.DrawText(text)
  31.         end
  32.    
  33.         local function draw_text3D(txt,pos,ang,size)
  34.             local alp = math.Clamp(300-((pos:Distance(LocalPlayer():GetPos()))/1500*255),0,255)
  35.             if(alp!=0)then
  36.                 local tbl = {}
  37.                 local length = #txt
  38.                
  39.                 for i = 1, length do
  40.                     local hsv=HSVToColor(((i / length) * 360-CurTime()*70)%360, 1, 1)
  41.                     table.insert(tbl, {char = txt:sub(i, i), color = Color(hsv.r,hsv.g,hsv.b,alp)})
  42.                 end
  43.                 surface.SetFont(font_name)
  44.                 local maxw,maxh = surface.GetTextSize(txt)
  45.                 local w, h = 0, 0
  46.    
  47.                 local last_w, last_h = 0, 0
  48.                 cam.Start3D2D(pos,ang,size)
  49.                     for i, data in pairs(tbl) do
  50.                         draw_text(data.char,data.color,w/2 + last_w-maxw/2, h/2 + last_h-(math.sin(CurTime()*3-math.pi*4/#tbl*i)*25+25))
  51.                         local w, h = surface.GetTextSize(data.char)
  52.                         last_w = last_w + w
  53.                     end
  54.                 cam.End3D2D()
  55.             end
  56.         end
  57.        
  58.         local mat = Material("models/shadertest/predator")
  59.        
  60.         function ENT:Draw()
  61.             render.SetMaterial(mat)
  62.             render.DrawBox(self:GetPos() + Vector(0,0,70), self:GetAngles(), Vector(-66,-0,-75), Vector(66,31,60), Color(255,255,255), 10)
  63.            
  64.             local ang = self:GetAngles()
  65.             ang:RotateAroundAxis(self:GetForward(), 90)
  66.             draw_text3D(self.Name, self:GetPos() + Vector(0,0,100), ang, 0.23)
  67.         end
  68.     end
  69.  
  70.     net.Receive("server_teleport_leave", function(doquit, reason)
  71.         local ent = net.ReadEntity()
  72.         if ent:IsValid() then
  73.            
  74.             if ValidPanel(g_server_teleport_request) then return end
  75.            
  76.             g_server_teleport_request = Derma_Query(
  77.                 "Do you want to connect to " .. ent.Name .. "?",
  78.                 "Server teleport",
  79.                
  80.                 "yes", function() Say("connect " .. ent.IP) end,
  81.                 "no", function() end
  82.             )
  83.         end
  84.     end)
  85. end
  86.  
  87. if SERVER then
  88.     function ENT:Initialize()
  89.         self:SetModel("models/hunter/plates/plate3x3.mdl")
  90.         self:PhysicsInit(SOLID_VPHYSICS)
  91.         self:SetMoveType(MOVETYPE_NONE)
  92.        
  93.         self:SetMaterial("models/props_lab/cornerunit_cloud")
  94.     end
  95.    
  96.     util.AddNetworkString("server_teleport_leave")
  97.    
  98.     function ENT:StartTouch(ent)
  99.         if ent:IsPlayer() then
  100.             net.Start("server_teleport_leave") 
  101.                 net.WriteEntity(self)
  102.             net.Send(ent)
  103.         end
  104.     end
  105. end
  106.  
  107. scripted_ents.Register(ENT, ENT.ClassName)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement