So what I'm trying to do is when you interact with an entity a derma panel pops up but I'm having some trouble getting the Derma panel to appear.
Here is what I've got so far:
(SERVER SIDE)
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("ServerMsg")
function ENT:Initialize()
self:SetModel( "models/props_lab/monitor02.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self.isRunning = false
local phys = self:GetPhysicsObject()
self.viewTime = false
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Use( activator, caller )
if IsValid( caller ) and caller:IsPlayer() then
net.Start("ServerMsg")
net.WriteBool(true)
net.WriteInt(1000,12)
net.Send(caller)
end
end
(CLIENT SIDE)
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
net.Receive("ServerMsg", function (len)
local panelopen = net.ReadBool()
local panelnum = net.ReadInt(12)
end)
if panelopen == false and panelnum == 1000 then
local Frame = vgui.Create( "DFrame" )
Frame:SetSize( 300, 150 )
Frame:SetTitle( "Computer System" )
Frame:SetVisible( true )
Frame:SetDraggable( false )
Frame:ShowCloseButton( true )
Frame:MakePopup()
Frame:Center()
end
Any help would be greatly appreciated!
So you send panelopen = true through the net message but you are checking if it is false?
Also enclose your frame in a function and then call said function when you receive the net message.
Fairly certain both panelopen and panelnum are nil because they are local to the net.Receive callback.
Aha yeah I read something about the values alternating so false to true but obviously not the case, it works now thank you!
Yes this worked thanks so much!
Sorry, you need to Log In to post a reply to this thread.