21.02.2018, 20:07
you use mysql_tquery to send the query and then on the callback you use cache_num_rows() to get the number of rows.
Example from Wiki
Example from Wiki
Код:
forward OnPlayerDataLoaded(playerid); public OnPlayerConnect(playerid) { new query[128], pname[MAX_PLAYER_NAME]; new array[10] = {1, 2, ...}; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `players` WHERE `name` LIKE '%e'", pname); mysql_tquery(MySQL, query, "OnPlayerDataLoaded", "dad", playerid, array, sizeof array); return 1; } public OnPlayerDataLoaded(playerid, array[], array_size) { //Query processed, you can now execute cache functions (like cache_get_value_index) here. printf("There are %d players with the same name.", cache_num_rows()); return 1; }