02.02.2019, 16:31
This example is ok, but when I want add values from database, iterator save only first record. Just like here:
Same, iterator don't save all records, but only one:
SCM >> 150, 2000, 350
print Iter_test in foreach, return only 150
PHP код:
stock test2(playerid)
{
new Iterator : Iter_Test<20>;
mysql_query(MyDB, "SELECT Money from players");
new money, info[128];
for(new i = 0, j = cache_num_rows(); i != j; ++i)
{
cache_get_value_int(i,"Money", money);
Iter_Add(Iter_Test, money);
format(info, sizeof(info), "Money: %d", money);
SCM(playerid, 0xFFFFFFFF, money);
}
foreach(new id : Iter_Test)
{
printf("%d", id);
}
return 1;
}
SCM >> 150, 2000, 350
print Iter_test in foreach, return only 150