14.12.2011, 11:27
Hello fellow scripters. I have a problem with menus. In the past i have only used dialogs, but i like the look of standard menu's. I'm writing a shop script for the server i script for and have hit a snag. I'm hoping someone can shed light on the matter. Here's the code please tell me if i'm doing something wrong.
Like the title suggests the callback is never called, any idea's why?
2x rep points for the person who helps.
Thanks in advance!
pawn Код:
#define AMMO_MENU (0)
enum E_SHOP_DATA
{
Menu:e_mShopMainMenu,
Menu:e_mShopAmmoMenu,
}
new gShopData[E_SHOP_DATA];
ISHOP::CreateShopMenu()//is called in OnGameModeInit
{
//main menu
gShopData[e_mShopMainMenu] = CreateMenu("Shop", 1, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(gShopData[e_mShopMainMenu], 0, "Ammo");
//Ammo Menu
gShopData[e_mShopAmmoMenu] = CreateMenu("Ammo", 2, 100.0, 250, 150.0, 150.0);
AddMenuItem(gShopData[e_mShopAmmoMenu], 0, "Armour Piercing");
AddMenuItem(gShopData[e_mShopAmmoMenu], 1, "$50000");
AddMenuItem(gShopData[e_mShopAmmoMenu], 0, "Hollow Point");
AddMenuItem(gShopData[e_mShopAmmoMenu], 1, "$50000");
}
public OnPlayerSelectedMenuRow(playerid, row)//never gets executed
{
new Menu:mPlayerMenu = GetPlayerMenu(playerid);
printf("ROW: %d", row);//never prints
if(mPlayerMenu == gShopData[e_mShopMainMenu])
{
switch(row)
{
case AMMO_MENU:
{
ShowMenuForPlayer(gShopData[e_mShopAmmoMenu], playerid);
return 1;
}
}
}
return 1;
}
COMMAND:shop(playerid, params[])
{
ShowMenuForPlayer(gShopData[e_mShopMainMenu], playerid);
return 1;
}
2x rep points for the person who helps.
Thanks in advance!