24.03.2017, 05:16
I'm working on a simple faction system.
I want to make a cmd which retrieves every faction and its ID.
I was thinking in something like
But I'm not sure about how I make it. Help please?
This is what I have so far but it's not working.
I want to make a cmd which retrieves every faction and its ID.
I was thinking in something like
Код:
while(SOMETHING) { SendClientMessage(FACTIONS) }
This is what I have so far but it's not working.
Код:
CMD:faclist(playerid, params[]) { if(!AdminOnDuty(playerid) && pInfo[playerid][pAdmin] >= 6) return SendClientMessage(playerid, -1, NODUTY); SendClientMessage(playerid, ORANGE_ADMIN, "Factions:"); new ccount; new sql[80], row; format(sql, sizeof(sql), "SELECT * FROM factions ORDER BY fID DESC"); mysql_query(g_SQL, sql); cache_get_row_count(row); ccount = row; for(new x = 1; x <= ccount; x++) { mysql_format(g_SQL, sql, sizeof(sql), "SELECT * FROM `factions` WHERE `fID` = %d", x); mysql_query(g_SQL, sql); cache_get_value_int(0, "ID", fInfo[x][fID]); cache_get_value_name(0, "Name", fInfo[x][fName]); new string[50]; format(string, sizeof(string), "ID %d: %s", fInfo[x][fID], fInfo[x][fName]); SendClientMessage(playerid, ORANGE_ADMIN, string); } return 1; }