So i got my vending machine come out a button but i cannot figure out how to make it actually come out the item only problem i got
https://i.imgur.com/XbU4QzM.png
https://i.imgur.com/gr5UU5G.png
Client Side:
net.Receive( "PoliceVending", function()
local ReceivedEnt = net.ReadEntity()
if( not ReceivedEnt ) then return end
if( not IsValid( ReceivedEnt ) ) then return end
if( not IsValid( ReceivedEnt.PoliceVendingMachine ) ) then
ReceivedEnt.PoliceVendingMachine = vgui.Create("DFrame")
ReceivedEnt.PoliceVendingMachine:SetSize(300, 600)
ReceivedEnt.PoliceVendingMachine:Center()
ReceivedEnt.PoliceVendingMachine:SetTitle("")
ReceivedEnt.PoliceVendingMachine:SetDraggable(false)
ReceivedEnt.PoliceVendingMachine:SetSizable(true)
ReceivedEnt.PoliceVendingMachine:MakePopup()
ReceivedEnt.PoliceVendingMachine:ShowCloseButton( false )
ReceivedEnt.PoliceVendingMachine.Paint = function( self, w, h )
The Purchase Button Client Side:
local vendingmachinebutton = vgui.Create( "DButton", vendingmachinebackkkk)
vendingmachinebutton:SetPos( 200, 15)
vendingmachinebutton:SetSize( 300, 600)
vendingmachinebutton:SetFont( "buytext" )
vendingmachinebutton:SetTextColor( Color(200,200,200,200) )
vendingmachinebutton:SetExpensiveShadow( 2, Color(0,0,0, 200) )
vendingmachinebutton:SetText( "" )
vendingmachinebutton.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0,self:GetWide(),self:GetTall(),Color(40,40,40,0))
draw.SimpleText( PoliceLocker.Config.Language.PurchaseButton, "buytext", 30, 2, Color( 200, 200, 200, 200 ) )
end
function vendingmachinebutton:DoClick()
net.Start("GivePoliceVending")
net.WriteEntity( ReceivedEnt )
net.SendToServer()
end
end
else
ReceivedEnt.PoliceVendingMachine:SetVisible( true )
end
end )
Server Side:
net.Receive("GivePoliceVending", function(len, pl)
local recievedent = net.ReadEntity()
if( not recievedent ) then return end
if( not IsValid( recievedent ) ) then return end
local button = ents.Create( "gmod_button" )
if ( !IsValid( button ) ) then return end
button:SetModel( "models/dav0r/buttons/button.mdl" )
button:SetPos( recievedent:GetPos()+(recievedent:GetForward()*10) )
button:Spawn()
end)
dont spawn a gmod_button???
yes i tried this
SERVER SIDE:
net.Receive("GivePoliceVending", function(len, pl)
local recievedent = net.ReadEntity()
local item = net.ReadString()
if VendingMachineList[item] then
local vendingmachinemodel = VendingMachineList[item].model
local vendingentitiy = VendingMachineList[item].class
if( not recievedent ) then return end
if( not IsValid( recievedent ) ) then return end
recievedent:ResetSequence( "push" ) -- Play the open sequence
recievedent:SetSequence( "push" )
sound.Play( "buttons/bell1.wav", Vector( recievedent:GetPos() ) )
local button = ents.Create( vendingentitiy )
if ( !IsValid( button ) ) then return end
button:SetModel( vendingmachinemodel )
button:SetPos( recievedent:GetPos()+(recievedent:GetForward()*10) )
button:Spawn()
end
end)
Sorry, you need to Log In to post a reply to this thread.