SA-MP Forums Archive
menu item is not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: menu item is not working (/showthread.php?tid=147967)



menu item is not working - Andy_McKinley - 15.05.2010

I made a menu item that teleports a player. But when I select it with spacebar it doesn't do anything...

pawn Код:
new Menu:skydive;
pawn Код:
new Menu:CurrentMenu;
pawn Код:
skydive = CreateMenu("Skydive", 2, 200.0, 100.0, 150.0, 150.0);
    AddMenuItem(skydive, 0, "Mount Chilliad");
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)

if(CurrentMenu == skydive)
{
  switch(row)
  {
    case 0: //Mount Chilliad
    {
      ResetPlayerWeapons(playerid);
      SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
      GivePlayerWeapon(playerid, 46, 1);
    }
  }
}



Re: menu item is not working - 0ne - 15.05.2010

Lol

pawn Код:
new Menu:CurrentMenu;
if(CurrentMenu == skydive)
Epic fail code

remove new menu: Currentmenu, and do like this:

pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == skydive)
{
  switch(row)
  {
    case 0: //Mount Chilliad
    {
      ResetPlayerWeapons(playerid);
      SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
      GivePlayerWeapon(playerid, 46, 1);
    }
  }
}
return 1;
}



Re: menu item is not working - Andy_McKinley - 15.05.2010

Quote:
Originally Posted by 0ne
Lol

pawn Код:
new Menu:CurrentMenu;
if(CurrentMenu == skydive)
Epic fail code

remove new menu: Currentmenu, and do like this:

pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == skydive)
{
  switch(row)
  {
    case 0: //Mount Chilliad
    {
      ResetPlayerWeapons(playerid);
      SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
      GivePlayerWeapon(playerid, 46, 1);
    }
  }
}
return 1;
}
I don't understand the above... I had no experience with menu's, but I have it like you said now:
pawn Код:
//menu's
new Menu:skydive;
new Menu:CurrentMenu;
if(CurrentMenu == skydive)
But I get errors and warnings.


Re: menu item is not working - 0ne - 15.05.2010

Dude,

Quote:

remove new menu: Currentmenu, and do like this:

new Menu:Currentmenu; THIS line creates the menu, it doesn't get the player menu use this:

pawn Код:
new Menu:CurrentMenu = GetPlayerMenu(playerid);
this should be below onplayerselectedmenurow, and the rest code is fine.

edit: Oh and u missed a opening bracket onselectedmenurow, and a closing one