This topic was marked solved by its starter, on December 7th, 01:22 PM

KrooB

  • Jr. Member
  • BEN TÜRKÜM
  • Posts: 87
MYSQL Code Mistake
«  »Last edited
where's mistake

Code: [Select]
function LoadVehicles()
{
local start = clock();
local q4 = mysql_query(db, "SELECT Model, Position, Angle, Col1, Col2, Parked, rowid FROM vehicles"), splitPos, x, y, z, splitPark, px, py, pz, ax, ay, az
local q5;
local i = 0;
while (q5 = mysql_fetch_row(q4))
{
mysql_query( db, "UPDATE vehicles SET rowid = "+i+" WHERE Position="+q5[5]+"");
local model = q5[0];
splitPos = split(q5[1], ", ");
x = splitPos[0];
y = splitPos[1];
z = splitPos[2];
local Angle = q5[2];
local Col1 = q5[3];
local Col2 = q5[4];
CreateVehicle(model.tointeger(), 0, Vector(x.tofloat(), y.tofloat(), z.tofloat()), Angle.tofloat(), Col1.tointeger(), Col2.tointeger());
if (q5[5] != "N")
{
splitPark = split(q5[5], ", ");
px = splitPark[0];
py = splitPark[1];
pz = splitPark[2];
ax = splitPark[3];
ay = splitPark[4];
az = splitPark[5];
FindVehicle(i).SpawnPos = Vector(px.tofloat(), py.tofloat(), pz.tofloat());
FindVehicle(i).Pos = Vector(px.tofloat(), py.tofloat(), pz.tofloat());
FindVehicle(i).EulerSpawnAngle = Vector(ax.tofloat(), ay.tofloat(), az.tofloat());
FindVehicle(i).EulerAngle = FindVehicle(i).EulerSpawnAngle;
}
i++;
if (i == mysql_num_rows(q4))
{
local finish = clock() - start;
print(i + " vehicles created in " + finish + " sec");
}
}
mysql_free_result(q4);
GetSQLNextRow(q4);
}
we are new because we are watching the old ???

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & BRL and XS Evolution Developer
  • Posts: 417
Re: MYSQL Code Mistake
« Reply #1,  »
Code: [Select]
local q4 = mysql_query(db, "SELECT Model, Position, Angle, Col1, Col2, Parked, rowid FROM vehicles"), splitPos, x, y, z, splitPark, px, py, pz, ax, ay, az

this line is not complete
Youtube Channel: www.youtube.com/TakanaueVCMP
Code: [Select]
if( !sucess ) tryAgain();

KrooB

  • Jr. Member
  • BEN TÜRKÜM
  • Posts: 87
we are new because we are watching the old ???