• [Need Help] RunConsoleCommand
    4 replies, posted
[CODE] if(GD.bools["miscbhop"]) then RunConsoleCommand("lenny_bhop", "1") else RunConsoleCommand("lenny_bhop", "0") end[/CODE] So bascily if BHOP = on. it will Run console command to but it on. same as off. but the problem is its spamming it. for example if bhop will be off/on. it i will do [CODE]RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' RunConsoleCommand: 'lenny_bhop 0 ;' R[/CODE]
Full code [editline]26th June 2014[/editline] pls
Holy shit. Honestly you don't really need to use runconsolecommand unless the command is built into the game and you can't access/replicate it with Lua(you don't really need to, no point in reinventing the wheel).
help
To prevent spam, you'd need a strictly controlled toggle if it is run in a loop or hook ran every frame/think/tick... Basically an if elseif with 2 parameters each, one being the status variable which is changed and a controller. For example, if you want to press a button in a Think hook and have it only fire once per click, or once on click and once on release, you'd do this: It can also be done using KeyPressed / KeyReleased. This one acts differently in Think, if you use a KeyPressed without a KeyReleased it will continue spamming. Pairing them gives desired results: Turned into "tutorial" / Code-example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/logic/controlled_toggles.lua.html[/url] -- remove .html to view .lua ( no highlighting in browser which is why I export as html, but copy/paste won't work unless using .lua ) Hopefully this helps. I still have no idea what you're trying to do, but if you're trying to prevent it from being spammed, a controlled-toggle may be what you're trying to do... I'd advise against using console commands for movement / bhop, etc... You can use the movement hooks like SetupMove, CreateMove, OnPlayerHitGround, etc.... to control auto-jumping more elegantly.
Sorry, you need to Log In to post a reply to this thread.