852 B
852 B
Function: AddTimer(spawn, time, function, max_count, player)
Description:
Adds a spawn script timer to call the function when triggering at the elapsed time. The player field can optionally be passed as a field to the function.
Parameters:
spawn
(Spawn) - Spawn object representingspawn
.time
(uint32) - Integer valuetime
.function
(string) - Stringfunction
.max_count
(uint32) - Integer valuemax_count
.player
(Spawn) - Spawn object representingplayer
.
Returns: None.
Example:
-- From ItemScripts/ForgeryFreeportCitizenshipPapers.lua
-- removed function AddTimer was in for simplifying example
AddTimer(Player,1000,"TaskDone",1)
function TaskDone(Item,Player)
CloseItemConversation(Item,Player)
if HasItem(Player,1001112) then
RemoveItem(Player,1001112,1)
end
end