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

CreateTimerEx

(Difference between revisions)
Return to current revision
  1. -
    Creates a timer with an argument list.

    == Declaration ==
    <code cpp>
    VAULTSCRIPT vaultmp::Timer (*CreateTimerEx)(vaultmp::Function, vaultmp::Interval, std::string, ...);
    native CreateTimerEx(const func{}, interval, const def{}, {Fixed,Float,_}:...);
    </code>
    == Parameters ==

    '''[[Function|vaultmp::Function]]''' (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

    '''def''' - the parameter list of the function. This is a string containing a sequence of:
    *i - Integer (4 byte)
    *l - Long integer (8 byte)
    *f - Floating-point (8 byte)
    *s - String (const char*)

    '''...''' - the arguments. Must match the previously defined definition.

    == Return value ==

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

    == Usage example (C++) ==

    <code cpp>
    Result VAULTSCRIPT MyTimer(unsigned int a, unsigned int b, const char* c)
    {
    // Timer function
    }

    void VAULTSCRIPT exec()
    {
    CreateTimerEx(reinterpret_cast<Function>(&MyTimer), 5000, "iis", 1, 2, "www.vaultmp.com");
    }
    </code>

    == Usage example (PAWN) ==

    <code c>
    forward MyTimer(a, b, const c{});

    public MyTimer(a, b, const c{})
    {
    // Timer function
    }

    main()
    {
    CreateTimerEx("MyTimer", 5000, "iis", 1, 2, "www.vaultmp.com");
    }
    </code>

    == Related pages ==

    *[[CreateTimer]]
    *[[KillTimer]]

    [[Category:VaultMP interface]]
    [[Category:Scripting functions]]
    [[Category:Misc functions]]