Skip to content

Commit 42c0ddd

Browse files
committed
Add aborting auto close task if menu used
1 parent 85c4b9b commit 42c0ddd

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

amxmodx/scripting/VipM-L-GameCMS.sma

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#define GCMS_GROUP_NAME_MAX_LEN (MAX_NAME_LENGTH * 2)
88
#endif
99

10+
#if !defined GCMS_SERVICE_NAME_MAX_LEN
11+
#define GCMS_SERVICE_NAME_MAX_LEN (MAX_STRING_LEN * 2)
12+
#endif
13+
1014
#pragma semicolon 1
1115
#pragma compress 1
1216

@@ -49,7 +53,7 @@ public VipM_OnInitModules() {
4953
}
5054

5155
@OnServiceCheck(const Trie:Params, const UserId) {
52-
new sServiceName[32];
56+
new sServiceName[GCMS_SERVICE_NAME_MAX_LEN];
5357
VipM_Params_GetStr(Params, "Service", sServiceName, charsmax(sServiceName));
5458

5559
return cmsapi_service_timeleft(UserId, .srvName=sServiceName, .part=false) > TIME_TRACKING_STOPPED;

amxmodx/scripting/VipM-M-WeaponMenu.sma

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ public VipM_OnInitModules() {
132132
show_menu(UserId, 0, "");
133133
}
134134

135-
// TODO: Придумать как лучше использовать...
136-
// AbortAutoCloseMenu(const UserId) {
137-
// if (task_exists(TASK_OFFSET_AUTO_CLOSE + UserId)) {
138-
// remove_task(TASK_OFFSET_AUTO_CLOSE + UserId);
139-
// }
140-
// }
135+
AbortAutoCloseMenu(const UserId) {
136+
if (task_exists(TASK_OFFSET_AUTO_CLOSE + UserId)) {
137+
remove_task(TASK_OFFSET_AUTO_CLOSE + UserId);
138+
}
139+
}
141140

142141
@Cmd_SwitchAutoOpen(const UserId) {
143142
gUserAutoOpen[UserId] = !gUserAutoOpen[UserId];

amxmodx/scripting/VipM/WeaponMenu/Menus.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ Menu_WeaponsMenu(const UserId, const MenuId, const Menu[S_WeaponMenu]) {
8787
}
8888

8989
@MenuHandler_Command(const UserId, const MenuId, const ItemId){
90+
AbortAutoCloseMenu(UserId);
91+
9092
if (ItemId == MENU_EXIT) {
9193
menu_destroy(MenuId);
9294
return;

0 commit comments

Comments
 (0)