Problem with Loading Vehicles - 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: Problem with Loading Vehicles (
/showthread.php?tid=219282)
Problem with Loading Vehicles -
Antonio [G-RP] - 01.02.2011
pawn Код:
mysql_query("SELECT * FROM `vehicles` ORDER BY `SQLid` ASC");
mysql_store_result();
new carid;
while(mysql_fetch_row(resultline)==1)
MYSQL ERROR:
Код:
[20:23:29] MySQL Error (0): Function: 'mysql_fetch_row' called when no result stored.
Re: Problem with Loading Vehicles -
PeteShag - 01.02.2011
Sorry, but what does
pawn Код:
while(mysql_fetch_row(resultline)==1)
==1//I mean this
stannd for ? Sorry, just haven't seen it before. Anyways this is what I use
pawn Код:
while(mysql_fetch_row(string,"|"))
{
if(mysql_num_rows() == 0) continue;
or else
pawn Код:
//Top of script
#define LOAD_VEHICLES 1
//I call this on GamemOdeInit
Function: LoadVehicles()
{
mysql_query("SELECT * FROM `Vehicles` ORDER BY `vehicleid` ASC", LOAD_VEHICLES);
}
//under OnMysqlQuery
case LOAD_VEHICLES:
{
mysql_store_result();
new data[42][128];
while(mysql_fetch_row(string,"|"))
{
if(mysql_num_rows() == 0) continue;
explode(data, string, "|");
//printf(string);
new Carid = CreateVehicle(strval(data[1]), floatstr(data[2]), floatstr(data[3]), floatstr(data[4]), floatstr(data[5]), strval(data[6]), strval(data[7]), -1);
printf("Loading Vehicle Data id %i: %s", Carid, string);
VehicleInfo[Carid][vSQLID] = strval(data[0]);
VehicleInfo[Carid][vModel] = strval(data[1]);
//etc...
Re: Problem with Loading Vehicles -
Antonio [G-RP] - 01.02.2011
Thats how I was taught to do it. It used to work, just stopped.. for some reason.