15.04.2009, 00:46
I found a nice Restaurant menu script and i edited it a little.
But when i choose a Menu row named "Exit" my samp server crashes.... i don't know whats the problem so please help me.
Here's the code:
Thanks for your time and help
But when i choose a Menu row named "Exit" my samp server crashes.... i don't know whats the problem so please help me.
Here's the code:
pawn Код:
if(Current == burgermenu)
{
new actstring[128];
new sendername[64];
new Float:health;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerHealth(playerid, health);
switch (row)
{
case 0:
{
format(actstring, sizeof(actstring), "* %s eats a hamburger.", sendername);
SafeGivePlayerMoney(playerid, -2);
SetPlayerHealth(playerid, health + 20);
ShowMenuForPlayer(burgermenu, playerid);
TogglePlayerControllable(playerid, 0);
}
case 1:
{
format(actstring, sizeof(actstring), "* %s eats a donnut.", sendername);
SafeGivePlayerMoney(playerid, -2);
SetPlayerHealth(playerid, health + 20);
ShowMenuForPlayer(burgermenu, playerid);
TogglePlayerControllable(playerid, 0);
}
case 2:
{
format(actstring, sizeof(actstring), "* %s eats pizza.", sendername);
SafeGivePlayerMoney(playerid, -5);
SetPlayerHealth(playerid, health + 80);
ShowMenuForPlayer(burgermenu, playerid);
TogglePlayerControllable(playerid, 0);
}
case 3:
{
format(actstring, sizeof(actstring), "* %s eats french fries.", sendername);
SafeGivePlayerMoney(playerid, -1);
SetPlayerHealth(playerid, health + 10);
ShowMenuForPlayer(burgermenu, playerid);
TogglePlayerControllable(playerid, 0);
}
case 4:
{
TogglePlayerControllable(playerid, 1);
HideMenuForPlayer(burgermenu, playerid);
}
}
if (GetPlayerMoney(playerid) > 100) SetPlayerHealth(playerid, 100);
ProxDetector(30.0, playerid, actstring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
pawn Код:
public CreateFoodMenus()
{
// Burger Shot
burgermenu = CreateMenu("Food", 2, 35.0, 140.0, 100.0, 150.0);
AddMenuItem(burgermenu,0,"Hamburger");
AddMenuItem(burgermenu,0,"Donnut");
AddMenuItem(burgermenu,0,"Pizza");
AddMenuItem(burgermenu,0,"French Fries");
AddMenuItem(burgermenu,0,"Exit");
AddMenuItem(burgermenu,1,"$2");
AddMenuItem(burgermenu,1,"$2");
AddMenuItem(burgermenu,1,"$5");
AddMenuItem(burgermenu,1,"$1");
AddMenuItem(burgermenu,1," ");
DisableMenuRow(burgermenu, 10);