Jump to content
Sign in to follow this  
Dr.Nymphoz

Respawn a vehicle

Recommended Posts

Hello everyone, may anyone help here? How can i respawn a vehicle that was spawned on server by script in init.c ? i need something like this parameter <restock>30</restock>.

My script to spawn a vehicle on server:

void spawnVehicle(string type, vector position)
{
    EntityAI car = GetGame().CreateObject(type, position);
    car.SetPosition(position);
        autoptr array<string> m_Attachments = {
        "HeadlightH7","HeadlightH7","SparkPlug","CarBattery","CarRadiator","EngineBelt",
        "CivSedanDoors_Driver","CivSedanDoors_CoDriver","CivSedanDoors_BackLeft","CivSedanDoors_BackRight","CivSedanHood","CivSedanTrunk",
        "CivSedanWheel","CivSedanWheel","CivSedanWheel","CivSedanWheel"};
        if (car)        
            foreach (string att : m_Attachments)
            car.GetInventory().CreateAttachment(att);
        auto carfluids = Car.Cast( car );
        carfluids.Fill( CarFluid.FUEL, 100 );
        carfluids.Fill( CarFluid.OIL, 1000 );
        carfluids.Fill( CarFluid.BRAKE, 1000 );
        carfluids.Fill( CarFluid.COOLANT, 1000 );
 }
void main()
{
    //VEHICLE
spawnVehicle( "CivilianSedan", "8742.036133 8.230740 2331.631104");
spawnVehicle( "CivilianSedan", "8877.351563 9.299133 2257.636230");
}

i would use a vehicle spawn with "cfgspawnabletypes.xml" without scripts but i don't know how to spawn a vehicle with full fuel not using a script... (sorry for my poor english).

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×