04.08.2016, 15:40
So I'm working on this dynamic faction system and I'm trying to list all factions, some weird reason it just lists the first column times the count of factions. I've tried debugging but I honestly can't see what I've done wrong?
(Don't comment on the variable sizes, those still need to be changed)
Код:
mysql_tquery(mysql, "SELECT `fName` FROM `factions` ORDER BY `fID` ASC", "ListFactions", "i", playerid);
Код:
forward ListFactions(playerid); public ListFactions(playerid) { new count = 0, rows, fields; cache_get_data(rows, fields, mysql); printf("start of list"); if(rows) { printf("if rows:%i", rows); new facname[MAX_FACTIONS][50], faclist[300]; while(count < rows) { cache_get_field_content(0, "fName", facname[count], mysql, 255); format(faclist, sizeof(faclist), "%s%s\n", faclist, facname[count]); printf("facname:%s count:%i rows:%i", facname[count], count, rows); count++; } return ShowPlayerDialog(playerid, DIALOG_FACTION_LIST, DIALOG_STYLE_LIST, "List Factions", faclist, "Okay", ""); } else { SendErrorMessage(playerid, "There are no factions."); return cmd_factions(playerid, ""); } }
Код:
[11:35:22] start of list [11:35:22] if rows:3 [11:35:22] facname:Los Santos Police Department count:0 rows:3 [11:35:22] facname:Los Santos Police Department count:1 rows:3 [11:35:22] facname:Los Santos Police Department count:2 rows:3
(Don't comment on the variable sizes, those still need to be changed)