• Lua Time before player can run console command again
    3 replies, posted
I'm looking for a way to make it so a player cannot run a console command if they ran it 10 or less minutes ago, and it will give an error message. Any tips on how to do this?
[code]local variable = false -- In the command -- if variable then ply:ChatPrint( "Command on cooldown!" ) return end variable = true timer.Simple( 600, function() variable = false end )[/code]
[QUOTE=code_gs;47888952][code]local variable = false -- In the command -- if variable then ply:ChatPrint( "Command on cooldown!" ) return end variable = true timer.Simple( 600, function() variable = false end )[/code][/QUOTE] Thank you code_gs! Works flawlessly.
You're doing the command clientside, right? A serverside variable will be changed whenever anyone uses the command, and it will apply for all players instead of just one. If you want to do it serverside, consider adding a variable to the player entity itself. Also, if you're doing it clientside, anyone could simply bypass your attempts to limit the command.
Sorry, you need to Log In to post a reply to this thread.