SA-MP Forums Archive
Spawn car via an .ini 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawn car via an .ini file. (/showthread.php?tid=188115)



Spawn car via an .ini file. - Biesmen - 06.11.2010

Solved. Thanks for the replies.


Re: Spawn car via an .ini file. - [HUN]Jaki - 06.11.2010

In my script I spawn all the vehicles form a txt, it looks like this:
pawn Код:
new File:vehicles=fopen("vehicles.txt", io_read);
new idx;
while(fread(vehicles, string)){
    idx = 0
    modelid = strval(strtok(string,idx));
    X = floatstr(strtok(string,idx));
    Y = floatstr(strtok(string,idx));
    Z = floatstr(strtok(string,idx));
    rot = floatstr(strtok(string,idx));
    c1 = strval(strtok(string,idx));
    c2 = strval(strtok(string,idx));
    AddStaticVehicle(modelid,X,Y,Z,rot,c1,c2);
}
vehicles.txt:
Код:
(...)411 2034.5016 1912.5874 11.9048 0.2909 123 1
411 2172.1682 1988.8643 10.5474 89.9151 116 1(...)
Hope this could help you.


Re: Spawn car via an .ini file. - Hiddos - 06.11.2010

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Код:
format(file, sizeof(file), "\\CarSystem\\%s.ini", playername);
Err, are these double 'slashes' supposed to be there instead of single slash? ("\CarSystem\%s.ini")

And a note: gl_common.inc (In the include folder, not the include folder in the pawno directory but in your main folder) has got a function called "LoadStaticVehiclesFromFile", you might take a look at it


Re: Spawn car via an .ini file. - Biesmen - 06.11.2010

Used a single slash, didn't work neither. It doesn't load the ini file.
Edit:
Solved it, thanks to xcasio. I forgot I used udb_encode, but I didn't 'define' it for playername.