1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. GTA Network forum is now in archive mode.

[TypeScript] Client-side timer system

Discussion in 'Scripts' started by don, Apr 12, 2017.

  1. don

    don Member Donator

    Messages:
    9
    Likes Received:
    2
    Joined:
    Dec 23, 2016
    Made this client-side timer system some time ago, might as well share it. This is a single TypeScript class.

    Make sure you call Timer.handleTimers(); in onUpdate.

    How to use:
    new Timer(interval in ms, is timer repeating, callback)

    Example:
    Creating a timer:

    var timer = new Timer(1000, true, () => {
    API.sendChatMessage("This message is sent every second.")
    });

    Stopping the created timer:
    timer.stop();

    Download:
    https://pastebin.gtanet.work/?ba4b7e90930ced60#7EBvBuO4qHVC3N3IHcZHfB7vFpSkRhpNBUcPwPczIs4=
     
    Last edited: Apr 13, 2017

Share This Page