menu problem
#1

i got a problem with the menu

each time i want to open it it crashes

but when i compile no warnings or errors here is it

new Menu:Gunmenu;

Gunmenu = CreateMenu("Emmet's gun store", 1,20,120,150,40);

AddMenuItem(Gunmenu, 0, "Meele weapons");
AddMenuItem(Gunmenu, 0, "Handguns");
AddMenuItem(Gunmenu, 0, "Shotguns");
AddMenuItem(Gunmenu, 0, "Machine guns");
AddMenuItem(Gunmenu, 0, "Assault Rifles");
AddMenuItem(Gunmenu, 0, "Rifles");
AddMenuItem(Gunmenu, 0, "Exit");


if(strcmp("/buyweapon", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, 2441.9558,-1973.5205,13.5469) || IsPlayerInRangeOfPoint(playerid,1.5,2442.4368,-1979.7991,13.5469))
{
ShowMenuForPlayer(Gunmenu,playerid);
SendClientMessage(playerid,RED, "Emmet: Welcome to my gun shop young man! This is the best merchandise in South Central, come and pick your gun, soldier!");
TogglePlayerControllable(playerid,0);
return 1;
}
else
{
SendClientMessage(playerid,RED,"INFO: You're not at emmet's gunshop!");
}
return 1;
}



if(GetPlayerMenu(playerid) == Gunmenu)
{
switch(row)
{
case 0: //Melee weapons
{
ShowMenuForPlayer(Melee,playerid);
HideMenuForPlayer(Gunmenu,playerid);
TogglePlayerControllable(playerid,0);
}
case 1: //Handguns
{
HideMenuForPlayer(Gunmenu,playerid);
ShowMenuForPlayer(Handguns,playerid);
TogglePlayerControllable(playerid,0);
}
case 2: //Shotguns
{
HideMenuForPlayer(Gunmenu,playerid);
ShowMenuForPlayer(Shotguns,playerid);
TogglePlayerControllable(playerid,0);
}
case 3: //Machine guns
{
HideMenuForPlayer(Gunmenu,playerid);
ShowMenuForPlayer(Machine,playerid);
TogglePlayerControllable(playerid,0);
}
case 4: //Assault Rifles
{
HideMenuForPlayer(Gunmenu,playerid);
ShowMenuForPlayer(Assault,playerid);
TogglePlayerControllable(playerid,0);
}
case 5: //Rifles
{
HideMenuForPlayer(Gunmenu,playerid);
ShowMenuForPlayer(Rifle,playerid);
TogglePlayerControllable(playerid,0);
}
case 6: //Exit
{
HideMenuForPlayer(Gunmenu,playerid);
TogglePlayerControllable(playerid,1);
}
}

}
Reply
#2

Maybe a wild guess, Can't look at it now.
But i think that its because of the Menu Name

Код:
CreateMenu("Emmet's gun store", 1,20,120,150,40);
there is a ' in it, dont know if it could be a problem, but try removing it
so it becomes

Код:
CreateMenu("Emmets gun store", 1,20,120,150,40);
Reply
#3

still crashing :S
Reply
#4

Hmm thats odd, It works fine here



This is the code i used for it:
http://pastebin.com/WxaX9LCK

You will need to add your other menu parts tho, But as far as i can see, it works fine

Or you could Copy everything into your own gamemode, make sure to Copy everything (except for the Events such as OnFilterScriptInit)
Reply
#5

yes i added it at gamemode and it worked thanks alot man
Reply
#6

You are More then welcome
Im off now, Have fun with your Weapon menu
Reply
#7

thx that helped alot the code from pastebin =D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)