Saving file.
#1

Hi guys,

I need your help.
I want to save all cars, when the player exits the car (OnPlayerExitVehicle) to a file, so that at OnGameModeInit, after a restart, they spaawn the last exit Pos. Pls help me.
Reply
#2

Use dini, if you don't know how to do it then ask in the script request topic.
Reply
#3

I tried it with .cfg, but the Server gets crashed.
Reply
#4

Dini is a lot easier.
Reply
#5

Ok, where can i find a tutorial, or a thread?
Reply
#6

http://forum.sa-mp.com/index.php?topic=71935.0
Reply
#7

pawn Код:
new Float:X, Float:Y, Float:Z;
    GetVehiclePos(vehicleid, X, Y, Z);
    dini_FloatSet("/scriptfiles/car.ini", "F_X", X);
    dini_FloatSet("/scriptfiles/car.ini", "F_Y", Y);
    dini_FloatSet("/scriptfiles/car.ini", "F_Z", Z);
So,ok, and for every car an extra file, or what?
Reply
#8

This is just an example:
pawn Код:
new Float:x_pos, Float:y_pos, Float:z_pos, string[128];
for(new v = 0; v < _YOUR_MAX_VEHICLES_DEFINE_; v++)
{
  format(string, sizeof(string), "car%d.ini", v);
  if(!dini_Exists(string))
  {  
    GetVehiclePos(v, x_pos, y_pos, z_pos);
    dini_Create(string);
    dini_FloatSet(string, "vehX", x_pos);
    dini_FloatSet(string, "vehY", y_pos);
    dini_FloatSet(string, "vehZ", z_pos);
  }
  else
  {
    GetVehiclePos(v, x_pos, y_pos, z_pos);
    dini_FloatSet(string, "vehX", x_pos);
    dini_FloatSet(string, "vehY", y_pos);
    dini_FloatSet(string, "vehZ", z_pos);  
  }
}
Reply
#9

Ok, thanks, and how can i set this float to OnGameModeinit to spawn?
Reply
#10

Get the float value with the dini_Float function and give it to the vehicle you want to create. Again, check the link i gave you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)