23.02.2013, 16:23
Hello, I'm currently having a problem with my looping to search through data in a mysql database.
I'm using a /vlist command to list what vehicles a user has, but it loops constantly at least 100 times and just outputs a load of useless information.
I'm using a /vlist command to list what vehicles a user has, but it loops constantly at least 100 times and just outputs a load of useless information.
Код:
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++; } }