• Button to activate lua function
    2 replies, posted
Hi I'm new to gmod, and I learned a bit about lua scripting from gmod wiki. I need a way that when the player presses a button, a function happens, with a different function for different buttons. I have an idea for a great game, and this is the last thing I need. I mean a button like one placed by the button tool, or something similar to that. What I'm making is a system where when the player presses a specific button, they lose a certain amount of money, which is saved to a variable, then get ammo for a specific weapon. Different buttons throughout the map give different wepons and ammo. I already have the code to pay for and spawn the weapon, I just need a button to activate it. Also, is there any way to set where the player(s) spawn(s) when the map first loads, and after that?
Are you talking about a Derma Button. If so try this [lua] DButton.DoClick = function() --Action end [/lua] Replace DButton with the name of your button.
Sorry, you need to Log In to post a reply to this thread.