Not inputting text? Dialogs
#1

I have this:
Quote:

if(dialogid == 16516)
{
if(response)
{
if(strlen(inputtext) >= 2 && strlen(inputtext) <= 64)
{
arrUpdates[iUpd][g_Update1] = strlen(inputtext);
format(string, sizeof(string), "You have change Update 1 to %s.", inputtext);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
CreateDynamicUpdates(strlen(inputtext));
SaveDynamicUpdates();
}
else return ShowPlayerDialog(playerid, 16513, DIALOG_STYLE_LIST, "Update 1:", "Input text\nClear Update", "Select", "Cancel");
}
}

Its a post to create the text and put it in my Updates.ini file but instead it puts a '|', it even says you have changed the text to %s and then whatever inputted on the other dialog?

My CreateDynamicUpdates:
Код:
CreateDynamicUpdates(iUpd)
{
    new Filename[64], line[256];
    format(Filename, sizeof(Filename), "Updates.ini");
    new File:handle = fopen(Filename, io_write);

    format(line, sizeof(line), "Update 1=%s\r\n", arrUpdates[iUpd][g_Update1]); fwrite(handle, line);
    format(line, sizeof(line), "Update 2=%s\r\n", arrUpdates[iUpd][g_Update2]); fwrite(handle, line);
    format(line, sizeof(line), "Update 3=%s\r\n", arrUpdates[iUpd][g_Update3]); fwrite(handle, line);
    format(line, sizeof(line), "Update 4=%s\r\n", arrUpdates[iUpd][g_Update4]); fwrite(handle, line);
    format(line, sizeof(line), "Update 5=%s\r\n", arrUpdates[iUpd][g_Update5]); fwrite(handle, line);
    format(line, sizeof(line), "Update 6=%s\r\n", arrUpdates[iUpd][g_Update6]); fwrite(handle, line);
    format(line, sizeof(line), "Update 7=%s\r\n", arrUpdates[iUpd][g_Update7]); fwrite(handle, line);
    format(line, sizeof(line), "Update 8=%s\r\n", arrUpdates[iUpd][g_Update8]); fwrite(handle, line);
    format(line, sizeof(line), "Update 9=%s\r\n", arrUpdates[iUpd][g_Update9]); fwrite(handle, line);
    format(line, sizeof(line), "Update 10=%s\r\n", arrUpdates[iUpd][g_Update10]); fwrite(handle, line);
    format(line, sizeof(line), "Update 11=%s\r\n", arrUpdates[iUpd][g_Update11]); fwrite(handle, line);
    format(line, sizeof(line), "Update 12=%s\r\n", arrUpdates[iUpd][g_Update12]);
    fwrite(handle, line);
    fclose(handle);
}
my enum:
Quote:

enum eUpdateSystem {
g_Update1[64],
g_Update2[64],
g_Update3[64],
g_Update4[64],
g_Update5[64],
g_Update6[64],
g_Update7[64],
g_Update8[64],
g_Update9[64],
g_Update10[64],
g_Update11[64],
g_Update12[64],
g_Update13[64],
g_Update14[64],
g_Update15[64],
};

+rep to anyone that can even help
Reply
#2

From what I understood, the text doesn't assigned to the array?

PHP код:
///
    
if( response )
    {
        if(
strlen(inputtext) >= && strlen(inputtext) <= 64)
        {
            
strmid(arrUpdates[iUpd][g_Update1], inputtext0strlen(inputtext), sizeof arrUpdates);
            
//arrUpdates[iUpd][g_Update1] = strlen(inputtext);
            
format(stringsizeof(string), "You have change Update 1 to %s."inputtext);
            
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
            
CreateDynamicUpdates(strlen(inputtext));
            
SaveDynamicUpdates();
        }
        else return 
ShowPlayerDialog(playerid16513DIALOG_STYLE_LIST"Update 1:""Input text\nClear Update""Select""Cancel");
    } 
Reply
#3

arrUpdates[iUpd][g_Update1] = strlen(inputtext);
It is updating to the number of letters. You might try:
arrUpdates[iUpd][g_Update1] = inputtext;
or even
format(arrUpdates[iUpd][g_Update1], 64, "%s", inputtext);
Reply
#4

Guy above the above fixed! thanks :P

rep'd

I just now have one problem

Whenever I type in above 14 characters it doesnt work

Like if I type in 14+ characters or w/e in the dialog it will say you have changed it to '%s' then all of what I entered
but on /updates and on the .ini file it doesnt show that, its just shows 14 chars.
Quote:

CMD:updates(playerid, params[])
{
new string[245], iUpd;
format(string, sizeof(string), "(1) %s\n(2) %s\n(3) %s\n(4) %s\n(5) %s\n(6) %s\n( %s\n(9) %s\n(10) %s\n(11) %s\n(12) %s", arrUpdates[iUpd][g_Update1], arrUpdates[iUpd][g_Update2], arrUpdates[iUpd][g_Update3], arrUpdates[iUpd][g_Update4], arrUpdates[iUpd][g_Update5], arrUpdates[iUpd][g_Update6], arrUpdates[iUpd][g_Update7], arrUpdates[iUpd][g_Update8], arrUpdates[iUpd][g_Update9], arrUpdates[iUpd][g_Update10], arrUpdates[iUpd][g_Update11], arrUpdates[iUpd][g_Update12]);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Updates", string, "Close", "Cancel");
return 1;
}

Reply
#5

Ignore the above post for now..

Now whenever I do it and click the dialog to edit the text it comes up with 'You have changed Update 1 to input text'. when I didnt type anything?

Quote:

if(dialogid == 16512)
{
if(response)
{
if(strlen(inputtext) >= 2 && strlen(inputtext) <= 64)
{
strmid(arrUpdates[iUpd][g_Update1], inputtext, 0, strlen(inputtext), sizeof arrUpdates);
//arrUpdates[iUpd][g_Update1] = strlen(inputtext);
format(string, sizeof(string), "You have changed Update 1 to %s. (/updates)", inputtext);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
CreateDynamicUpdates(strlen(inputtext));
SaveDynamicUpdates();
}
else return ShowPlayerDialog(playerid, 16512, DIALOG_STYLE_LIST, "Update 1:", "Input text\nClear Update", "Select", "Cancel");
}
}

Quote:

if(dialogid == 16525)
{
if(response)
{
if(listitem == 0)
{
format(string, sizeof(string), "(Updates must remain under 64 characters)", arrUpdates[iUpd][g_Update1]);
ShowPlayerDialog(playerid, 16512, DIALOG_STYLE_INPUT, "Edit Updates", string, "Select", "Cancel");
}
if(listitem == 1)
{
arrUpdates[iUpd][g_Update1] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have cleared Update 1 and it no longer exists.");
SaveDynamicUpdates();
}
}
}

Reply
#6

bump
Reply
#7

Hmm.. Maybe try the len with a different variable?
PHP код:
if(dialogid == 16512)
{
if(
response)
{
new 
len strlen(inputtext);
if(
len && len 65)
{
strmid(arrUpdates[iUpd][g_Update1], inputtext0strlen(inputtext), sizeof(arrUpdates));
//arrUpdates[iUpd][g_Update1] = strlen(inputtext);
format(stringsizeof(string), "You have changed Update 1 to %s. (/updates)"inputtext);
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
CreateDynamicUpdates(strlen(inputtext));
SaveDynamicUpdates();
}
else 
{
ShowPlayerDialog(playerid16512DIALOG_STYLE_LIST"Update 1:""Input text\nClear Update""Select""Cancel");
}

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)