mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
fixed a menu bug at19364
This commit is contained in:
parent
c5761610b8
commit
2ac00713a7
@ -48,6 +48,7 @@ void CPlayer::Init(edict_t* e, int i)
|
||||
aiming = 0;
|
||||
menu = 0;
|
||||
keys = 0;
|
||||
menuexpire = 0.0;
|
||||
|
||||
death_weapon.clear();
|
||||
name.clear();
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
|
||||
float time;
|
||||
float playtime;
|
||||
float menuexpire;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -925,6 +925,12 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
pPlayer->keys = keys;
|
||||
pPlayer->menu = menuid;
|
||||
|
||||
if (time == -1)
|
||||
pPlayer->menuexpire = INFINITE;
|
||||
else
|
||||
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
|
||||
|
||||
pPlayer->newmenu = -1;
|
||||
pPlayer->page = 0;
|
||||
UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen);
|
||||
@ -945,6 +951,12 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
pPlayer->keys = keys;
|
||||
pPlayer->menu = menuid;
|
||||
|
||||
if (time == -1)
|
||||
pPlayer->menuexpire = INFINITE;
|
||||
else
|
||||
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
|
||||
|
||||
pPlayer->newmenu = -1;
|
||||
pPlayer->page = 0;
|
||||
UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen);
|
||||
@ -2416,8 +2428,18 @@ static cell AMX_NATIVE_CALL get_user_menu(AMX *amx, cell *params) /* 3 param */
|
||||
|
||||
if (pPlayer->ingame)
|
||||
{
|
||||
if (gpGlobals->time > pPlayer->menuexpire)
|
||||
{
|
||||
pPlayer->menu = 0;
|
||||
*cpMenu = 0;
|
||||
*cpKeys = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*cpMenu = pPlayer->menu;
|
||||
*cpKeys = pPlayer->keys;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -716,6 +716,14 @@ void C_ClientCommand(edict_t *pEntity)
|
||||
|
||||
if (pPlayer->keys & bit_key)
|
||||
{
|
||||
if (gpGlobals->time > pPlayer->menuexpire)
|
||||
{
|
||||
pPlayer->menu = 0;
|
||||
pPlayer->keys = 0;
|
||||
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
int menuid = pPlayer->menu;
|
||||
pPlayer->menu = 0;
|
||||
|
||||
|
@ -354,6 +354,10 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
|
||||
|
||||
int player = params[1];
|
||||
int page = params[3];
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(player);
|
||||
|
||||
// This will set the expire time of the menu to infinite
|
||||
pPlayer->menuexpire = INFINITE;
|
||||
|
||||
return pMenu->Display(player, page);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user