Skip to content

Library: Timer

ᴏᴠ ━ ᴀɴɪꜱᴀ edited this page Dec 5, 2024 · 9 revisions

» Overview

Timers are essential for executing specific handlers at regular intervals. The default MTA timers have limitations, particularly when passing arguments like tables, as they don't pass arguments by reference.

» Importing

Add the below code globally once in either of the shared .lua script of the resource you want to use within:

loadstring(exports.assetify_library:import("timer"))()

» APIs

  • assetify.timer:getType() - shared

    Retrieve's instance's type.

    local string: type = self:getType()
  • assetify.timer:create() - shared

    Creates a new timer.

    local timer: cTimer = assetify.timer:create(
       function: exec,
       int: interval,
       int: executions,
       ~: ...arguments
    )
  • assetify.timer:destroy() - shared

    Destroys an existing timer.

    local bool: result = self:destroy()