12.08.2018, 15:26
Hi
You can try this:
You can try this:
Код:
mysql_tquery(g_SQL,"SELECT u.Id + 1 AS FirstAvailableId FROM `yourtable` u LEFT JOIN `yourtable` u1 ON ul.Id = u.Id + 1 WHERE u1.Id IS NULL ORDER BY u.Id LIMIT 0, 1" , "sql_FirstNextID", "i",playerid);
Код:
forward sql_FirstNextID(playerid); public sql_FirstNextID(playerid) { new i,query[128]; cache_get_value_name_int(0, "FirstAvailableId",i); mysql_format(g_SQL, query,sizeof(query),"INSERT INTO `yourtable` (`id`) VALUES ('%i')",i); mysql_tquery(g_SQL, query); ... return 1; }