function HandOutPrizes { //<teamarray>, <numplayers>, <itemid>, <qty>
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order by level limit 1",.acc_id,.acc_lvl);
if(.acc_lvl == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}
Problem:
space between
where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order
Try this:
function HandOutPrizes { //<teamarray>, <numplayers>, <itemid>, <qty>
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = '"+getd(getarg(0) + "[" + .@i + "]")+"' order by level limit 1",.acc_id,.acc_lvl);
if(getarraysize(.acc_lvl) == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}
I add also getarraysize in the if, since the query_sql returns array variables
Hope it work