This site has been archived and made available for preservation purposes. No edits can be made.

CreateTimer

(Difference between revisions)
Return to current revision
  1. -
    Creates a timer.

    == Declaration ==
    <code cpp>
    VAULTSCRIPT vaultmp::Timer (*CreateTimer)(vaultmp::TimerFunc, vaultmp::Interval);
    native CreateTimer(const func{}, interval);
    </code>
    == Parameters ==

    '''[[TimerFunc|vaultmp::TimerFunc]]''' (C++ only) - the function of the timer

    '''func''' (PAWN only) - the name of the timer's function

    '''[[Interval|vaultmp::Interval]]''' - the timer interval in milliseconds

    == Return value ==

    Returns a [[Timer|vaultmp::Timer]] referring to the newly created timer.

    == Usage example (C++) ==

    <code cpp>
    void MyTimer()
    {
    // Timer function
    }

    void VAULTSCRIPT exec()
    {
    CreateTimer(&MyTimer, 5000);
    }
    </code>

    == Usage example (PAWN) ==

    <code c>
    forward MyTimer();

    public MyTimer()
    {
    // Timer function
    }

    main()
    {
    CreateTimer("MyTimer", 5000);
    }
    </code>