• Simple question regarding putting keypresses on a timer
    2 replies, posted
Hello! I have a simple question that I am hoping can be addressed in the community. I am hoping to simply have some keypresses put on a timer so that they can automatically be toggled on perhaps a 5 or 10 second timer. This is for a construct that I am doing and I am trying to automate thruster action. I was looking for a tool on the workshop but perhaps this is something that can be taken care of simply by a scripting process on the console? Any help is appreciated.
[quote] concommand.Add( "omnitimer_start", function(ply,cmd,args) timer.Create( tostring(ply).."omnitimer", args[1] and 5 or 10, 0, function() MsgN("the wiki is your friend; http://wiki.garrysmod.com" ) end ) end ) concommand.Add( "omnitimer_stop", function( ply ) timer.Destroy( tostring(ply).."omnitimer" ) end ) [/quote] [url]http://wiki.garrysmod.com/page/Category:numpad[/url] or check gmod default binds on certain keys, or get your players to bind keys themselves.
Thanks. I appreciate the input. I'll admit I'm very new to programming but I think this should give me something to work with. Thanks. I'll go through the wiki and attempt to dissect the programming and understand this. I can see where in the script you created the timer argument, so I believe now I need to figure out how to put in the particular key binds that are needed. [editline]23rd February 2017[/editline] Also, can I execute this in the console? [editline]23rd February 2017[/editline] I've played around with this, so far I was able to copy the script into a LUA editor tool in Garrys Mod and execute it, as well as type "Omni_Timer" into the console to run the script, however, I cannot tell where I can edit the script to put the function to execute the keyboard presses for the timer. I looked through the functions on the Wiki but so far I do not think I have found what I needed.
Sorry, you need to Log In to post a reply to this thread.