Vehicles - 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: Vehicles (
/showthread.php?tid=83821)
Vehicles -
lakierka - 27.06.2009
Hi.. I'm doing script, when I restart my gamemode, that all vehicles would stay in the same positions like before restarting.. Here is the script:
Код:
public OnGameModeExit()
{
for(new k = 0; k < MAX_VEHICLES; k++)
{
new string[128];
new Float:X, Float:Z, Float:Y;
GetVehiclePos(k, X, Y, Z);
new File:pos=fopen("positions.txt", io_append);
format(string, 256, "GetVehiclePos", X, Y, Z);
fwrite(pos, string);
fclose(pos);
}
return 1;
}
I don't know where is positions.txt file. Can you tell is this good script? And how to load that file when my servers turns on.
Re: Vehicles -
Grim_ - 27.06.2009
https://sampwiki.blast.hk/wiki/File_Functions
Re: Vehicles -
lakierka - 27.06.2009
Quote:
Originally Posted by Swift_
|
I've tried to do like in this web, but file doesn't creates.. Can you tell me what's wrong?
Re: Vehicles -
Grim_ - 27.06.2009
Eh, I don't know howto use files manually (.ini) so I can't help you there. Just manually make the file in the scriptfiles folder.
Re: Vehicles -
lakierka - 27.06.2009
So no one knows how to do that after restar cars would stay in the same place like before restart?
Re: Vehicles -
Weirdosport - 27.06.2009
format(string, 256, "GetVehiclePos", X, Y, Z); - There's one of your problems...
Another fail is the fact you use io_append. If the file doesn't exist, this wont do squat. Use io_write or read the wiki..
Re: Vehicles -
lakierka - 27.06.2009
Quote:
Originally Posted by Weirdosport
format(string, 256, "GetVehiclePos", X, Y, Z); - There's one of your problems...
Another fail is the fact you use io_append. If the file doesn't exist, this wont do squat. Use io_write or read the wiki..
|
Ok.. I changed to io_write. Bu how can I fix it: format(string, 256, "GetVehiclePos", X, Y, Z); ?