OnVehicleDeath help
#1

Hello guys i got incuranses at my car system. When a car is destroyded it deletes all cars from player's foloder how can i make only the car is destroyded to delete?

Код:
public OnVehicleDeath(vehicleid)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
    {
    			new plname[MAX_PLAYER_NAME];
			GetPlayerName(i, plname, sizeof(plname));
  new string[64];
  if(strcmp(plname, VehicleInfo[vehicleid][vOwner], true) == 0)
			{
    if(VehicleInfo[vehicleid][vOwned])
    {
      if(VehicleInfo[vehicleid][vInsurances] >= 1)
      {

        VehicleInfo[vehicleid][vInsurances]--;
        VehicleInfo[vehicleid][vScratch] += 1;
         new file[256];
					format(file, sizeof(file), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
					if(dini_Exists(file))
					{
            	dini_IntSet(file, "Scratches", VehicleInfo[vehicleid][vScratch]);
		  			dini_IntSet(file, "Insurances", VehicleInfo[vehicleid][vInsurances]);
	  			}
        format(string, sizeof(string), "You have %d insurance left.", VehicleInfo[vehicleid][vInsurances]);
        SendClientMessage(i, COLOR_LIGHTRED, string);
         format(string, sizeof(string), "You have now %d Scratches in your car.", VehicleInfo[vehicleid][vScratch]);
        SendClientMessage(i, COLOR_LIGHTRED, string);

        return 1;
}
else
{
format(string, sizeof(string), "You have 0 insurance left and now your car has been destroyed.");
SendClientMessage(i, COLOR_LIGHTRED, string);
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh1], "None", 0, strlen("None"), 255);
fremove(string);
strmid(PlayerVehicle[i][pVeh2], "None", 0, strlen("None"), 255);
fremove(string);
strmid(PlayerVehicle[i][pVeh3], "None", 0, strlen("None"), 255);
fremove(string);
strmid(PlayerVehicle[i][pVeh4], "None", 0, strlen("None"), 255);
fremove(string);
strmid(PlayerVehicle[i][pVeh5], "None", 0, strlen("None"), 255);
      }
    }
  }
  return 1;
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)