Loading SQL Vehicles (how to?) - 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)
+--- Thread: Loading SQL Vehicles (how to?) (
/showthread.php?tid=334438)
Loading SQL Vehicles (how to?) -
Nuke547 - 14.04.2012
Basically, I got it so it saves the vehicles... But I'm not sure how to make it load them.
Its in the table vehicles and it has ID ( Auto Incromment ), model, col1, col2, x, y, z, angle.
Thanks!
Re: Loading SQL Vehicles (how to?) -
[HiC]TheKiller - 14.04.2012
Do something similar to this:
[PAWN]
//Top of script
#define MAX_CAR_FROM_DB 300
new carids[MAX_CAR_FROM_DB];
pawn Код:
mysql_query("SELECT * FROM vehicles");
mysql_store_result();
new row[500], id;
while(mysql_retrieve_row())
{
mysql_fetch_row(row);
id++;
sscanf(row, "....", ....);
carids[id] = AddStaticVehicle(...);
}
mysql_free_result();
Use that as a template.
Re: Loading SQL Vehicles (how to?) -
Nuke547 - 14.04.2012
Quote:
Originally Posted by [HiC]TheKiller
Do something similar to this:
[PAWN]
//Top of script
#define MAX_CAR_FROM_DB 300
new carids[MAX_CAR_FROM_DB];
pawn Код:
mysql_query("SELECT * FROM vehicles"); mysql_store_result(); new row[500], id; while(mysql_retrieve_row()) { mysql_fetch_row(row); id++; sscanf(row, "....", ....); carids[id] = AddStaticVehicle(...); } mysql_free_result();
Use that as a template.
|
How do I make it fetch all the positions and such?
What do you do with the sscanf?