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

CreateTimer

This is an old revision of this page, as edited 09-28-2011, 07:45 PM by . It may differ significantly from the current revision.
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>