File check, need help, how can I do this? - 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: File check, need help, how can I do this? (
/showthread.php?tid=308235)
File check, need help, how can I do this? -
HondaCBR - 02.01.2012
Lets say I have cars saved in scripftiles, each car is called UID.ini, starting at 1000.ini. And in that file it says Spawned=0 or Spawned=1. How can I perform a check through everyfile and the files that say Spawned=1 ,get from them X Y and Z value. Then create vehicle in that position?
Here is my .ini file:
pawn Код:
Spawned=0
Locked=0
ModelID=560
Owner=JohnTra
X=821.807312
Y=-1334.597045
Z=13.251588
A=91.326400
Health=980.267822
Panels=0
Doors=0
Lights=0
Tires=0
Color1=3
Color2=3
Paintjob=255
SPOILER=1138
HOOD=-1
ROOF=1033
SIDESKIRT=1026
LAMPS=-1
NITRO=1010
EXHAUST=1028
WHEELS=1080
STEREO=1086
HYDRAULICS=-1
FRONT_BUMPER=1169
REAR_BUMPER=1141
VENT_RIGHT=-1
VENT_LEFT=-1
Im guessing I could use this to make the cars spawn, but IDK how to make that check trhough each file.
pawn Код:
new CarFile[35];
format(CarFile,sizeof(CarFile),"Auta/%d.ini",WHAT HERE?);
if(dini_Int(CarFile,"Spawned") == 0)
{
Car[playerid][VehicleGameID] = CreateVehicle(dini_Int(CarFile,"ModelID"),dini_Float(CarFile,"X"),dini_Float(CarFile,"Y"),dini_Float(CarFile,"Z"),dini_Float(CarFile,"A"),dini_Int(CarFile,"Color1"),dini_Int(CarFile,"Color2"),-1);
And what should I change the playerid to?