2025-05-27 09:56:36 -04:00
### Function: AddTimer(spawn, time, function, max_count, player)
2025-05-04 14:34:15 -04:00
**Description:**
2025-05-27 09:56:36 -04:00
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.
2025-05-04 14:34:15 -04:00
**Parameters:**
2025-05-27 09:56:36 -04:00
- `spawn` (Spawn) - Spawn object representing `spawn` .
- `time` (uint32) - Integer value `time` .
- `function` (string) - String `function` .
- `max_count` (uint32) - Integer value `max_count` .
- `player` (Spawn) - Spawn object representing `player` .
2025-05-04 14:34:15 -04:00
**Returns:** None.
**Example:**
```lua
2025-05-27 09:56:36 -04:00
-- 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
2025-05-04 14:34:15 -04:00
```