Menu problem
#1

Hello,

i have a big problem with my second menu.
If a player respawn the server is crashing.
I thinks its the menu...


Код:
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_PILOT)
{
ShowMenuForPlayer(Airport, playerid);
TogglePlayerControllable(playerid, 0);
}
SendClientMessage(playerid, COLOR_GREEN, "Version: 0.3");
SendClientMessage(playerid, COLOR_GREEN, "Lies die /regeln!");
SendClientMessage(playerid, COLOR_GREEN, "Tippe /cmd fur die Commands ein!");
SendClientMessage(playerid, COLOR_GREEN, "Viel SpaЯ!");
return 1;
}
Код:
   public OnPlayerRequestClass(playerid, classid)
{


////////////////////////////////////////SKINS///////////////////////////////////
  switch (classid) {

    case 0:

      {
        GameTextForPlayer(playerid, "Pilot", 5000, 3);
	      SetPlayerPos(playerid,-2690.67,2048.35,56.73);
	      SetPlayerFacingAngle(playerid, 0.0);
	      SetPlayerCameraPos(playerid,-2693.00,2052.62,55.73);
	      SetPlayerCameraLookAt(playerid,-2690.67,2048.35,56.73);
        SetPlayerColor(playerid,COLOR_WHITE);
        gTeam[playerid] = TEAM_PILOT;
Reply
#2

Post the code you used to create the menu and all of OnPlayerSelectedMenuRow.
Reply
#3

Here

Код:
Airport = CreateMenu("Flughafen", 1, 50.0, 180.0, 175.0, 25.0);
AddMenuItem(Airport, 0, "Las Venturas");
AddMenuItem(Airport, 0, "San Fierro");
AddMenuItem(Airport, 0, "Los Santos");
AddMenuItem(Airport, 0, "Verlassen");
Код:
else if (CurrentMenu == Airport)
{
switch(row)
{
case 0:
{
SetPlayerPos(playerid, 1698.1899,1591.4235,10.6971);
ShowMenuForPlayer(Airport, playerid);
TogglePlayerControllable(playerid, 1);
}
case 1:
{
SetPlayerPos(playerid, -1231.8276,47.1908,14.1330);
ShowMenuForPlayer(Airport, playerid);
TogglePlayerControllable(playerid, 1);

}
case 2:
{
SetPlayerPos(playerid, 1625.1459,-2448.6729,13.5547);
ShowMenuForPlayer(Airport, playerid);
TogglePlayerControllable(playerid, 1);
}
case 3:
{
DestroyMenu(Airport);
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}
Reply
#4

And the crash happens exactly when you respawn or when you select an item on the menu?

Edit:

Ok, the problem is that you're creating the menu once in OnGameModeInit and when the player selects case 3 which is to exit the menu, you fully destroy the menu without creating it again. Therefore, you try to display a menu that does not exist when the player respawns.

Change all your DestoryMenu to HideMenuForPlayer. As in change:
pawn Код:
DestroyMenu(Airport);
To:
pawn Код:
HideMenuForPlayer(Airport, playerid);
Reply
#5

Thanks, it works now.
There is still another problem. All players get the menu indicated, if they spawnen.
Reply
#6

Can you fix it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)