public OnVehicleSpawn(vehicleid)
{
new string[64];
if(IsAnOwnableCar(vehicleid))
{
if(CarInfo[vehicleid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(vehicleid, CarInfo[vehicleid][cPaintjob]);
}
SetVehicleModifications(vehicleid);
SetVehicleVirtualWorld(vehicleid, CarInfo[vehicleid][cVirWorld]);
new reg = CarInfo[vehicleid][cReg];
format(string, sizeof(string),"{157DEC}LS{FF0000}-%d-",reg);
SetVehicleNumberPlate(vehicleid, string);
SetVehicleToRespawn(vehicleid);
}
if(IsARentableVeh(vehicleid))
{
Gas[vehicleid] = 10;
}
if(IsACopCar(vehicleid))
{
format(string, sizeof(string),"UNIT %d",vehicleid);
//SetVehicleToRespawn(vehicleid);
SetVehicleNumberPlate(vehicleid, string);
//SetVehicleToRespawn(vehicleid);
}
if(IsNgCar(vehicleid))
{
format(string, sizeof(string),"NG %d",vehicleid);
//SetVehicleToRespawn(vehicleid);
SetVehicleNumberPlate(vehicleid, string);
// SetVehicleToRespawn(vehicleid);
}
if(IsAGovernmentCar(vehicleid))
{
format(string, sizeof(string),"GOV %d",vehicleid);
//SetVehicleToRespawn(vehicleid);
SetVehicleNumberPlate(vehicleid, string);
//SetVehicleToRespawn(vehicleid);
}
if(IsASalesVehicle(vehicleid))
{
format(string, sizeof(string),"{FF0000}FOR SALE");
//SetVehicleToRespawn(vehicleid);
SetVehicleNumberPlate(vehicleid, string);
//SetVehicleToRespawn(vehicleid);
}
gEngine[vehicleid] = 0;
engineOn[vehicleid] = 0;
if(IsModelABycicle(vehicleid))
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
engineOn[vehicleid] = true;
gEngine[vehicleid] = true;
engineOn[vehicleid] = true;
RestartCar(vehicleid);
return 1;
}
return 1;
}
new vehicleid = CreateVehicle(....);
if(IsModelABycicle(vehicleid))
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
OnVehicleSpawn is only called when a vehicle respawns.
So you need to set the engine parameter to on when the vehicle is created, too. pawn Код:
|