Spawn car via an .ini file.
#1

Solved. Thanks for the replies.
Reply
#2

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.
Reply
#3

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
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)