SA-MP Forums Archive
Dialog not responding - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog not responding (/showthread.php?tid=351267)



Dialog not responding - stormchaser206 - 15.06.2012

ShowPlayerDialog:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_VEH1, DIALOG_STYLE_LIST, "Vehicles", "Bullet\nEuros\nTurismo\nNRG-500\nFCR-900\nJetmax\nNews Van\nMaverick\nStunt Plane\nAndromada", "Spawn", "Cancel");
OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    new string[150];
    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""#COL_ORANGE":: "#COL_WHITE"Register" , "\t\t"#COL_EASY"San Andreas Stunts\n\n"#COL_RED"You have entered a invalid password\n"#COL_WHITE"You are not registered, \nPlease enter a password below to register your account!", "Register", "Exit");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Cash",0);
            INI_WriteString(File,"Name",pName);
            INI_WriteInt(File,"Score",0);
            INI_WriteInt(File,"DMKills",0);
            INI_WriteInt(File,"DMDeaths",0);
            INI_WriteInt(File,"Deaths",0);
            INI_WriteInt(File,"Admin",0);
            INI_WriteInt(File,"VipPoints",0);
            INI_WriteInt(File,"Registered",1);
            INI_WriteInt(File,"LoggedIn",1);
            INI_Close(File);
            SpawnPlayer(playerid);
               
            format(string, sizeof(string),"[REGISTER] %s(%d) has registered on the server", pName, playerid);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
        }
     }

    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(udb_hash(inputtext) == PlayerInfo[playerid][Password])
            {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
                format(string, sizeof(string),"[LOGIN] %s(%d) has logged on the server", pName, playerid);
                IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""#COL_ORANGE":: "#COL_WHITE"Login", "\t\t"#COL_EASY"San Andreas Stunts\n\n"#COL_RED"You have entered a invalid password\n"#COL_WHITE"Welcome back, \nPlease enter your password below to start the game!", "Login", "Exit");
            }
        }
       
        if(dialogid == DIALOG_VEH1)
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        CreateVehicleForPlayer(playerid, "541", -1, -1, 1000);
                    }
                    case 1:
                    {
                        CreateVehicleForPlayer(playerid, "Euros", -1, -1, 1000);
                    }
                    case 2:
                    {
                        CreateVehicleForPlayer(playerid, "Turismo", -1, -1, 1000);
                    }
                    case 3:
                    {
                        CreateVehicleForPlayer(playerid, "NRG-500", -1, -1, 1000);
                    }
                    case 4:
                    {
                        CreateVehicleForPlayer(playerid, "FCR-900", -1, -1, 1000);
                    }
                    case 5:
                    {
                        CreateVehicleForPlayer(playerid, "Jetmax", -1, -1, 1000);
                    }
                    case 6:
                    {
                        CreateVehicleForPlayer(playerid, "News Van", -1, -1, 1000);
                    }
                    case 7:
                    {
                        CreateVehicleForPlayer(playerid, "Maverick", -1, -1, 1000);
                    }
                    case 8:
                    {
                        CreateVehicleForPlayer(playerid, "Stunt", -1, -1, 1000);
                    }
                    case 9:
                    {
                        CreateVehicleForPlayer(playerid, "Andromada", -1, -1, 1000);
                    }
                }
            }
            else
            {
                //The player has pressed "Spawn".
                switch(listitem)
                {
                    case 0:
                    {
                        //Selected Item: "Bullet"
                    }
                    case 1:
                    {
                        //Selected Item: "Euros"
                    }
                    case 2:
                    {
                        //Selected Item: "Turismo"
                    }
                    case 3:
                    {
                        //Selected Item: "NRG-500"
                    }
                    case 4:
                    {
                        //Selected Item: "FCR-900"
                    }
                    case 5:
                    {
                        //Selected Item: "Jetmax"
                    }
                    case 6:
                    {
                        //Selected Item: "News Van"
                    }
                    case 7:
                    {
                        //Selected Item: "Maverick"
                    }
                    case 8:
                    {
                        //Selected Item: "Stunt Plane"
                    }
                    case 9:
                    {
                        //Selected Item: "Andromada"
                    }
                }
            }
        }
    }
    return 0;
}
I recieve no errors when i compile, but in-game, when i click something, it doesnt work.


Re: Dialog not responding - Jonny5 - 15.06.2012

what is

CreateVehicleForPlayer (i assume it makes a veh for a player but your error could be in that stock)

try debuging your code
youv been here long enough to know how.
that should help to see where the problem is.


Re: Dialog not responding - stormchaser206 - 15.06.2012

Its in an include:
http://www.solidfiles.com/d/2fa2fb140b/


Re: Dialog not responding - Jonny5 - 15.06.2012

like i said add print statements all over that code to see
where it stops working.


print("step 1");
print("step 2");
print("step 3");
print("step 4");

ect.


Re: Dialog not responding - stormchaser206 - 15.06.2012

I didn't even get step 1.


Re: Dialog not responding - Jonny5 - 15.06.2012

then add them before and after the ShowPlayerDialog statement
youll have to find where the code stops before we can fix it.


Re: Dialog not responding - stormchaser206 - 15.06.2012

When i did it just before and after ShowPlayerDialog (Not in OnDialogResponse), they both got to step 4.


Re: Dialog not responding - Jonny5 - 15.06.2012

well add more debug prints to the OnDialogResponse
your bound to find what code is not being called.
add it to the hole thing not just for this part
maybe something else is being called
like when dialog ids get messed up


Re: Dialog not responding - stormchaser206 - 15.06.2012

I added the code to OnDialogResponse, and i still didnt even get step 1.