SA-MP Forums Archive
DIALOG_STYLE_INPUT issue - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DIALOG_STYLE_INPUT issue (/showthread.php?tid=201031)



DIALOG_STYLE_INPUT issue - case 1337: - 20.12.2010

Howdy...
I seem to have a problem I cannot win over with.

When I type /createnote, as shown below:

pawn Код:
CMD:createnote(playerid, params[])
{
    ShowPlayerDialog(playerid, 619, DIALOG_STYLE_INPUT, "Create Note", "Type what you want on your notebook, when finished, press 'Create'.", "Create", "Cancel");
    return 1;
}
It will not execute, all other commands work fine, but I can't seem to find the problem, though here is my OnDialogResponse callback.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 619)
    {
        if(response)
        {
            new pName[24], File[100]; new File2[100], File3[100]; new File4[100], File5[100]; GetPlayerName(playerid, pName, sizeof(pName));
            format(File, 100, "Notebook/%s.ini",pName); format(File2, 100, "Notebook/%s(2).ini",pName); format(File3, 100, "Notebook/%s(3).ini",pName); format(File4, 100, "Notebook/%s(4).ini",pName); format(File5, 100, "Notebook/%s(5).ini",pName);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 128, DIALOG_STYLE_INPUT, "Create Note", "Type what you want on your notebook, when finished, press 'Create'.", "Create", "Cancel");
            if(!dini_Exists(File))
            {
                dini_Create(File);
                dini_Set(File, "Page 1", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");

            }
            else if(dini_Exists(File))
            {
                dini_Create(File2);
                dini_Set(File, "Page 2", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File2))
            {
                dini_Create(File3);
                dini_Set(File, "Page 3", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File3))
            {
                dini_Create(File4);
                dini_Set(File, "Page 4", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");

            }
            else if(dini_Exists(File4))
            {
                dini_Create(File5);
                dini_Set(File, "Page 5", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File5))
            {
                SendClientMessage(playerid, 0xE21F1FFF, "You have ran out of pages!");
            }
            return 1;
        }
    }
    return 1;
}



Re: DIALOG_STYLE_INPUT issue - willsuckformoney - 20.12.2010

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 619)
    {
            new pName[24], File[100]; new File2[100], File3[100]; new File4[100], File5[100]; GetPlayerName(playerid, pName, sizeof(pName));
            format(File, 100, "Notebook/%s.ini",pName); format(File2, 100, "Notebook/%s(2).ini",pName); format(File3, 100, "Notebook/%s(3).ini",pName); format(File4, 100, "Notebook/%s(4).ini",pName); format(File5, 100, "Notebook/%s(5).ini",pName);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 128, DIALOG_STYLE_INPUT, "Create Note", "Type what you want on your notebook, when finished, press 'Create'.", "Create", "Cancel");
            if(!dini_Exists(File))
            {
                dini_Create(File);
                dini_Set(File, "Page 1", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");

            }
            else if(dini_Exists(File))
            {
                dini_Create(File2);
                dini_Set(File, "Page 2", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File2))
            {
                dini_Create(File3);
                dini_Set(File, "Page 3", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File3))
            {
                dini_Create(File4);
                dini_Set(File, "Page 4", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");

            }
            else if(dini_Exists(File4))
            {
                dini_Create(File5);
                dini_Set(File, "Page 5", inputtext);
                SendClientMessage(playerid, 0xF97804FF, "Note created successfully.");
            }
            else if(dini_Exists(File5))
            {
                SendClientMessage(playerid, 0xE21F1FFF, "You have ran out of pages!");
            }
            return 1;
    }
    return 1;
}



Re: DIALOG_STYLE_INPUT issue - case 1337: - 20.12.2010

Fixed, and thanks for your code, too.

I forgot to use strval, silly me, so tired and planned to stay late up at night on the holidays, lol thanks, I'll add you in my credits and hopefully buy one of your scripts.


Re: DIALOG_STYLE_INPUT issue - willsuckformoney - 20.12.2010

No problem.