Don't reset m_iMenu if player is not fully joined (#537)

This commit is contained in:
Vincent Herbet 2018-09-03 18:39:08 +02:00 committed by GitHub
parent 76e92ae3a1
commit c6c4e79b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -1278,8 +1278,16 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
if (g_bmod_cstrike) if (g_bmod_cstrike)
{ {
enum JoinState { Joined = 0 };
enum MenuState { Menu_OFF = 0, Menu_ChooseTeam = 1, Menu_ChooseAppearance = 3 };
GET_OFFSET("CBasePlayer", m_iJoiningState);
GET_OFFSET("CBasePlayer", m_iMenu); GET_OFFSET("CBasePlayer", m_iMenu);
set_pdata<int>(pPlayer->pEdict, m_iMenu, 0);
if (get_pdata<int>(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
{
set_pdata<int>(pPlayer->pEdict, m_iMenu, Menu_OFF);
}
} }
return 0; return 0;

View File

@ -825,8 +825,16 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
if (g_bmod_cstrike) if (g_bmod_cstrike)
{ {
enum JoinState { Joined = 0 };
enum MenuState { Menu_OFF = 0, Menu_ChooseTeam = 1, Menu_ChooseAppearance = 3 };
GET_OFFSET("CBasePlayer", m_iJoiningState);
GET_OFFSET("CBasePlayer", m_iMenu); GET_OFFSET("CBasePlayer", m_iMenu);
set_pdata<int>(pPlayer->pEdict, m_iMenu, 0);
if (get_pdata<int>(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
{
set_pdata<int>(pPlayer->pEdict, m_iMenu, Menu_OFF);
}
} }
int time = -1; int time = -1;