I made an entity, and when its used it should pop up a derma menu, but ENT:Use() is a serverside function, and dermas are clientside.
How do i make it so that when its used it does derma?
P.S. sorry for being dumb
P.S.S. i tried putting ENT:Use into init.lua, and call a function that is in cl_init.lua, didnt work
code?
init.lua:
[CODE]
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self:SetModel( "models/props_wasteland/kitchen_stove001a.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetUseType( SIMPLE_USE )
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Use( activator, caller )
DrawTheDerma()
end
function ENT:Think()
end[/CODE]
cl_init.lua:
[CODE]
include('shared.lua')
function ENT:Draw()
self:DrawModel()
end
function DrawTheDerma()
DermaFrame = vgui.Create("DFrame")
DermaFrame:SetPos(50,50)
DermaFrame:SetSize(500,350)
DermaFrame:SetTitle("kill me")
DermaFrame:SetVisible(true)
DermaFrame:SetDraggable(true)
DermaFrame:ShowCloseButton(true)
DermaFrame:SetBackgroundBlur(false)
DermaFrame:SetDeleteOnClose(true)
DermaFrame:MakePopup()
end
[/CODE]
My guess is that you dont need shared.lua: there's basically nothing there related to dermas
You have to network it over.
Server
[CODE]
util.AddNetworkString("MyMenu")
function ENT:AcceptInput( Name, Activator, Caller )
if Name == "Use" and Caller:IsPlayer() then
net.Start("MyMenu")
net.Send(Caller)
end
end
[/CODE]
Client
[CODE]
net.Receive( "MyMenu", function( _, pl )
-- Insert Derma shit here
end
[/CODE]
wow am i uncreative
Thanks a lot!
Sorry, you need to Log In to post a reply to this thread.