SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 22/07/2011, 12:19 PM   #1
Ehab1911
Banned
 
Join Date: Dec 2009
Location: In a room
Posts: 377
Reputation: 5
Default My game crashes cause of Dialogs..

Hello, today I scripted a Dialog for teleports, so on player connects then spawn a dialog shows and ask him where to spawn?

The dialog shows, when I choose a place, the game crashes + doesn't SetPlayerPos..

Code:
SA-MP 0.3c-R3
Exception At Address: 0x007F0BF7

Registers:
EAX: 0x00000000	EBX: 0x03614CC8	ECX: 0x1C1EA788	EDX: 0x1C1EA788
ESI: 0x00000000	EDI: 0x1C1EA798	EBP: 0x0AA452A4	ESP: 0x0022F1C0
EFLAGS: 0x00010246

Stack:
+0000: 0x1C1EA798   0x1C335C48   0x006D3585   0x00000000
+0010: 0x1C1EA788   0x0ABCD830   0x1C335C48   0x1C1EA798
+0020: 0x13BD50E0   0x0AA452A4   0x00B3A4C4   0x0000000E
+0030: 0x13BD50E0   0x1C1EA788   0x006DFA8B   0x03614CC8
+0040: 0x0AA452A4   0x00000000   0x00000000   0x13BD50E0
+0050: 0x0000000E   0xFFFFFFFF   0x000003EE   0x03614CC8
+0060: 0x006E3391   0x00000000   0x0000000E   0x000006E7
+0070: 0x00000001   0x0168C0A8   0x00000000   0x004985DF
+0080: 0xFFFFFFFF   0x00000001   0x000006E7   0x0022F470
+0090: 0x00000000   0x0022F478   0x00000000   0x00533501
+00A0: 0x0022F278   0x141071D4   0x0022F26C   0x3B3A0B00
+00B0: 0xBE385BD0   0x3DF8C5B0   0x4519E0C1   0xC4D6D421
+00C0: 0x41561EED   0x0053426F   0x0022F290   0x13FCBF08
+00D0: 0x00000000   0xC4D6D421   0x41561EED   0x005449C0
+00E0: 0x00000000   0x00000000   0x42DA0000   0xC4D6D421
+00F0: 0x00000019   0x00B99A14   0x49742400   0xC9742400
+0100: 0xC9742400   0x49742400   0xC9742400   0x49742400
+0110: 0x00000000   0x00000001   0x0000006E   0x0000006D
+0120: 0x0000001A   0x00000090   0x0000006D   0x00000019
+0130: 0x0AA7D6E4   0x4519A834   0xC4D66308   0x451A194E
+0140: 0x00000000   0x0168C0A8   0x0168C0A8   0x00000000
+0150: 0x0048D370   0x00000806   0x00000000   0x0000053F
+0160: 0x4519E0C1   0xC4D6D41F   0x415BB235   0x00533522
+0170: 0x0022F348   0x141071D4   0x0022F33C   0x3B3A0B00
+0180: 0xBE385BD0   0x3DF8C5B0   0x4519E0C1   0xC4D6D41F
+0190: 0x415BB235   0x0053426F   0x0022F360   0x13FCBF08
+01A0: 0x00000000   0xC4D6D41F   0x415BB235   0x005449C0
+01B0: 0x00000000   0x00000000   0x42DA0000   0xC4D6D41F
+01C0: 0x00000019   0x00B99A14   0x13BD50E0   0x0AA7D6F8
+01D0: 0x00544B97   0x0000000C   0x0022F40C   0x13BD50E0
+01E0: 0x00000000   0x0000021E   0x0000006E   0x0000006D
+01F0: 0x0000001A   0x00000090   0x0000006D   0x00000019
+0200: 0x0AA7D6F8   0x4519A834   0xC4D66306   0x451A194E
+0210: 0x00000000   0x0000021E   0x13BD50E0   0x0054281D
+0220: 0x0000000C   0x13BD50E0   0x006A9D68   0x13BD50E0
+0230: 0x017578D8   0x034DD5CF   0x00000000   0x00000000
+0240: 0x00000000   0x00000000   0x13BD50E0   0x0000021E
+0250: 0x0022F460   0x00838D7D   0xFFFFFFFF   0x00469EF7
+0260: 0x000006E7   0x0022F480   0x034E85AE   0x034E8764
+0270: 0x017578D8   0x000003EE   0x01000001   0x000003EE

