Simulation of the "wait" command

I’d like a LUA script that gives a console command that functions similar to the “wait” command. The built-in wait command mysteriously vanished in a Gmod update.

The wait command is what it does. It waits. In specific, it waits for exactly a frame or a number of frames specified and is used in conjunction with other console commands (e.i. “+left;wait 50;-left” would tell the console to turn the player to the left until 50 frames has passed).

This works some sorta the same, but the command syntax will change a bit:

local function wait(p,c,a)
local time = tonumber(a[1] or 1)
local cmd = tostring(a[2] or “”)



– Usage:
– attack; wait 50 -attack; wait 50 +attack; wait 50 -attack

If you know how to use it of course.

You are opening a gaping hole for server owners to exploit you.
But I assume you know the risks of using it of course.

Yeah, but I doubt that there are any servers using the exploit (anymore)
I had a server up for awhile that was using it (like 6 months ago…), the exploit has been around for a long time. I wasn’t using it for anything real malicious though, only for some fun stuff to annoy players.

I believe you want to change this, as the wait command is incremental relative to it’s statement within a dispatch, not asynchronous.


(I think.)

Works up to a degree I’m satisfied with, thanks. The only tiny thing that bugs me is the fact that looping alias commands still don’t function. Not that it matters.