So my goal is to make a weapon vendor entity, but I can't get a panel to show, I don't have much experience so this is all still a learning experience for me. What I though off myself was to have the ENT:Use send information to the client and from there there will be a popup frame.
This is what I thought off but It's not working, sorry if this is completely wrong and I am wasting your time.
Shared
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Test Entity"
ENT.Spawnable = true
Client Side
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
net.Receive("ClientSide"),function(len)
local s = net.ReadString()
print (s)
end)
Server Side
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("ClientSide")
function ENT:Initialize()
self:SetModel( "models/starwars/syphadias/props/sw_tor/bioware_ea/props/vendor/vendor_guild_bank.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( ply, caller)
net.Start("Clientside")
net.WriteString("It works!")
net.Send(ply)
end
I made the client side print something to see if it actually sends the information over, but it's not.
If you have any ideas on how to fix this it'll be much appreciated, I'd rather not get the entire weapon vendor code on this thread as I want to learn myself how to make it, but I am hoping you guys can help me a bit
Kind Regards,
Aaron
I don't see a panel anywhere,
You wrote the net.Receive wrong, instead of
net.Receive("ClientSide"),function(len)local s = net.ReadString()
print (s)
end)
it should be:
net.Receive("ClientSide", function(len)
local s = net.ReadString()
print (s)
end)
you put too many close brackets )
if you want text to be placed on the face of the vending machine then you should try using cam.Start3D2D in the ENT:Draw() function
if you want a gui to pop up on your screen then try to look at this to help you Derma Basic Guide , this should be placed in the clientside script inside the net.Receive
Oh this is epic, thanks. I know about the Derma and 3D2D things, just couldn't get this to work. I'm going to start off with a nice and easy gui but I might make the 3D2D thing later
Thanks again
Sorry, you need to Log In to post a reply to this thread.