[INC/STOCK] menu_set_timeout
1 Attachment(s)
With this stock you can make a menu disappear after X seconds.
Code:
Example: Code:
Please note that if you're using AMXX 1.8.3, this stock is unnecessary, because AMXX already has an option like this: Code:
|
Re: [INC/STOCK] menu_set_timeout
Great snippet.
Don't make it an include. |
Re: [INC/STOCK] menu_set_timeout
While I agree that an include for this is unnecessary, if you do want it as an include and the function exists in AMX Mod X 1.8.3-dev then you might want to check the AMX Mod X version and conditionally disable the functions based on that.
|
Re: [INC/STOCK] menu_set_timeout
Even though it exists in 1.8.3, it doesn't exist in the earlier dev builds, so adding a version check might break the code. Is there a way to check the dev build with #if? The AMXX_VERSION_LOCAL_REV value is a string, so how do I check that, and how do I know in which dev build this was added?
|
Re: [INC/STOCK] menu_set_timeout
I personally think this is unnecessary, like, you just have to set a task and hide the menu inside the task. No need for someone to make a(n) stock/include for you. Anyways wouldn't enum be better than define for the Task ID?
|
Re: [INC/STOCK] menu_set_timeout
Quote:
|
Re: [INC/STOCK] menu_set_timeout
And menu_destroy() doesn't hide the specified menu, it destroys its internal AMXX handle.
|
Re: [INC/STOCK] menu_set_timeout
Quote:
Quote:
|
Re: [INC/STOCK] menu_set_timeout
Task ids are just numbers, doesn't matter how you save them. That will be decided by plugin's internal design. For example, if you want to index an array by some predefined values enum could be handy.
Example from WC3FT mod, where tasks are separated by player ids: Code:
#define TASK_ITEMS 0 // Showing items in the HUD Code:
enum ( += 32 ) |
Re: [INC/STOCK] menu_set_timeout
Quote:
Quote:
May be it was a pull request, so check them. https://github.com/alliedmodders/amx...pr+is%3Aclosed You could also find out where it is defined and do blame command on some git gui. Reviewing the history on the second link `master/amxmodx/newmenus.cpp` above should be enough. |
All times are GMT -4. The time now is 18:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.