so there is a ATM Ent that the menu of it is open by pressing "E" on it.
So this is the Hook " usermessage.Hook("bank_machine_menu", function(um) "
So i need a lua code that will open it for me (CLIENT side) it is possible )? ( without clicking e on it or being near it ).
If it is your server, just move the usermessage hook function out, then use usermessage.Hook( "blah", function_name ); and add a concommand.Add with the function...
You may need to change some other things because of the usermessage probably reading data...
Without seeing any code; that's really all I can say. I'd also recommend switching from umsg to net messages.
[QUOTE=Acecool;44968175]If it is your server, just move the usermessage hook function out, then use usermessage.Hook( "blah", function_name ); and add a concommand.Add with the function...
You may need to change some other things because of the usermessage probably reading data...
Without seeing any code; that's really all I can say. I'd also recommend switching from umsg to net messages.[/QUOTE]
Its not my server and i still wish to do what i described.. here is the code[CODE]include("shared.lua")
function ENT:Draw()
self:DrawModel()
local pos = self:GetPos() + self:GetUp() * 96 + self:GetUp() * math.sin(CurTime()) * 2
local ang = self:GetAngles()
ang:RotateAroundAxis(ang:Forward(), 90)
ang:RotateAroundAxis(ang:Right(), -90)
surface.SetFont("ChatFont")
local width, height = surface.GetTextSize("Bank Machine")
cam.Start3D2D(pos, ang, 0.3)
draw.WordBox(2, -width * 0.5, -height * 0.5, "Bank Machine", "ChatFont", Color(0, 0, 0, 150), Color(255, 255, 255, 255))
cam.End3D2D()
end
usermessage.Hook("bank_machine_menu", function(um)
local bank_amount = um:ReadLong()
local frame = vgui.Create("DFrame")
frame:SetSize(384, 256)
frame:Center()
frame:SetBackgroundBlur(true)
frame:SetDraggable(false)
frame:ShowCloseButton(false)
frame:SetTitle("Bank Machine")
frame:MakePopup()
local plist = vgui.Create("DPanelList", frame)
plist:StretchToParent(5, 27, 5, 5)
plist:SetPadding(5)
plist:SetSpacing(5)
plist.Paint = function()
draw.RoundedBox(4, 0, 0, plist:GetWide(), plist:GetTall(), Color(50, 50, 50))
end
local label = vgui.Create("DLabel", plist)
label:SetText(string.format(" Welcome to the bank! Your current balance is: $%s", bank_amount))
label:SizeToContents()
plist:AddItem(label)
local deposit = vgui.Create("DButton", plist)
deposit:SetText("Deposit Money")
deposit.DoClick = function()
Derma_StringRequest("Deposit Amount", "How much do you want to deposit?", 0, function(amnt)
RunConsoleCommand("bank_deposit", amnt)
RunConsoleCommand("bank_finish")
frame:Close()
end)
end
plist:AddItem(deposit)
local withdraw = vgui.Create("DButton", plist)
withdraw:SetText("Withdraw Money")
withdraw.DoClick = function()
Derma_StringRequest("Withdraw Amount", "How much do you want to withdraw?", 0, function(amnt)
RunConsoleCommand("bank_withdraw", amnt)
RunConsoleCommand("bank_finish")
frame:Close()
end)
end
plist:AddItem(withdraw)
local close = vgui.Create("DButton", plist)
close:SetText("Cancel")
close.DoClick = function()
RunConsoleCommand("bank_finish")
frame:Close()
end
plist:AddItem(close)
end)[/CODE]
Is that your code?
[QUOTE=Acecool;44968209]Is that your code?[/QUOTE]
No I'm just too lazy to go to the bank each time... so...
Sorry, you need to Log In to post a reply to this thread.