Issues with saving vehicles to a file... [HELP!!!]
#1

I am making a RTS/TDM/RP/DM etc... server, and in it you can buy vehicles of destruction and transportation.
And I have encountered a problem...
pawn Code:
forward SaveVehicle(playerid);
public SaveVehicle(playerid)
{
        new model = GetVehicleModel(gPCar[playerid]);
        new pName[MAX_PLAYER_NAME];
        new sstring[64];
      GetPlayerName(playerid, pName, sizeof(pName));
        format(sstring, sizeof(sstring), "vehs/%s.txt", pName);
    new string[128];
    new count;
      new File:save = fopen(sstring, io_write);
      if (save)
      {
        gPCar[playerid] = GetPlayerVehicleID(playerid);
        new Float:xx, Float:yy, Float:zz, Float:z_rot;
                if (IsPlayerInVehicle(playerid,gPCar[playerid]))
                {
                if(model == 468 || model == 520 || model == 473){
                    GetVehicleZAngle(gPCar[playerid],z_rot);
                    GetVehiclePos(gPCar[playerid],xx,yy,zz);

            format(string, sizeof(string),"%d, %f, %f, %f, %f ;", model, xx, yy, zz, z_rot);
            fwrite(save, string);
            count++;
                if(model == 468){
                  sanchez[playerid] -= 1;
                    SendClientMessage(playerid,COLOR_WHITE,"SERVER: Sanchez saved.");
            }
                if(model == 520){
                  hydra[playerid] -= 1;
                    SendClientMessage(playerid,COLOR_WHITE,"SERVER: Hydra saved.");
            }
                if(model == 473){
                  dinghy[playerid] -= 1;
                    SendClientMessage(playerid,COLOR_WHITE,"SERVER: Dinghy saved.");
            }
            }
          }
        fclose(save);
      }
}
This script will save the vehicle into a file when called apon, however, it erases anything before it. The script is supposed to allow more than one vehicle saved, but it doesn't work the way I want it to.

Help would appreciated, I've tried everything I can think of to fix it.

Indentation is not an issue.
Reply
#2

Never mind I got it. Delete please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)