30.07.2018, 16:25
Can someone tell me why this code doesn't work?
LoadxSafes:
It doesn't load safes stored in "BwhSafe" even if they're in the table..and i dont get the " printf("%d safes have been loaded.", loaded);" message in server console.
pawn Код:
new query[128];
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `BwhSafes`", "LoadxSafes");
mysql_query(g_SQL, query);
pawn Код:
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;
}