Button function

Hello!
I am just wondering if there exist a button function on which player press the button and lose certain amount of money which is set up for the button, and when he buy it the item lets say a ak47 goes in his inventory or drops on the floor.

no theres no button function which takes the players money and spawns a ak47
hope this helped you out!

By button, do you mean keyboard key or a func_button entity on the map?

I assume you mean VGUI and derma buttons, you’d do something like this (but not literally this since stuff is missing)

Client:
[lua]
button.OnClick = function()
net.Start( “someClickFunc” )
net.SendToServer()
end
[/lua]

Server

[lua]
net.Recive( “someClickFunc”, function( len, ply )
– Do shit
end )
[/lua]

And add your network strings somewhere as well.

Yes derma buttons, but i need a function like i mentioned in upper message. This confuses me.

I just posted an example above your post. There is no predefined function for what you want to do, and the things you want are server-side, which is why you use the net library for this.

I already know that. Thank you.