timer.Simple
Example
Print Hello World
after 5 seconds.
Output:
Hello World
Example
Spawns 5 zombies and creates a timer.Simple that removes them in 11, 12, 13, 14, and 15 seconds.
for i = 1, 5 do
local zombie = ents.Create( "npc_zombie" )
zombie:SetPos( Vector( i * 40, 0, 250 ) )
zombie:Spawn()
timer.Simple( 10 + i, function() zombie:Remove() end )
end
Output:
-- 11 seconds into game 1st zombie disappears
-- 12 seconds into game 2nd zombie disappears
etc.