Regarding Loading - 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: Regarding Loading (
/showthread.php?tid=244827)
Regarding Loading -
Antonio [G-RP] - 28.03.2011
This code crashes my OnGameModeInit. I have no idea what's wrong with it, but any help would be appreciated.
pawn Код:
public LoadVehicleExtras()
{
printf("Loading Vehicle Extras...");
new resultline[300];
mysql_query("SELECT * FROM `vehicle_extras` ORDER BY `model` ASC");
mysql_store_result();
new modelid;
new tmpmodel;
new arr[4];
while(mysql_fetch_row(resultline)==1)
{
if(!sscanf(resultline, "p<|>a<i>[4]", arr))
{
modelid = arr[0];
if(modelid < 400) continue;
tmpmodel = modelid-400;
VehicleExtraInfo[tmpmodel][vxModel] = modelid;
VehicleExtraInfo[tmpmodel][vxBasePrice] = arr[1];
VehicleExtraInfo[tmpmodel][vxMaxTrunks] = arr[2];
VehicleExtraInfo[tmpmodel][vxMaxSold] = arr[3];
}
else
{
print("Error: There was a problem parsing vehicle extra data! Moving to next result.");
}
}
mysql_free_result();
return 1;
}
Re: Regarding Loading -
Donya - 28.03.2011
nvm, i have no idea.
Re: Regarding Loading -
Antonio [G-RP] - 28.03.2011
That's fine. Does anybody know?
Re: Regarding Loading -
Tee - 28.03.2011
I don't know MySQL but 1 question. Do you have sscanf 2.0?
Re: Regarding Loading -
Antonio [G-RP] - 28.03.2011
I believe so, it's the plugin version.
Re: Regarding Loading - [L3th4l] - 28.03.2011
Try this:
pawn Код:
public LoadVehicleExtras()
{
printf("Loading Vehicle Extras...");
new resultline[300];
mysql_query("SELECT * FROM `vehicle_extras` ORDER BY `model` ASC");
mysql_store_result();
new modelid;
new tmpmodel;
new arr[4];
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row_format(resultline, "|"))
{
sscanf(resultline, "p<|>iiii", arr[0], arr[1], arr[2], arr[3]);
modelid = arr[0];
if(modelid < 400) continue;
tmpmodel - modelid-400;
VehicleExtraInfo[tmpmodel][vxModel] = modelid;
VehicleExtraInfo[tmpmodel][vxBasePrice] = arr[1];
VehicleExtraInfo[tmpmodel][vxMaxTrunks] = arr[2];
VehicleExtraInfo[tmpmodel][vxMaxSold] = arr[3];
}
}
else
{
print("No rows could be retrieved!");
}
mysql_free_result();
return 1;
}
Re: Regarding Loading -
Antonio [G-RP] - 28.03.2011
I'll try it, however the mysql log shows that it is retrieving all the information from the table..