PAWN Stopped Working
#1

Hey,

I've TDM script in my gamemode, so I tried to add a command /gangs to display a list with all the gangs and Members so after adding the command and adding to "OnDialogResponse", the PAWN Crashes. I don't know the reason, please if you do know what to do, I'd be grateful to know.

pawn Код:
#define DIALOG_GANGS 2006
#define DIALOG_GROVES 2007
#define DIALOG_BALLAS 2008
#define DIALOG_RIFAS 2009
#define DIALOG_TRIADS 2010
#define DIALOG_MAFIAS 2011
#define DIALOG_BIKERS 2012


#define TEAM_GROVE 2000
#define TEAM_BALLAS 2001
#define TEAM_TRIADS 2002
#define TEAM_RIFAS 2003
#define TEAM_MAFIA 2004
#define TEAM_BIKERS 2005


case DIALOG_GANGS:
        {
            if(dialogid == DIALOG_GANGS)
            {
                if(!response)
                {
                    return 0;
                }
                if(response) // If they clicked 'Select' or double-clicked a weapon
                {

                    switch(listitem)
                    {
                        new string1[128], name[MAX_PLAYER_NAME], targetid, targetid1, targetid2, targetid3, targetid4,targetid5;
                        case 0: if(gTeam[targetid] == TEAM_GROVE)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid);
                                    ShowPlayerDialog(playerid, DIALOG_GROVES, DIALOG_STYLE_LIST, "Gang: Grove Street Families", string1, "Close", "");
                                }
                        case 1: if(gTeam[targetid1] == TEAM_BALLAS)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid1);
                                    ShowPlayerDialog(playerid, DIALOG_BALLAS, DIALOG_STYLE_LIST, "Gang: Ballas", string1, "Close", "");
                                }
                        case 2: if(gTeam[targetid2] == TEAM_TRIADS)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid2);
                                    ShowPlayerDialog(playerid, DIALOG_TRIADS, DIALOG_STYLE_LIST, "Gang: Triads", string1, "Close", "");
                                }
                        case 3: if(gTeam[targetid3] == TEAM_RIFAS)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid3);
                                    ShowPlayerDialog(playerid, DIALOG_RIFAS, DIALOG_STYLE_LIST, "Gang: San Fierro Rifas", string1, "Close", "");
                                }
                        case 4: if(gTeam[targetid4] == TEAM_MAFIA)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid4);
                                    ShowPlayerDialog(playerid, DIALOG_MAFIAS, DIALOG_STYLE_LIST, "Gang: Mafia", string1, "Close", "");
                                }
                        case 5: if(gTeam[targetid5] == TEAM_BIKERS)
                                {
                                    format(string1, sizeof(string1), "%s (%d) (0 Skills Gang Member)",name, targetid5);
                                    ShowPlayerDialog(playerid, DIALOG_BIKERS, DIALOG_STYLE_LIST, "Gang: Bikers", string1, "Close", "");
                                }
                    }
                }
            }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
        }
        case DIALOG_GENDER:
                //And here are the rest of the dialogs



CMD:gangs(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_GANGS, DIALOG_STYLE_LIST, "Gangs", "{00EE00}Grove Street Families {00FFAA}(%d members)\n{00EE00}Ballas {00FFAA}(%d members)\n{00EE00}Triads {00FFAA}(%d members)\n{00EE00}San Fierro Rifa {00FFAA}(%d members)\n{00EE00}Mafias {00FFAA}(%d members)\n{00EE00}Bikers {00FFAA}(%d members)", "Select", "Close");

    return 1;
}

What is the problem of the PAWN crashing?
Reply
#2

Why are you checking this twice?

case DIALOG_GANGS:
{
if(dialogid == DIALOG_GANGS)

Those both do the same thing.

Remove this
Код:
            if(dialogid == DIALOG_GANGS)
. (Not sure if that's the cause of the crash but it could be.
Reply
#3

Quote:
Originally Posted by Divergent
Посмотреть сообщение
Why are you checking this twice?

case DIALOG_GANGS:
{
if(dialogid == DIALOG_GANGS)

Those both do the same thing.

Remove this
Код:
            if(dialogid == DIALOG_GANGS)
. (Not sure if that's the cause of the crash but it could be.
Thank you for replying, but unfortunately It's not the cause of the PAWN crash.
Reply
#4

Quote:
Originally Posted by Axey187
Посмотреть сообщение
Thank you for replying, but unfortunately It's not the cause of the PAWN crash.
Does it full on crash or just go to "Not Responding" while compiling? Whenever I compile my gamemode (over 50k lines) it always goes to not responding for like 20 seconds until it completes
Reply
#5

It worked fine at first, but once I added the CMD:gangs It started to crash.


Photo:
Reply
#6

You need to format the string before you put it here

Код:
    ShowPlayerDialog(playerid, DIALOG_GANGS, DIALOG_STYLE_LIST, "Gangs", "{00EE00}Grove Street Families {00FFAA}(%d members)\n{00EE00}Ballas {00FFAA}(%d members)\n{00EE00}Triads {00FFAA}(%d members)\n{00EE00}San Fierro Rifa {00FFAA}(%d members)\n{00EE00}Mafias {00FFAA}(%d members)\n{00EE00}Bikers {00FFAA}(%d members)"
Код:
format(string, sizeof(string), "{00EE00}Grove Street Families {00FFAA}(%d members)\n{00EE00}Ballas {00FFAA}(%d members)\n{00EE00}Triads {00FFAA}(%d members)\n{00EE00}San Fierro Rifa {00FFAA}(%d members)\n{00EE00}Mafias {00FFAA}(%d members)\n{00EE00}Bikers {00FFAA}(%d members)", ALL OF THE FLOATS);

ShowPlayerDialog(playerid, DIALOG_GANGS, DIALOG_STYLE_LIST, "Gangs", string, "Select", "Close");
Rep+ lol
Reply
#7

Sorry, I still get the same PAWN crash, no idea what the problem may be..
Reply
#8

Nevermind, I've found out that PAWN crashed because I used "if" statement inside "case". Thanks for the replies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)