16.12.2010, 23:23
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);
}
}
}
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);
}
}
}