07.10.2013, 15:57
Try this, it's using cache:
It should work.
Код:
CMD:checkbolo(playerid, params[]) { new vehicleid; if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "[CMD]: /checkbolo [vehicleid]"); if(playerinfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_ERROR, MUTED_ERROR); if(playerinfo[playerid][pLogado] == 0) return SendClientMessage(playerid, COLOR_ERROR, LOGIN_ERROR); format(query, sizeof(query), "SELECT Bolo FROM `vehicleinfo` WHERE ID = %d",vehicleid); mysql_function_query(MYSQLConnection, query, true, "BoloReturnMessage", "d", playerid); SendClientMessage(playerid, COLOR_GREY, "Returning Bolo from database:"); return 1; } forward BoloReturnMessage(playerid); public BoloReturnMessage(playerid) { new rows, fields; cache_get_data(rows, fields); if(Rows != 0) { new content[1]; new bstring[128], bolo; cache_get_field_content(0, "Bolo", content); bolo = strval(content); format(bstring, sizeof(bstring), "Bolo: %s", bolo); SendClientMessage(playerid, COLOR_GREY, bstring); } else { SendClientMessage(playerid, COLOR_GREY, "Failed to retrieve info from the database."); } format(string, sizeof(string), "Bolo: %s", query); SendClientMessage(playerid, COLOR_GREY, query); }