I am currently working on a Vending machine for DarkRP (Yeah yeah.)
Anyways, this is my first attempt at using derma screens. So currently the idea is that when I ‘use’ the vending machine a single derma screen will appear.
The problem is that when I use it, multiple derma screens appear. This changes based on how long I hold it.
Here is the code:
[lua] AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
local phys = self:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
function ENT:AcceptInput( Name, Activator, Caller )
if Name == “Use” and Caller:IsPlayer() then
local pShop = vgui.Create('DFrame') pShop:SetSize(330, 400) pShop:SetPos(ScrW()-850, ScrH()-600) pShop:SetTitle('Vendor') pShop:SetSizable(true) pShop:SetDeleteOnClose(false) pShop:MakePopup()
usermessage.Hook(“displayvend”, DisplayVend) [/lua]
I think that I may need to have a sort of ‘delay’ in between presses. Sadly I do not know how.
Can anyone help me. I would be thankful.