Retrieving data from multiple rows and printing [Help]
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
You do NOT need the second query. At all. You already have the entire result set from the first query. Remove the second query and replace 0 with x in the cache_get_value statements.
Ok, now I'm not getting the row index 0, but I'm trying to make a faction list command. I can actually do that but I'm having troubles with deleted rows. Ex.:

Factions table:

Код:
ID | NAME
--------------
0    No // I don't need a ID 0
1    Goverment
2    LSPD
4    LSMD
My command:

Код:
CMD:factlist(playerid, params[])
{
    if(!AdminOnDuty(playerid) && pInfo[playerid][pAdmin] >= 6) return SendClientMessage(playerid, -1, NODUTY);
	SendClientMessage(playerid, ORANGE_ADMIN, "Factions:");
    for(new x=1; x<=TotalFaccs; x++)
    {
    	new string[500];
        format(string, sizeof(string), "ID %d: %s", x, fInfo[x][fName]);
        SendClientMessage(playerid, ORANGE_ADMIN, string);
    }
    return 1;
}
This will print:

Factions:
1. Goverment
2. LSPD
3. No


And I have no clue why. I know that the deleted row it's giving me some troubles, but I want a dynamic faction system so I must be able to delete a row and not screw up the whole code :P
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)