new query[128];
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `BwhSafes`", "LoadxSafes");
mysql_query(g_SQL, query);
forward LoadxSafes();
public LoadxSafes()
{
new rows = cache_num_rows();
new id, loaded;
if(rows)
{
while(loaded < rows)
{
cache_get_value_name_int(loaded, "ID", id);
cache_get_value_name_float(loaded, "X", xSafe[id][safe_Pos][0]);
cache_get_value_name_float(loaded, "Y", xSafe[id][safe_Pos][1]);
cache_get_value_name_float(loaded, "Z", xSafe[id][safe_Pos][2]);
cache_get_value_name_float(loaded, "A", xSafe[id][safe_Pos][3]);
xSafe[id][safe_Obj] = CreateObject(2332, xSafe[id][safe_Pos][0], xSafe[id][safe_Pos][1], xSafe[id][safe_Pos][2], 0.0, 0.0, xSafe[id][safe_Pos][3]);
xSafe[id][safe_Info] = Create3DTextLabel("Type "SAMP_BLUE"/saferob "WHITE"to rob this safe.", -1, xSafe[id][safe_Pos][0], xSafe[id][safe_Pos][1], xSafe[id][safe_Pos][2]+1, 100, 0);
Iter_Add(xSafes, id);
loaded++;
}
}
printf("%d safes have been loaded.", loaded);
return 1;
}
cache_get_value_name_int(loaded, "ID", xSafe[loaded][safe_ID]);
cache_get_value_name_float(loaded, "X", xSafe[loaded][safe_Pos][0]);
cache_get_value_name_float(loaded, "Y", xSafe[loaded][safe_Pos][1]);
cache_get_value_name_float(loaded, "Z", xSafe[loaded][safe_Pos][2]);
cache_get_value_name_float(loaded, "A", xSafe[loaded][safe_Pos][3]);
"UPDATE ... SET ... WHERE ID=%d", ..., xSafe[loaded][safe_ID]);
cache_get_value_name_int(loaded, "ID", id);
mysql_tquery(g_SQL, "SELECT * FROM `BwhSafes`", "LoadxSafes");
[21:13:11] [DEBUG] mysql_tquery(0, "SELECT * FROM `BwhSafes`", "LoadxSafes", "") [21:13:11] [ERROR] mysql_tquery: invalid connection handle '0' [21:13:11] [DEBUG] mysql_tquery: return value: '0' |
[21:16:41] [DEBUG] cache_get_row_count(0x04AAA074) [21:16:41] [ERROR] cache_get_row_count: no active cache |
I don't have safe_ID. I did:
pawn Код:
|
Same.
Mysql log: Edit 2: Tried to call directly LoadxSafes(); in OnGameModeInit and got this: |