Menu problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Menu problem (
/showthread.php?tid=70750)
Menu problem -
GermanFighter - 27.03.2009
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;
Re: Menu problem -
Pyrokid - 27.03.2009
Post the code you used to create the menu and all of OnPlayerSelectedMenuRow.
Re: Menu problem -
GermanFighter - 27.03.2009
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;
}
Re: Menu problem -
Pyrokid - 27.03.2009
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:
To:
pawn Код:
HideMenuForPlayer(Airport, playerid);
Re: Menu problem -
GermanFighter - 28.03.2009
Thanks, it works now.

There is still another problem. All players get the menu indicated, if they spawnen.
Re: Menu problem -
GermanFighter - 29.03.2009
Can you fix it?