CMD:vlist(playerid, params[]){
new query[500], i = 1;
new string[128];
format(query, sizeof(query),"SELECT * FROM pvehicles WHERE owner='%s'",playerVariables[playerid][pNormalName]);
mysql_query(query);
mysql_store_result();
while(mysql_get_field(query,"|"))
{
sscanf(query, "p<|>e<iiiiffffs[24]s[24]iiiiiii>", vehicleinfo[i]);
format(string, sizeof(string),"id(%d) Name:[%s] Times Destroyed [%d] ",i, vehicleinfo[i][Name],vehicleinfo[i][Destroyed]);
printf("query: %s", query);
SendClientMessage(playerid,COLOR_YELLOW2, string);
i++;
}
}
|
Sometimes I wonder if people actually read their own code. If it's a problem with an endless loop, then where do you look? (That was a rhetorical question.)
First you consult the wiki for proper usage of a function: https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_field_row Then you'll see that you're using the wrong function altogether. Finally you'll notice that the function you need is: https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_row_format |