SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/04/2012, 07:49 PM   #1
clavador
Huge Clucker
 
clavador's Avatar
 
Join Date: Jun 2007
Location: Argentina
Posts: 220
Reputation: 71
Default [BUG] HideMenuForPlayer

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.
__________________
clavador is offline   Reply With Quote
Old 09/04/2012, 07:53 PM   #2
WooTFTW
Huge Clucker
 
WooTFTW's Avatar
 
Join Date: May 2011
Location: = GetPlayerPos(WooTFTW);
Posts: 241
Reputation: 37
Default Re: [BUG] HideMenuForPlayer

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

It will give you more detailed info of the crash.
WooTFTW is offline   Reply With Quote
Old 09/04/2012, 07:58 PM   #3
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Posts: 406
Reputation: 156
Default Re: [BUG] HideMenuForPlayer

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.
__________________
GitHub

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 09/04/2012, 08:14 PM   #4
clavador
Huge Clucker
 
clavador's Avatar
 
Join Date: Jun 2007
Location: Argentina
Posts: 220
Reputation: 71
Default Re: [BUG] HideMenuForPlayer

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.
__________________
clavador is offline   Reply With Quote
Old 10/04/2012, 08:25 AM   #5
Rac3r
Gangsta
 
Join Date: May 2007
Posts: 500
Reputation: 40
Default Re: [BUG] HideMenuForPlayer

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.
Rac3r is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:12 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.