• My Entite Opens 4 Derma Menus
    6 replies, posted
[CODE]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/noble/trailermessageboard/trailermessageboard.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end end function ENT:Use( ply, caller ) umsg.Start( "DermaPanel1", ply ) umsg.Short( "1" ) umsg.End() end[/CODE] [CODE]ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Quest's Sign :)" ENT.Spawnable = true[/CODE] [CODE]include("shared.lua") function ENT:Draw() self:DrawModel() end local function DermaPanel1() local DermaPanel1 = vgui.Create('DFrame') DermaPanel1:SetSize(100, 79) DermaPanel1:Center() DermaPanel1:SetTitle('Options') DermaPanel1:ShowCloseButton(true) DermaPanel1:SetSizable(false) DermaPanel1:SetDeleteOnClose(true) DermaPanel1:MakePopup() end usermessage.Hook( "DermaPanel1", DermaPanel1 )[/CODE] Can anyone help? When I press E on it, 4 open instead of one
Use this instead of your ENT:Use: [CODE] function ENT:Use( ply, caller ) if (ply.my_Ent_cool or 0) > CurTime() then return end ply.my_Ent_cool = CurTime() + 0.5 umsg.Start( "DermaPanel1", ply ) umsg.Short( "1" ) umsg.End() end [/CODE] Also you should use net messages instead of usermessages
Did you try to search this issue before? I think it gets posted almost 3 times EVERY WEEK You have to use SetUseType(SIMPLE_USE)
Edit: Didn't know [URL="https://wiki.garrysmod.com/page/Entity/SetUseType"] ENTITY:SetUseType[/URL] existed!
[QUOTE=Kevlon;52858531]Use this instead of your ENT:Use: [CODE] function ENT:Use( ply, caller ) if (ply.my_Ent_cool or 0) > CurTime() then return end ply.my_Ent_cool = CurTime() + 0.5 umsg.Start( "DermaPanel1", ply ) umsg.Short( "1" ) umsg.End() end [/CODE] Also you should use net messages instead of usermessages[/QUOTE] Thanks! I've changed it so it uses Derma_StringRequest . How would I put the String that is inputted on the entity using 3D2D?
[QUOTE=QuestG;52862124]Thanks! I've changed it so it uses Derma_StringRequest . How would I put the String that is inputted on the entity using 3D2D?[/QUOTE] With variables, a bit of networking and some simple coding ingenuity.
Sorry, you need to Log In to post a reply to this thread.