Delay: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
No edit summary
Line 10: Line 10:
{{FuncParamOptional|UserArgs (optional)|The user arguments}}
{{FuncParamOptional|UserArgs (optional)|The user arguments}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns the id of this delay, same as for timers.}}


== Example ==
== Example ==

Revision as of 18:38, 30 August 2020

Delay

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Create a delayed function just like a timer but with once (DelayFor)

Syntax

Delay(Milliseconds, LuaFunction [, UserArgs])

Parameters

  • Milliseconds
    The interval in milliseconds.
  • LuaFunction
    The lua function name
  • UserArgs (optional) (optional)
    The user arguments

Return Value

  • Returns the id of this delay, same as for timers.

Example

AddEvent("OnPlayerSpawn", function(player)
	SetPlayerOutline(player, true)
	Delay(10000, function(player)
		SetPlayerOutline(player, false)
	end)
end)

See also