[SNIPPET] Timers done Easy (requires SM 1.7+)
1 Attachment(s)
This snippets makes it easy to make timers without having to make the timer function and then the callback timer callback.
This ugly and hacky looking wrapper does it in one move. It should also be noted that it's preferable to use this wrapper function for NON-Repeating timers. Example code! PHP Code:
Of course, due to the way it's structured, you can't use arrays or strings unless you modify it. Source Code Below
Spoiler
N-JOY :3 |
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
That's interesting! I probably won't use it, as I don't see any benefit for that right now, but still, great idea!
|
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
|
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
I would recommend not using CallFunction which is slow and not using the random and valid number -999 as a marker value.
|
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
I wanted the value to be placed as "null" but compiler bitched me at saying that I cannot make those null... "error 148: cannot assign null to a non-nullable type" Is there any other way to call a function inside a plugin other than Call_StartFunction? |
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
Would you still not recommend it for fire-once timers? Is it really so slow that it should be avoided for that case too? Would 2147... whatever max is, or min is, be okay in your opinion? Or 0, since afaik null is defined as 0 anyway. Just like INVALID_HANDLE was. Personally I'm not interested in this until switch (type) case bool case float is released, and getnumargs. |
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
|
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
Making timers requires making timer functions... This wrapper code makes ONE timer functions to be used on (almost) any function that needs to a timed callback. This code reduces the need to copypaste timer prototypes as there's already a timer made to callback the function you wish to use. |
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
Quote:
|
Re: [SNIPPET] Timers done Easy (requires SM 1.7)
whats the best code for fire once timer?
PHP Code:
PHP Code:
|
All times are GMT -4. The time now is 12:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.