only one car loads help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: only one car loads help (
/showthread.php?tid=220426)
only one car loads help -
THE_KNOWN - 03.02.2011
Код:
LoadOvehs()
{
new query[128],Float:x,Float:y,Float:z,Float:r,mdl,vidid;
format(query,128,"SELECT * FROM orgvehs ORDER BY VID");
mysql_query(query);
mysql_store_result();
new row[128];
new field[13][32];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mdl=strval(field[1]);
x=strval(field[2]);
y=strval(field[3]);
z=strval(field[4]);
r=strval(field[5]);
vidid=CreateVehicle(mdl,x,y,z,r,0,1,-1);
vorg[vidid]=strval(field[0]);
return 1;
}
only one car gets loaded. what should i do?
Re: only one car loads help -
Vince - 03.02.2011
Make a loop?
pawn Код:
while(mysql_fetch_row_format(row, "|"))
{
// Your stuff
}
Re: only one car loads help -
THE_KNOWN - 04.02.2011
is this correct?
Код:
LoadOvehs()
{
new query[128],Float:x,Float:y,Float:z,Float:r,mdl,vidid;
format(query,128,"SELECT * FROM orgvehs ORDER BY VID");
mysql_query(query);
mysql_store_result();
new row[128];
new field[13][32];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
while(mysql_fetch_row_format(row, "|"))
{
mdl=strval(field[1]);
x=strval(field[2]);
y=strval(field[3]);
z=strval(field[4]);
r=strval(field[5]);
vidid=CreateVehicle(mdl,x,y,z,r,0,1,-1);
vorg[vidid]=strval(field[0]);
mysql_free_result();
}
return 1;
}