• cam.Start3D2D PLY Keypress Toggle??
    0 replies, posted
So, I have this Derma panel & Model. The Model has been scripted into an Entity. The Derma Panel has been finished. When a Player goes up to said Entity and presses the use key "E" on the Scripted Entity the Derma panel will run, then when "Esc" is pressed it quits. Now, I've taken this a bit further. I wanted what the Player was viewing on the Derma panel to be shown on the face of the Scripted Entity in real time. Which I was able to figure out. Now, I want some sort of idle screen. Like, when there is no player using the derma panel it'll display something other then the html derma panel. This isn't hard. I know I can use just a 2nd Material & cam.Start3D2D blah, blah, blah.. boring, boring, boring. But, I need to figure out how I can toggle cam.Start3D2D via keypress. Any ideas? P.s. lil bit of my code below. [code] cl_init.lua local html = vgui.Create( "HTML" ) html:SetPos( 50, 50 ) html:SetSize( ScrW() - 100, ScrH() - 100 ) html:MakePopup() html:Center() html:OpenURL ( "https://example.com/url" ) html:SetVisible(false) net.Receive("Enable_Derma",function() local ent = net.ReadEntity() if not html:IsVisible() then html:SetVisible(true) html:SetKeyboardInputEnabled(true) html:SetMouseInputEnabled(true) gui.EnableScreenClicker(true) end end) function Disable_Derma() if html:IsVisible() and input.IsKeyDown( KEY_ESCAPE ) then html:SetVisible(false) html:SetKeyboardInputEnabled(false) html:SetMouseInputEnabled(false) gui.EnableScreenClicker(false) end end hook.Add("Think","Disable_Derma",Disable_Derma) local function DrawSign() -- Draw a background surface.SetDrawColor(255, 255, 255, 0) surface.DrawRect(0, 0, 73, 64) -- Draw the screen if not html:GetHTMLMaterial()then return end render.SetMaterial(html:GetHTMLMaterial()) render.DrawQuad(Vector(0, 0, 0), Vector(125.5, 0, 0), --forward Vector(125.5, 96.4, -1), Vector(1.1, 96.4, -1)) end function ENT:Draw () self:DrawModel() local pos = self:GetPos()+(self:GetForward()*0)+(self:GetRight()*0)+self:GetUp()*0 local rot = Vector(-63, 90, 0) local ang = self:GetAngles() ang:RotateAroundAxis(ang:Right(), rot.x) ang:RotateAroundAxis(ang:Up(), rot.y) ang:RotateAroundAxis(ang:Forward(), rot.z) cam.Start3D2D(self:GetPos()+(self:GetForward()*-1)+(self:GetRight()*14.5)+self:GetUp()*73.6,ang,0.4) local status, err = pcall(DrawSign) cam.End3D2D() end [/code]
Sorry, you need to Log In to post a reply to this thread.