25.06.2011, 17:09
(
Последний раз редактировалось Donya; 25.06.2011 в 17:55.
)
pawn Код:
LoadHouses()
{
new Query[156], i; //(156 looks fine, for now, if u ever add more vars, print it and count the text length.)
format(Query, sizeof(Query),"SELECT * FROM houses");
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows())
{
while(mysql_fetch_row(Query))
{
sscanf(Query, "d", i,
HD[i][ID] = i;
sscanf(Query, "ds[24]dffffffddddd", i,
HD[i][owner],
HD[i][price],
HD[i][exteriorX],
HD[i][exteriorY],
HD[i][exteriorZ],
HD[i][interiorX],
HD[i][interiorY],
HD[i][interiorZ],
HD[i][interiorInt],
HD[i][locked],
HD[i][gunslot1],
HD[i][locklevel],
HD[i][safeamount]);
if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
else CreatePickup(1272, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
printf("House %d created at x: %f, y: %f, z: %f, locklevel: %d", i, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], HD[i][locklevel]);
}
}
else print("No houses to load!");
print("House loading finished.");
mysql_free_result();
return 1;
}
id..hmm lets use 4 chars
owner - 24
price - 11
ex - 9
ey - 9
ez - 9
ix - 9
iy - 9
iz - 9
iint - 11
locked - 11
gunslot1 - 11
locklevel - 11
safeamount - 11
around 158. and i doubt int,locked,gunslot,locklevel, will reach 11 integers. so 156 is good for now.