10.08.2018, 11:40
Quote:
You should also free the query results with mysql_free_result().
|
PHP код:
stock LoadPlayerStats(playerid)
{
new query[200], name[24], Cache: result;
GetPlayerName(playerid, name, 24);
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `playerName` = '%e' LIMIT 1", name);
result = mysql_query(Database, query);
if(cache_num_rows())
{
cache_get_value_int(0, "playerAdmin", playerInfo[playerid][playerAdmin]);
cache_get_value_int(0, "playerMod", playerInfo[playerid][playerMod]);
cache_get_value_int(0, "playerHelper", playerInfo[playerid][playerHelper]);
cache_get_value_int(0, "playerLevel", playerInfo[playerid][playerLevel]);
cache_get_value_int(0, "playerCash", playerInfo[playerid][playerCash]);
cache_get_value_name_float(0, "playerX", playerInfo[playerid][playerX]);
cache_get_value_name_float(0, "playerY", playerInfo[playerid][playerY]);
cache_get_value_name_float(0, "playerZ", playerInfo[playerid][playerZ]);
}
SetPlayerScore(playerid, playerInfo[playerid][playerLevel]);
GivePlayerMoney(playerid, playerInfo[playerid][playerCash]);
SetSpawnInfo(playerid, 0,0,playerInfo[playerid][playerX],playerInfo[playerid][playerY], playerInfo[playerid][playerZ], 0, 0, 0, 0, 0,0,0);
cache_delete(result);
printf("player loaded.");
}