[Solved]Need help even I USED THE WIKI!!!!
#1

So, I want to make a menu to make a video so I don't want to do something with it. I only want to open it.
But I've got an error in the AddMenuItem. And a warning of idk

Here is my pawn code so far:
Код:
#include <a_samp>

new Menu:levelmenu;

public OnGameModeInit()

levelmenu = CreateMenu("levelmenu", 2, 55.0, 200.0, 100.0);

AddMenuItem(levelmenu, 0, "Dam");
AddMenuItem(levelmenu, 0, "Facility");
AddMenuItem(levelmenu, 0, "Runway");
AddMenuItem(levelmenu, 0, "Surface");
AddMenuItem(levelmenu, 0, "Bunker");
AddMenuItem(levelmenu, 0, "Silo");
AddMenuItem(levelmenu, 0, "Frigate");
AddMenuItem(levelmenu, 0, "Surface");
AddMenuItem(levelmenu, 0, "Bunker");
AddMenuItem(levelmenu, 0, "Statue");
AddMenuItem(levelmenu, 0, "Archives");
AddMenuItem(levelmenu, 0, "Streets");
AddMenuItem(levelmenu, 0, "Depot");
AddMenuItem(levelmenu, 0, "Train");
AddMenuItem(levelmenu, 0, "Jungle");
AddMenuItem(levelmenu, 0, "Control");
AddMenuItem(levelmenu, 0, "Caverns");
AddMenuItem(levelmenu, 0, "Cradle");
AddMenuItem(levelmenu, 0, "Aztec");
AddMenuItem(levelmenu, 0, "Egyptian");
The Error:
Код:
(9) : error 021: symbol already defined: "AddMenuItem"
(7) : warning 204: symbol is assigned a value that is never used: "levelmenu"
Can somebody please help?
Reply
#2

RIGHT WAY:

AddMenuItem(examplemenu, 0, "item row 1");
AddMenuItem(examplemenu, 1, "item row 2");

I bolded what you did wrong. If you havent figured it out yet, You dont do AddMenuItem(MENU,0,"NAME");

You do AddMenuItem(MENU,ID (0,1,2,3,4,5,6,7 etc),"NAME");
Reply
#3

What he did wrong was he didn't put "AddMenuItem" into a callback, therefore he's redefining it.

Correct Use:
pawn Код:
OnGameModeInit()
{
  AddMenuItem(examplemenu,0,"Barbecue Sauce");
}
EDIT*: Now I don't work with menus simply because I make my own customized menus with TextDraws, but I thought the second parameter in "AddMenuItem" was the column, and not row. What I mean is, if he did
pawn Код:
OnGameModeInit()
{
  AddMenuItem(examplemenu,0,"Barbecue Sauce");
  AddMenuItem(examplemenu,1,"Ketchup");
  AddMenuItem(examplemenu,2,"Mustard");
}
It would look like
"Barbecue Sauce Ketchup Mustard"
and the player would only be able to select "Barbecue Sauce"
so I think it's supposed to be
pawn Код:
OnGameModeInit()
{
  AddMenuItem(examplemenu,0,"Barbecue Sauce");
  AddMenuItem(examplemenu,0,"Ketchup");
  AddMenuItem(examplemenu,0,"Mustard");
}
Reply
#4

WHAT? only forgot a goddamn {? omg. but thanks that helped. Now I need a command to open the menu.
I post back here if I have problems.

EDIT: Thanks. it worked.

I have this now
Код:
#include <a_samp>

new Menu:levelmenu;

public OnGameModeInit()
{

levelmenu = CreateMenu("levelmenu", 2, 55.0, 200.0, 100.0);

AddMenuItem(levelmenu, 0, "Dam");
AddMenuItem(levelmenu, 0, "Facility");
AddMenuItem(levelmenu, 0, "Runway");
AddMenuItem(levelmenu, 0, "Surface");
AddMenuItem(levelmenu, 0, "Bunker");
AddMenuItem(levelmenu, 0, "Silo");
AddMenuItem(levelmenu, 0, "Frigate");
AddMenuItem(levelmenu, 0, "Surface");
AddMenuItem(levelmenu, 0, "Bunker");
AddMenuItem(levelmenu, 0, "Statue");
AddMenuItem(levelmenu, 0, "Archives");
AddMenuItem(levelmenu, 0, "Streets");
AddMenuItem(levelmenu, 0, "Depot");
AddMenuItem(levelmenu, 0, "Train");
AddMenuItem(levelmenu, 0, "Jungle");
AddMenuItem(levelmenu, 0, "Control");
AddMenuItem(levelmenu, 0, "Caverns");
AddMenuItem(levelmenu, 0, "Cradle");
AddMenuItem(levelmenu, 0, "Aztec");
AddMenuItem(levelmenu, 0, "Egyptian");
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/levelmenu", true))	{
  	   ShowMenuForPlayer(levelmenu, playerid);
  	   return 1;
	}
	return 0;
}
Reply
#5

Isn't that too many options? I thought max was 12 or something.
Reply
#6

Yes, that was too many. so I have 10 and Will script other menus for my video. If you know Goldeneye 007 on N64 and the sa-mp FPS bug, I will post a video in this topic. Thanks for the help all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)