SCM Op: 0x6E7, lDbg: 1

Game Version: US 1.0

State Information: Ped Context: 0


The dialog:

pawn Code:
ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Spawn Menu","1. Las Venturas\r\n2. Los Santos\r\n3. San Fierro","Select", "Cancel");


On Response:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(1337) // Lookup the dialogid
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "Please select a spawn place.");
                return 1; // We processed it
            }

            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    SetPlayerPos(playerid, 2001.7556,1544.1254,13.5859);
                    SetPlayerFacingAngle(playerid, 271.6154);
                }
                case 1:
                {
                    SetPlayerPos(playerid, 2448.8062,-1705.2867,13.5123);
                    SetPlayerFacingAngle(playerid, 85.3487);
                }
                case 2:
                {
                    SetPlayerPos(playerid, -1960.3412,266.8877,35.4688);
                    SetPlayerFacingAngle(playerid, 272.9387);
                }
                // Add the rest of your listitems for dialog 1 here

            }

        }
        // Add the rest of your dialogs here

    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}


What would the problem be?
Ehab1911 is offline  
Old 22/07/2011, 12:24 PM   #2
Ehab1911
Banned
 
Join Date: Dec 2009
Location: In a room
Posts: 377
Reputation: 5
Default Re: My game crashes cause of Dialogs..

Guys it doesn't crash anymore, but .. the Dialog doesn't respond, when I choose Las Venturas for example, it doesn't teleport me there, why :S?
Ehab1911 is offline  
Old 22/07/2011, 12:33 PM   #3
Roko_foko
Gangsta
 
Join Date: Jul 2009
Location: Croatia, Split
Posts: 541
Reputation: 44
Default Re: My game crashes cause of Dialogs..

The problem is in your switch().
pawn Code:
switch(1337)
Inside () there must be a variable, not a constant. I would suggest to use if, else if, if you don't know how switch works.
This is the wa it sholud be.
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) // Lookup the dialogid /* changed here */
    {
        case 1337: /*changed here*/
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "Please select a spawn place.");/* I would Add here same ShowPlayerDialog() line*/
                return 1; // We processed it
            }

            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    SetPlayerPos(playerid, 2001.7556,1544.1254,13.5859);
                    SetPlayerFacingAngle(playerid, 271.6154);
                }
                case 1:
                {
                    SetPlayerPos(playerid, 2448.8062,-1705.2867,13.5123);
                    SetPlayerFacingAngle(playerid, 85.3487);
                }
                case 2:
                {
                    SetPlayerPos(playerid, -1960.3412,266.8877,35.4688);
                    SetPlayerFacingAngle(playerid, 272.9387);
                }
                // Add the rest of your listitems for dialog 1 here

            }

        }
        // Add the rest of your dialogs here

    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
Roko_foko is offline  
Old 22/07/2011, 12:57 PM   #4
Ehab1911
Banned
 
Join Date: Dec 2009
Location: In a room
Posts: 377
Reputation: 5
Default Re: My game crashes cause of Dialogs..

Oh, Thanks a lot! it works now
Ehab1911 is offline  
Old 22/07/2011, 01:01 PM   #5
Roko_foko
Gangsta
 
Join Date: Jul 2009
Location: Croatia, Split
Posts: 541
Reputation: 44
Default Re: My game crashes cause of Dialogs..

No problem mate.
Roko_foko is offline  
 

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Game crashes with dialogs leong124 Bug Reports 55 28/10/2016 06:07 AM
Game crashes Zombie18256 Client Support 6 24/01/2011 03:13 PM
[FilterScript] Create survey In Game ! Very easy with dialogs 0.3 + Yagoda Filterscripts 8 02/01/2011 07:53 PM
Game Crashes cjgotti Client Support 5 03/10/2009 05:37 PM
my game crashes when i die WardenCS Client Support 1 27/04/2009 05:30 PM


All times are GMT. The time now is 10:13 AM.


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