Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ENT={}
- ENT.Type = "anim"
- ENT.Base = "base_anim"
- ENT.PrintName = ""
- ENT.Author = ""
- ENT.Spawnable = false
- ENT.AdminSpawnable = ENT.AdminSpawnable
- ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
- ENT.Base = "base_anim"
- ENT.Type = "anim"
- ENT.Width = 256
- ENT.Height = 128
- ENT.Scale = 0.5
- local function RayQuadIntersect(vOrigin, vDirection, vPlane, vX, vY)
- local vp = vDirection:Cross(vY)
- local d = vX:DotProduct(vp)
- if (d <= 0.0) then return end
- local vt = vOrigin - vPlane
- local u = vt:DotProduct(vp)
- if (u < 0.0 or u > d) then return end
- local v = vDirection:DotProduct(vt:Cross(vX))
- if (v < 0.0 or v > d) then return end
- return Vector(u / d, v / d, 0)
- end
- function ENT:Initialize()
- motd = self
- if SERVER then
- self.Entity:SetModel( "models/props_interiors/BathTub01a.mdl" )
- self.Entity:SetNotSolid(true)
- self:SetAngles(Angle(0,180,0))
- self:SetNWString('place',self.place)
- else
- self.HTML = vgui.Create("HTML")
- self.HTML:SetSize( 128,128 )
- self.HTML:SetPaintedManually( true )
- self.HTML:OpenURL( "http://whatismyip.com" )
- local min = Vector(0, (-self.Width/2) * self.Scale, 0)
- local max = Vector(0, (self.Width/2) * self.Scale, self.Height*self.Scale)
- self:SetRenderBounds(min, max)
- self.mX, self.mY = 0, 0
- end
- self:DrawShadow(false)
- end
- function ENT:DrawMOTD()
- /* surface.SetDrawColor( 40, 40, 40, 100)
- surface.DrawRect(0 , 0, width, height )
- draw.DrawText("The time is now "..os.time(), "Default", self.Width/2, 20, Color(150, 180, 200, 255), TEXT_ALIGN_CENTER )
- draw.DrawText("The time is now "..os.date(), "Default", self.Width/2, 50, Color(150, 180, 200, 255), TEXT_ALIGN_CENTER )
- draw.DrawText("Welcome to Meta-Construct Build Server, "..LocalPlayer():GetName(), "Default", 10, 5, Color(150, 180, 200, 255), TEXT_ALIGN_LEFT ) */
- end
- function ENT:Think()
- self.HTMLMat = self.HTML and self.HTML:GetHTMLMaterial()
- self:NextThink(CurTime() + 0.1)
- end
- local width, height
- function ENT:Draw()
- local pos, ang = self:GetPos(), self:GetAngles()
- ang:RotateAroundAxis(ang:Up(), 0)
- ang:RotateAroundAxis(ang:Forward(), 90)
- pos=pos-self:GetAngles():Forward()*(self.Width/2)*(1/self.Scale)/2
- pos=pos-self:GetAngles():Up()*-(self.Height/2)*(1/self.Scale)/2
- width = self.Width*(1/self.Scale)
- height = self.Height*(1/self.Scale)
- if !self.HTML || !self.HTMLMat then return end
- cam.Start3D(EyePos(), EyeAngles()) --dunno
- render.SetMaterial(self.HTMLMat)
- render.DrawQuadEasy(pos, Vector(0,1,0), width, height, color_white, 180)
- cam.End3D()
- end
- function ENT:OnRemove()
- if !self.HTML then
- self.HTML:Remove()
- end
- end
- scripted_ents.Register(ENT, "lua_motd", true)
- game.CleanUpMap()
Add Comment
Please, Sign In to add comment