Menus index that m_iMenu players private data takes, and corresponding keys.
m_iMenu is 205 (linux diff = 5 as any other
player pdata offsets) and has been founded by VEN.
Code:
|----------------------------------------------------------------|
| | | |
| Menu Name | PData | Keys |
| | | |
|----------------------------------------------------------------|
| #Team_Select_Spect | 1 | 1 2 5 6 |
| #IG_Team_Select_Spect | 1 | 1 2 5 6 0 |
| #IG_Team_Select | 1 | 1 2 5 0 |
| #IG_VIP_Team_Select | 1 | 1 2 3 5 0 |
| #IG_VIP_Team_Select_Spect | 1 | 1 2 3 5 6 0 |
|----------------------------------------------------------------|
| #Terrorist_Select | 3 | 1 2 3 4 5 |
| #CT_Select | 3 | 1 2 3 4 5 |
|----------------------------------------------------------------|
| #Buy | 4 | 1 2 3 4 5 6 7 8 0 |
|----------------------------------------------------------------|
| #T_BuyPistol | 5 | 1 2 3 4 5 0 |
| #CT_BuyPistol | 5 | 1 2 3 4 5 0 |
|----------------------------------------------------------------|
| #T_BuyRifle | 6 | 1 2 3 4 5 6 0 |
| #CT_BuyRifle | 6 | 1 2 3 4 5 6 0 |
| #AS_T_BuyRifle | 6 | 1 2 5 0 |
| #AS_CT_BuyRifle | 6 | 1 3 4 5 0 |
|----------------------------------------------------------------|
| #BuyMachineGun | 7 | 1 0 |
| #AS_T_BuyMachineGun | 7 | 0 |
|----------------------------------------------------------------|
| #BuyShotgun | 8 | 1 2 0 |
| #AS_BuyShotgun | 8 | 0 |
|----------------------------------------------------------------|
| #T_BuySubMachineGun | 9 | 1 2 3 4 0 |
| #CT_BuySubMachineGun | 9 | 1 2 3 4 0 |
| #AS_T_BuySubMachineGun | 9 | 1 3 0 |
| #AS_CT_BuySubMachineGun | 9 | 1 2 3 4 0 |
|----------------------------------------------------------------|
| #DCT_BuyItem | 10 | 1 2 3 4 5 6 7 8 0 |
| #DT_BuyItem | 10 | 1 2 3 4 5 6 0 |
| #T_BuyItem | 10 | 1 2 3 4 5 6 0 |
| #CT_BuyItem | 10 | 1 2 3 4 5 6 8 0 |
|----------------------------------------------------------------|
| #RadioA | 11 | 1 2 3 4 5 6 0 |
|----------------------------------------------------------------|
| #RadioB | 12 | 1 2 3 4 5 6 0 |
|----------------------------------------------------------------|
| #RadioC | 13 | 1 2 3 4 5 6 7 8 9 0 |
|----------------------------------------------------------------|
Plugin used (don't pay attention at aweful code, arkshine asked me to post it):
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define VERSION "0.0.1"
#define MAX_PLAYERS 32
#define XO_PLAYER 5
#define m_iMenu 205
#define cs_get_user_menu(%1) get_pdata_int(%1, m_iMenu, XO_PLAYER)
enum _:ShowMenuDatas {
iKeysBitSum,
szText[32]
}
new Trie:g_tMenus
new g_szDataFile[128]
new g_mLastMenuDatas[MAX_PLAYERS+1][ShowMenuDatas]
public plugin_init()
{
register_plugin("Players Menu Logger", VERSION, "ConnorMcLeod")
g_tMenus = TrieCreate()
get_localinfo("amxx_logs", g_szDataFile, charsmax(g_szDataFile))
add(g_szDataFile, charsmax(g_szDataFile), "/Menus.log")
Read_StoredMenus_File()
register_event("ShowMenu", "Event_ShowMenu", "b", "1>0")
register_clcmd("menuselect", "menuselect")
}
Read_StoredMenus_File()
{
new iFile = fopen(g_szDataFile, "r")
if( iFile )
{
new szDatas[255], szMenu[128]
while( !feof(iFile) )
{
fgets(iFile, szDatas, charsmax(szDatas))
trim(szDatas)
parse(szDatas, szMenu, charsmax(szMenu))
TrieSetCell(g_tMenus, szMenu, 1)
}
fclose(iFile)
}
iFile = fopen(g_szDataFile, "a")
fprintf(iFile, "|----------------------------------------------------------------|^n")
fprintf(iFile, "| | | |^n")
fprintf(iFile, "| Menu Name | PData | Keys |^n")
fprintf(iFile, "| | | |^n")
fprintf(iFile, "|----------------------------------------------------------------|^n")
fclose(iFile)
}
/*Name: ShowMenu
Structure:
short KeysBitSum
char Time
byte Multipart
string Text */
public Event_ShowMenu( id )
{
g_mLastMenuDatas[id][iKeysBitSum] = read_data(1)
read_data(4, g_mLastMenuDatas[id][szText], charsmax(g_mLastMenuDatas[][szText]))
}
public menuselect( id )
{
if( pev_valid(id) < 2 )
{
return
}
new szMenu[32]
copy(szMenu, charsmax(szMenu), g_mLastMenuDatas[id][szText])
if( !TrieKeyExists(g_tMenus, szMenu) )
{
TrieSetCell(g_tMenus, szMenu, 1)
new szKeys[20], iKeys = g_mLastMenuDatas[id][iKeysBitSum], n, k
for(new i=0; i<=9; i++)
{
k = i+1
if( k == 10 )
{
k = 0
}
n += formatex(szKeys[n], charsmax(szKeys)-n, (iKeys & (1<<i)) ? "%d " : " ", k)
}
new iFile = fopen(g_szDataFile, "a")
fprintf(iFile, "| %32s | %5d | %19s |^n", szMenu, cs_get_user_menu(id), szKeys)
fclose(iFile)
}
}
public plugin_end()
{
TrieDestroy( g_tMenus )
new iFile = fopen(g_szDataFile, "a")
fprintf(iFile, "|----------------------------------------------------------------|^n^n")
fclose(iFile)
}
Thanks to new IDA version, menu indexes names are now known :
PHP Code:
const m_iMenu = 205;
enum Menu
{
Menu_OFF,
Menu_ChooseTeam,
Menu_IGChooseTeam,
Menu_ChooseAppearance,
Menu_Buy,
Menu_BuyPistol,
Menu_BuyRifle,
Menu_BuyMachineGun,
Menu_BuyShotgun,
Menu_BuySubMachineGun,
Menu_BuyItem,
Menu_Radio1,
Menu_Radio2,
Menu_Radio3,
Menu_ClientBuy
}
stock Menu:cs_get_user_menu(id)
{
return Menu:get_pdata_int(id, m_iMenu);
}
stock cs_set_user_menu(id, {_,Menu}:menu = _:Menu_OFF)
{
set_pdata_int(id, m_iMenu, menu);
}
__________________