Pawno compiler crashes when a new dialog is created.
#1

Hey i have seemed to try everything that i can think of and these are the peices of code that make it crash.
PHP код:
CMD:faction(playeridparams[])
    {
        if(
IsPlayerConnected(playerid))
        {
            
ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"Faction Commands","LSPD\nFBI","Okay","Close");
        }
        return 
1;

and
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
new 
pDialog[512];
if(
response)// They pressed the first button.
    
{
    switch(
dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        
{
        case 
999:// Our dialog!
            
{
               switch(
listitem)// Checking which listitem was selected
            
{
                case 
0:// The first item listed
                
{
                    if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 1)
                    {
                        
ShowPlayerDialog(playeridHELP6DIALOG_STYLE_MSGBOX"LSPD","/door (/r)adio (/d)epartments (/m)egaphone (/su)spect /lspd /mdc /detain /arrest /wanted /cuff /tazer /showbadge\n/leofrisk /take /ticket (/gov)ernment /deliver /clothes /invite /giverank /deployspikes /deletespike(s)",pDialog,"okay","Close");
                    }
                }
                case 
1// The second item listed
                
{
                    
SendClientMessage(playeridCOLOR_GREEN"FBI to go here.");
                }
            }
            }
    }
    }
    return 
1;

I am really stuck on what to do any help would be awesome!
Reply
#2

should be like that, not sure tbh

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
        case 999:// Our dialog!
            {
               switch(listitem)// Checking which listitem was selected
            {
                case 0:// The first item listed
                {
                    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                    {
                        ShowPlayerDialog(playerid, HELP6, DIALOG_STYLE_MSGBOX, "LSPD","/door (/r)adio (/d)epartments (/m)egaphone (/su)spect /lspd /mdc /detain /arrest /wanted /cuff /tazer /showbadge\n/leofrisk /take /ticket (/gov)ernment /deliver /clothes /invite /giverank /deployspikes /deletespike(s)","okay","Close");
                    }
                }
                case 1: // The second item listed
                {
                    SendClientMessage(playerid, COLOR_GREEN, "FBI to go here.");
                }
            }
            }
    }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by kirollos
Посмотреть сообщение
should be like that, not sure tbh

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
        case 999:// Our dialog!
            {
               switch(listitem)// Checking which listitem was selected
            {
                case 0:// The first item listed
                {
                    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                    {
                        ShowPlayerDialog(playerid, HELP6, DIALOG_STYLE_MSGBOX, "LSPD","/door (/r)adio (/d)epartments (/m)egaphone (/su)spect /lspd /mdc /detain /arrest /wanted /cuff /tazer /showbadge\n/leofrisk /take /ticket (/gov)ernment /deliver /clothes /invite /giverank /deployspikes /deletespike(s)","okay","Close");
                    }
                }
                case 1: // The second item listed
                {
                    SendClientMessage(playerid, COLOR_GREEN, "FBI to go here.");
                }
            }
            }
    }
    }
    return 1;
}
Thanks for trying but just tried that and it still crashes..... Any body else?
Reply
#4

try running it as admin
Reply
#5

Quote:
Originally Posted by Ultra-Gaming
Посмотреть сообщение
try running it as admin
Thanks but just tried and no hope there.....
Reply
#6

There are 2 }s before return 1. Remove one of them.

Indenting your code will help!!
Reply
#7

Quote:
Originally Posted by jameskmonger
Посмотреть сообщение
There are 2 }s before return 1. Remove one of them.

Indenting your code will help!!
WOW Thank you buddy it was right i got some other errors but i will try and sort them myself.
Reply
#8

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new pDialog[512];
    if(response) // They pressed the first button.
    {
        switch(dialogid) // If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
            case 999: // Our dialog!
            {
                switch(listitem)
                {// Checking which listitem was selected
                    case 0:// The first item listed
                    {
                        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                        {
                            ShowPlayerDialog(playerid, HELP6, DIALOG_STYLE_MSGBOX, "LSPD","/door (/r)adio (/d)epartments (/m)egaphone (/su)spect /lspd /mdc /detain /arrest /wanted /cuff /tazer /showbadge\n/leofrisk /take /ticket (/gov)ernment /deliver /clothes /invite /giverank /deployspikes /deletespike(s)",pDialog,"okay","Close");
                        }
                    }
                    case 1: // The second item listed
                    {
                        SendClientMessage(playerid, COLOR_GREEN, "FBI to go here.");
                    }
                }
            }
        }
    }
    return 1;
}
There - do you see how much better it is to look at indented code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)