Dialog help
#1

The following code throws no errors nor warnings, but does not work whatsoever.
Only the ZCMD command works, which in turn should lead to the dialogresponses, but no response occurs when I choose an item from inside the game.
Code:
pawn Код:
//dialogs:
if(dialogid == VIPWALKSTYLE)
    {
        if(response)
        {
            if(listitem >= 0 && listitem < 13)
            {
                SetPlayerWalkingStyle(playerid, listitem+2);
                SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                SaveWS(playerid);
                return 1;
            }
            else if(listitem == 13)
            {
                SetPlayerWalkingStyle(playerid, 0);
                SendClientMessage(playerid, COLOR_WHITE, "You have removed your current walking style.");
                SaveWS(playerid);
                return 1;
            }
            return SendClientMessage(playerid, COLOR_WHITE, "BUG #1.");
        }
    }
    if(dialogid == WALKSTYLE && response)
    {

        if(listitem < 5)
        {
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                    SetPlayerWalkingStyle(playerid, 2);
                    SaveWS(playerid);
                    return 1;
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                    SetPlayerWalkingStyle(playerid, 3);
                    SaveWS(playerid);
                    return 1;
                }
                case 2:
                {
                    SetPlayerWalkingStyle(playerid, 5);
                    SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                    SaveWS(playerid);
                    return 1;
                }
                case 3:
                {
                    SetPlayerWalkingStyle(playerid, 8);
                    SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                    SaveWS(playerid);
                    return 1;
                }
                case 4:
                {
                    SetPlayerWalkingStyle(playerid, 10);
                    SendClientMessage(playerid, COLOR_WHITE, "You have successfully changed your walking style.");
                    SaveWS(playerid);
                    return 1;
                }
            }
        }
        else
        {
            SetPlayerWalkingStyle(playerid, listitem);
            SendClientMessage(playerid, COLOR_WHITE, "You have removed your current walking style.");
            SaveWS(playerid);
            return 1;
        }
    }
Command:
pawn Код:
CMD:walkstyle(playerid, params[])
{
    if(PlayerInfo[playerid][pDonateRank] > 3)
    {
        ShowPlayerDialog(playerid, VIPWALKSTYLE, DIALOG_STYLE_LIST, "Walking Style", "Pedestrian\nGangster\nGangster II\nOld\nFat and Old\nFat\nLady\nLady II\nLady III\nLady IV\nDrunk\nBlind\nRemove current walk","OK","Cancel");
        return 1;
    }
    else
    {
        ShowPlayerDialog(playerid, WALKSTYLE, DIALOG_STYLE_LIST, "Walking Style", "Pedestrian\nGangster\nOld\nLady\nLady II\nRemove current walk","OK","Cancel");
        return 1;
    }
}

//stock SaveWS
stock SaveWS(playerid)
{
    new string[128], var[32];
    format(string, 128, "Accounts/%s_ws.cfg", GetPlayerNameEx(playerid));
    if(!fexist(string)) fcreate(string);
    new File:file;
    file = fopen(string, io_write);
    format(var, 32, "WalkingStyle=%d\n", GetPlayerWalkingStyle(playerid));fwrite(file, var);
    fclose(file);
    return 1;
}
All dialogs/commands were placed in the correct position(s).
Something is definitely wrong from the dialogs, what is it? Thank you!
Reply
#2

...No-one?
Reply
#3

Do the other dialogs work? If not then you might have a return 1; in OnDialogResponse in other scripts that blocks them; it should return 0 not 1.
Reply
#4

Do you get the SendClientMessage ?
Do you have dialogs in your FS ? If yes, they should return 0;
Reply
#5

I forgot to say earlier that I get two warnings:
pawn Код:
1. redefinition of constant/macro OnPlayerKeyChange.
2. Function SetPlayerWalkingStyle should return a value.
These errors are brought on from the include SetPlayerWalkingStyle by Seif.
Reply
#6

The PAWN does NOT compile the script with them included, it does not show anything on the warning/error message screen, not even the copyrights, on the bottom left corner it says successfully compiled but the .AMX's size is 0 bytes.
Reply
#7

Well now the PAWN compiles it, but those two dialogs show up when I enter the CMD, but they do not work, most likely the error is from the line if (dialogid == VIPWALKSTYLE), anyone?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)