[BUG] HideMenuForPlayer
#1

I was crashing all the time while executing this code:

pawn Code:
else if( !strcmp( cmdtext, "/dvk", true ) )
        {  
            if( !Dvk_Arr[f] )
            {
                Dvk_Arr[f] = true;
                SetCameraBehindPlayer( playerid );
                HideMenuForPlayer( GetPlayerMenu( playerid ), playerid );
                SetPlayerPos( playerid, 10.0, 10.0, 05.0 );
                TogglePlayerControllable( playerid, 1 );
            }
           
            ShowPlayerDialog( playerid, 749, DIALOG_STYLE_LIST, "Select an option", "Races\nRecording\nTools", "Select", "Cancel" );
            return 1;
        }
This is the debug:

Code:
[16:52:06] Number of vehicle models: 1
[16:52:10] Incoming connection: 127.0.0.1:56140
[16:52:10] [join] Player has joined the server (0:127.0.0.1)
[16:52:16] RCON (In-Game): Player #0 (Player) has logged in.
[16:52:21] [chat] [Player]: ffffffffaff}ff
[16:52:24] [debug] Server crashed while executing DVKStreetRod.amx
[16:52:24] [debug] Backtrace (most recent call first):
[16:52:24] [debug] #0  ???????? in native HideMenuForPlayer () from samp-server.exe
[16:52:24] [debug] #1  00000ff4 in OnPlayerCommandText () from DVKStreetRod.amx
[16:52:24] [debug] Server crashed while executing DVKStreetRod.amx
[16:52:24] [debug] Backtrace (most recent call first):
[16:52:24] [debug] #0  ???????? in native HideMenuForPlayer () from samp-server.exe
[16:52:24] [debug] #1  00000ff4 in OnPlayerCommandText () from DVKStreetRod.amx
It was crashing because the command was "hidding" no menu at all, as I was not in any menu at that time.
Reply
#2

Try this http://forum.sa-mp.com/showpost.php?...32&postcount=7

It will give you more detailed info of the crash.
Reply
#3

if GetPlayerMenu returns an invalid menu, and you try and hide it, i think the server will crash, but not 100% sure on that

btw, I noticed the dialog, hidemenuforplayer won't hide a dialog. dialogs and menus are different.
Reply
#4

Quote:
Originally Posted by whitetigerswt
View Post
if GetPlayerMenu returns an invalid menu, and you try and hide it, i think the server will crash, but not 100% sure on that

btw, I noticed the dialog, hidemenuforplayer won't hide a dialog. dialogs and menus are different.
Yeah, I'm posting this bug so they can fix that, when you try to hide an invalid menu. It shouldn't crash.

The check could be made inside the native so it's easier to avoid any crash and it also saves us one step, hehe.
Reply
#5

Should it crash the server? Why not, it's an invalid way of using the hide function. Showing invalid textdraws usually uses textdraw id 0, if a server relies heavily on textdraws, this causes many visual defects.

I don't think it needs to be fixed, you just need to check if menu is valid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)