hook to specific timestamp
Hello guys!
I want to hook to an specific timestamp per map and store a value to use in another timestamp. For example: When there are 5 minutes left in the map, I want to execute a vote and store the result. Then execute another function when there's 30 seconds of timeleft and use the previously stored value. Can you give me some hints in the right direction to achieve this? Also plugins that works in similar ways can be helpful so I can read them. |
Re: hook to specific timestamp
First of all, this should be in Suggestions/Request.
You can run tasks in your plugin_init(). Something like: Code:
set_task(get_timeleft() - 300.0, "Hook5MinutesRemaining");Code:
set_task(get_timeleft() - 30.0, "Hook30SecondsRemaining"); |
Re: hook to specific timestamp
Thank you, this is what I was looking for :)
|
Re: hook to specific timestamp
Quote:
PHP Code:
I added an extra check in my function but I think this shouldn't be the normal process. PHP Code:
|
Re: hook to specific timestamp
The "set_task" function has a flag that allows it to count the time until the end of the map:
Quote:
Code:
|
Re: hook to specific timestamp
Quote:
For the meantime I did some debugging and came across that PHP Code:
PHP Code:
EDIT: Your solution worked like a charm :) Thank you again |
Re: hook to specific timestamp
You should get cvar values inside "plugin_cfg" instead of "plugin_init". This is when all the config files have been read and the values have been updated.
|
Re: hook to specific timestamp
Quote:
|
| All times are GMT -4. The time now is 02:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.