27.03.2018, 14:10
inline-timers
This include allows you to use inline functions as callbacks for timers, similiar to inline dialog callbacks and inline MySQL callbacks.
There is no support for passing extra arguments through this, because the variables (and arguments) in the parent function are accessible in the inline function as well due to a feature called “closuers”, thus rendering the usage of the extra arguments useless. This is however a feature of YSI itself and it has nothing to do with this include.
Installation
Simply install to your project:
GitHub: https://github.com/ltkarim/inline-timers
Include in your code and begin using the library:
Usage
Example:
Outputs:
Dependencies
To test, simply run the package:
Credits
This include allows you to use inline functions as callbacks for timers, similiar to inline dialog callbacks and inline MySQL callbacks.
There is no support for passing extra arguments through this, because the variables (and arguments) in the parent function are accessible in the inline function as well due to a feature called “closuers”, thus rendering the usage of the extra arguments useless. This is however a feature of YSI itself and it has nothing to do with this include.
Installation
Simply install to your project:
Code:
sampctl package install ltkarim/inline-timers
Include in your code and begin using the library:
PHP Code:
#include <inline-timers>
Usage
Example:
PHP Code:
new
someInt = 1337,
someStr[] = "hello world",
Float: someFloat = 1.337
;
inline TimerTest()
{
printf(" TimerTest called after 3 seconds! %i %s %0.3f", someInt, someStr, someFloat);
}
SetInlineTimer(using inline TimerTest, 3000, false);
Code:
TimerTest called! 1337, hello world, 1.337
- YSI
- y_malloc
- y_inline
To test, simply run the package:
Code:
sampctl package run