error 033: array must be indexed (variable "s")
#1

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new updates = GetPVarInt(playerid, "UID");
if(dialogid == DIALOG_UPDATE)
{
if(response)
{
if(isnull(inputtext)) return ShowPlayerDialog(playerid, DIALOG_UPDATE, DIALOG_STYLE_INPUT, "adding update", "please write your update below", "Add", "Cancel");
for(new x=1 ; x<560 ; x++)
{
new s[256];
format(s, sizeof(s), "update%d", x);
if(!dini_Isset("updates.ini", s))
{
new year, month, day;
getdate(year, month, day);
new utext[1024];
format(utext, sizeof(utext), "%d/%d/%d", day, month, year);
format(s, sizeof(s), "date%d", x);
dini_Set("updates.ini", s, utext);
format(utext, sizeof(utext), "%s", inputtext);
format(s, sizeof(s), "update%d", x);
dini_Set("updates.ini", s, utext);
new dd = dini_Int("updates.ini", "MAX");
dini_IntSet("updates.ini", "MAX", dd+1);
format(s, sizeof(s), "Added update id %d. Your Update: '%s', and Date: %d/%d/%d.", x, inputtext, day, month, year);
SendClientMessage(playerid, COLOR_YELLOW, s);
break;
}
}
return 1;
}
return 1;

error is in this line :
Quote:

if(!dini_Isset("updates.ini", s))

Reply
#2

Variable s is string so it must be indexed add [256] after that s like this:
Код:
if(!dini_Isset("updates.ini", s[256]))
By the way it's waste of cells 256 is too much
Reply
#3

Quote:
Originally Posted by p3p4
Посмотреть сообщение
error is in this line :
Your code seems correct, must be some errorneous version of dini. Better don't use dini at all.

Quote:
Originally Posted by TokicMajstor
Посмотреть сообщение
Variable s is string so it must be indexed add [256] after that s like this:
Код:
if(!dini_Isset("updates.ini", s[256]))
By the way it's waste of cells 256 is too much
No, that would mean the cell starting at offset 256 from s[0], which is even beyond the variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)