28.03.2015, 21:04
Hey,
why doesn't this work?
Seems like something is wrong with the listitem.
why doesn't this work?
Код:
enum l_data{//listitem
listname[MAX_FRAK_LEN],
bool:used = false
}
new list[MAX_LIST][l_data];
//..
for(new i = 0;i < Fraks; i++)
{
format(string,sizeof(string),"%s%s | "#HEXBlue"%s\n",string, fraktion[i][f_name], fraktion[i][f_leader]);
format(list[i][listname], MAX_FRAK_LEN, fraktion[i][f_name]);
list[i][used] = true;
printf("%s",list[i][listname]); // -> Output is okay.
}
//.. OnDialogResponse
new len = CountActiveList() - 1;
printf("%d", len);
new string[200];
printf("%d",listitem);
if(listitem <= len)
{
printf("%s",list[listitem][listname]); // Output is wrong. Just random chars
var[playerid][sList] = listitem;
}
else if(listitem == (len + 1))
{
printf("%d | %d", listitem, len);
print("add");
}
else if(listitem >= (len + 2))
{
printf("%d | %d", listitem, len);
print("Delete");
}
stock CountActiveList()
{
new count;
new i = 0;
for(;i < MAX_LIST; i++ )
{
if(list[i][used] == false)continue;
count ++;
}
return count;
}


) 24h.