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.
    [h="2"] Declaration [/h]
  2. -
    <code cpp>
  3. +
    [highlight=cpp]
  4.  
    VAULTSCRIPT vaultmp::Timer (*CreateTimer)(vaultmp::Function, vaultmp::Interval);
    native CreateTimer(const func{}, interval);
  5. -
    </code>
  6. +
    [/highlight]
  7.  
    [h="2"] Parameters [/h]
    [b][wiki="Function"]vaultmp::Function[/wiki][/b] (C++ only) - the function of the timer
    [b]func[/b] (PAWN only) - the name of the timer's function
    [b][wiki="Interval"]vaultmp::Interval[/wiki][/b] - the timer interval in milliseconds
    [h="2"] Return value [/h]
    Returns a [wiki="Timer"]vaultmp::Timer[/wiki] referring to the newly created timer.
    [h="2"] Usage example (C++) [/h]
  8. -
    <code cpp>
  9. +
    [highlight=cpp]
  10.  
    vaultmp::Result VAULTSCRIPT MyTimer()
    {
    // Timer function
    return 0;
    }
  11. -
    void VAULTSCRIPT exec()
  12. +
    vaultmp::Void VAULTSCRIPT exec()
  13.  
    {
    CreateTimer(&MyTimer, 5000);
    }
  14. -
    </code>
  15. +
    [/highlight]
  16.  
    [h="2"] Usage example (PAWN) [/h]
  17. -
    <code c>
  18. +
    [highlight=c]
  19.  
    forward MyTimer();
    public MyTimer()
    {
    // Timer function
    return 0;
    }
    main()
    {
    CreateTimer("MyTimer", 5000);
    }
  20. -
    </code>
  21. +
    [/highlight]
  22.  
    [h="2"] Related pages [/h]
    [list][*][wiki]CreateTimerEx[/wiki]
    [*][wiki]KillTimer[/wiki]
    [/LIST]
    [category]VaultMP interface[/category]
    [category]Scripting functions[/category]
    [category]Misc functions[/category]