Closed GLoOoccK closed 2 months ago
@SmileYzn
Problem is coming from this part of the code:
https://github.com/SmileYzn/LogApi/blob/main/LogApi/ReGameDLL.cpp#L138-L142
// Handle menu
if (gLogMenu[Player->entindex()].Handle(Player->entindex(), Q_atoi(parg1)))
{
// [...]
}
Commenting on this part of the code. New Menu System works again
Already fixed!
@SmileYzn
I tested the last action, it didn't work, it keeps replacing the New Menu System buttons
Perhaps you would have to create an identifier in the menu, for example:
https://github.com/SmileYzn/LogApi/blob/main/LogApi/LogMenu.cpp#L18-L31
this->m_IsLogApi = true;
Checking if it is a LogApi menu, before taking any action
I already have removed return of original client command function.
Test it now, i have removed other return in menu function.
@SmileYzn
I just tested it, it didn't work, I think it's because of this:
https://github.com/alliedmodders/amxmodx/blob/master/amxmodx/newmenus.cpp#L922-L925
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);
}
they are also setting this:
https://github.com/SmileYzn/LogApi/blob/main/LogApi/LogMenu.cpp#L231
Player->m_iMenu = Menu_OFF;
So that's why it's overwriting and causing a bug in the menu, because the code doesn't know how to differentiate, ending up entering this if:
https://github.com/SmileYzn/LogApi/blob/main/LogApi/LogMenu.cpp#L83-L107
So the real problem is in amxx?
Do not make any sense, LogAPI still do nothing with internal command ant problem still in logapi plugin?
@SmileYzn
AMXX is defining first:
Player->m_iMenu = Menu_OFF;
Soon after, for some reason, AMXX is calling InternalCommand, causing the code to enter the following if:
void ReGameDLL_InternalCommand(IReGameHook_InternalCommand* chain, edict_t* pEntity, const char* pcmd, const char* parg1)
{
// [...]
if (Player->m_iMenu == Menu_OFF)
{
// [...]
}
}
Running:
bool CLogMenu::Handle(int EntityIndex, int Key)
{
// [...]
if (Player->m_iMenu == Menu_OFF)
{
// [...]
}
}
Causing this part of the code to completely bug the menu, as it shouldn't get here, just the menu created by LogApi
Sorry, but still do not make sense.
In actual code LogAPI do not block InternalCommand, so AMXX still receiving normal InternalCommand, do not matter if an logapi menu is shown or not.
That:
if (Player->m_iMenu == Menu_OFF)
Do nothing in menus, and logapi only set it to Menu_OFF before display a menu.
@SmileYzn
Yes, but for some reason the AMXX menu is interacting with this piece of code:
if (Player->m_iMenu == Menu_OFF)
{
if (Key == 9)
{
this->Display(EntityIndex, ++this->m_Page);
}
else if (Key == 10)
{
this->Display(EntityIndex, --this->m_Page);
}
else
{
unsigned int ItemIndex = (Key + (this->m_Page * this->m_PageOption)) - 1;
if (ItemIndex < this->m_Data.size())
{
this->Hide(EntityIndex);
if (this->m_Func)
{
((void(*)(int, std::string Callback, P_MENU_ITEM))this->m_Func)(EntityIndex, this->m_Callback, this->m_Data[ItemIndex]);
}
}
}
return true;
}
It is not entering else at any time and giving a bug, i believe there should be some check like this:
if (Player->m_iMenu == Menu_OFF)
{
if (this->m_IsLogApi)
{
if (Key == 9)
{
this->Display(EntityIndex, ++this->m_Page);
}
// [...]
}
}
No is not interacting since:
if (this->m_Page != -1)
Only if menu is displaying a page, that here is not the case
Did you put the amxx before logapi or after in metamod plugins?
I did a new update on LogMenu.h see if is fixed now
With this last change it was resolved, now everything is fine. Thank you very much
@SmileYzn
Using the New Menu System from AMX Mod X, the page change options (8 and 9) are not working, along with other issues. When LogApi is disabled, it works normally
Example codes:
https://github.com/alliedmodders/amxmodx/blob/master/plugins/testsuite/menutest.sma