Loading car spawns from 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: Loading car spawns from file? (
/showthread.php?tid=65733)
Loading car spawns from file? -
Littlejth - 15.02.2009
How would I go about loading car spawns from a file like the .txt spawns included in the server?
Re: Loading car spawns from file? -
[RP]Rav - 15.02.2009
well, a small scheme would look like this, I guess
Код:
public OnGameModeInit()
{
[....]
LoadVehiclesFromFile();
[...]
}
stock LoadVehiclesFromFile()
{
new File: file = fopen("file name", io_read);
new data[256];
while (fread(file,data))
{
// use something here to split the string into all sorts of smaller strings, usable for extracting data
// this requires every car to be saved like this >>> model,x,y,z,a,col1,col2
// so with commas to seperate the different values
CreateVehicle(model, x, y, z, a, col1, col2);
}
return 1;
}