enum Interiors
{
iID,
iInt,
iDesc,
iVirtual,
iPickup,
Float:iX,
Float:iY,
Float:iZ,
Float:iEx,
Float:iEy,
Float:iEz
};
new InteriorInfo[Interiors];
public LoadInts()
{
new intdata[255], string[255];
format(query, sizeof(query), "SELECT * FROM `interiors` ORDER BY `id`;");
mysql_query(query);mysql_store_result();
printf("\nSQL Table loads (NOT PLAYERS)");
print("------------------------------------");
while(mysql_fetch_row(intdata,"|"))
{
mysql_fetch_field("id", intdata); InteriorInfo[iID] = strval(intdata);
mysql_fetch_field("int", intdata); InteriorInfo[iInt] = strval(intdata);
mysql_fetch_field("virtual", intdata); InteriorInfo[iVirtual] = strval(intdata);
mysql_fetch_field("pickup", intdata); InteriorInfo[iPickup] = strval(intdata);
mysql_fetch_field("x", intdata); InteriorInfo[iX] = floatstr(intdata);
mysql_fetch_field("y", intdata); InteriorInfo[iY] = floatstr(intdata);
mysql_fetch_field("z", intdata); InteriorInfo[iZ] = floatstr(intdata);
mysql_fetch_field("ex", intdata); InteriorInfo[iEx] = floatstr(intdata);
mysql_fetch_field("ey", intdata); InteriorInfo[iEy] = floatstr(intdata);
mysql_fetch_field("ez", intdata); InteriorInfo[iEz] = floatstr(intdata);
mysql_fetch_field("desc", InteriorInfo[iDesc]);
CreatePickup(InteriorInfo[iPickup], 1, InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ], 0);
Create3DTextLabel(InteriorInfo[iDesc], COLOR_BRIGHTRED, InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ], 20.0, 0);
format(string, sizeof(string), "%s %f %f %f", InteriorInfo[iDesc], InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ]);
print(string);
}
format(string, sizeof(string), "[MySQL] Loaded interiors from database, a total of: %d", mysql_num_rows());
printf(string);
return 1;
}
id desc int virtual pickup x y z ex ey ez 1 Controlroom 0 0 1559 1557.2798 -1614.2976 13.3828 1555.6104 -1614.3075 13.3828 2 Los Santos Police Department 6 0 1559 1554.0829 -1675.5900 16.1953 246.783996 63.900199 1003.640625 3 Ganton Gym 5 0 1559 2229.6560 -1721.5797 13.5643 772.111999 -3.898649 1000.728820 4 Jefferson Motel 15 0 1559 2232.2334 -1159.7573 25.8906 2215.454833 -1147.475585 1025.796875 5 Burger Shot 10 0 1559 1199.4281 -918.6729 43.1181 375.962463 -65.816848 1001.507812 8 Burger Shot 10 0 1559 811.1805 -1616.3197 13.5469 375.962463 -65.816848 1001.507812 6 Burger Shot 10 0 1559 2398.4216 -1898.3119 13.5469 375.962463 -65.816848 1001.507812 7 Burger Shot 10 0 1559 2420.4954 -1508.8000 24.0000 375.962463 -65.816848 1001.507812 9 Well stacked pizza 5 0 1559 2104.8223 -1806.5011 13.5547 373.825653 -117.270904 1001.499511 10 Rusty browns donuts 17 0 1559 1038.0732 -1340.078 13.7371 381.169189 -188.803024 1000.632812 11 Well stacked pizza 3 0 1559 1480.9524 -1770.2269 18.7958 384.808624 173.804992 1008.382812 12 ZIP Clothing 18 0 1559 -1138.1721 23.9871 45.3713 161.391006 -93.159156 1001.804687 13 Binco Clothing 15 0 1559 -1664.8224 15.4766 169.6903 207.737991 -109.019996 1005.132812 14 Victim Clothing 11 0 1559 -1501.1610 31.0568 292.3217 226.293991 -7.431529 1002.210937 15 Ten Green Bottles 11 0 1559 -1643.7958 14.8270 317.4572 501.980987 -69.150199 998.757812
new Float:datafloat[3],Datavars[5],Datastring[256];
// then
mysql_fetch_field("x", Datafloat); InteriorInfo[iX] = Datafloat;
i had a similiar problem.
try making different vars for the intdata strdata and floatdata. pawn Код:
|
public LoadInts()
{
new line[1024], Intvar[4], Float:Intfloat[6], Intstr[1][100];
format(query, sizeof(query), "SELECT * FROM `interiors` ORDER BY `id`;");
mysql_query(query);
mysql_store_result();
printf("\nSQL Table loads (NOT PLAYERS)");
print("------------------------------------");
if(mysql_num_rows() > 0)
{
if(mysql_fetch_row(intdata))
{
sscanf(line, "p<|>ddddffffffs[100]",Intvar[0],Intvar[1],Intvar[2],Intvar[3],Intfloat[0],Intfloat[1],Intfloat[2],Intfloat[3],Intfloat[4],Intfloat[5],Intstr[0]));
InteriorInfo[iID] = Intvar[0];
InteriorInfo[iInt] = Intvar[1];
InteriorInfo[iVirtual] = Intvar[2];
InteriorInfo[iPickup] = Intvar[3];
InteriorInfo[iX] = Intfloat[0];
InteriorInfo[iY] = Intfloat[1];
InteriorInfo[iZ] = Intfloat[2];
InteriorInfo[iEx] = Intfloat[3];
InteriorInfo[iEy] = Intfloat[4];
InteriorInfo[iEz] = Intfloat[5];
format(InteriorInfo[iDesc],100,"%s",Intstr[0]);
CreatePickup(InteriorInfo[iPickup], 1, InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ], 0);
Create3DTextLabel(InteriorInfo[iDesc], COLOR_BRIGHTRED, InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ], 20.0, 0);
format(string, sizeof(string), "%s %f %f %f", InteriorInfo[iDesc], InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ]);
print(string);
}
}
format(string, sizeof(string), "[MySQL] Loaded interiors from database, a total of: %d", mysql_num_rows());
printf(string);
return 1;
}