Vehicles wont load at file - 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: Vehicles wont load at file (
/showthread.php?tid=410694)
Vehicles wont load at file -
RACGaming - 26.01.2013
On my OnGamemodeInit() i have this script:
pawn Код:
//Vehicles
for(new i = 1; i <= MAX_VEHICLES; i++)
{
new file[128];
format(file, sizeof(file), "vehicles/%s.ini", i);
AddStaticVehicleEx(dini_Int(file,"Model"), dini_Float(file,"PosX"), dini_Float(file,"PosY"), dini_Float(file,"PosZ"), dini_Float(file,"Angle"), dini_Int(file,"Color1"), dini_Int(file,"Color2"), 0);
}
It should load every vehicle at scriptfiles/vehicles/
Like scriptfiles/vehicles/1.ini etc..
But it dosnt load, What is my problem?
Sorry for My bad english
Re: Vehicles wont load at file -
Threshold - 26.01.2013
If this doesn't work, the problem is in your saving/loading.
pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
new file[40];
format(file, sizeof(file), "vehicles/%d.ini", i);
if(!fexist(file)) continue;
AddStaticVehicleEx(dini_Int(file,"Model"), dini_Float(file,"PosX"), dini_Float(file,"PosY"), dini_Float(file,"PosZ"), dini_Float(file,"Angle"), dini_Int(file,"Color1"), dini_Int(file,"Color2"), 0);
}
EDIT: Also, make sure this line is spelled correctly, and has the proper capital letters etc.
Make sure you have created the folder 'vehicles' in your scriptfiles directory.
Reason: You had %s instead of %d, i is not a string, it is an integer.