View Single Post
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 05-25-2017 , 00:56   Re: Using CreateDataTimer
Reply With Quote #23

CreateDataTimer is a wrapper for CreateTimer, perhaps understanding what it does might help you.

Code:
/**
 * Creates a timer associated with a new datapack, and returns the datapack.
 * @note The datapack is automatically freed when the timer ends.
 * @note The position of the datapack is not reset or changed for the timer function.
 *
 * @param interval			Interval from the current game time to execute the given function.
 * @param func				Function to execute once the given interval has elapsed.
 * @param datapack			The newly created datapack is passed though this by-reference 
 *							parameter to the timer callback function.
 * @param flags				Timer flags.
 * @return					Handle to the timer object.  You do not need to call CloseHandle().
 */
stock Handle CreateDataTimer(float interval, Timer func, Handle &datapack, int flags=0)
{
	datapack = new DataPack();
	flags |= TIMER_DATA_HNDL_CLOSE;
	return CreateTimer(interval, func, datapack, flags);
}
__________________
Chaosxk is offline