Jump to content

Random 1.1 server crash


Recommended Posts

I, im creating vehicles with this event

//create vehicle and destroy old vehicle
"sanchezSelected" : (player) =>
            let oldCar = player.getVariable('veh')
            let teamName = player.getVariable('teamName');
            if (oldCar) oldCar.destroy();
            let veh = mp.vehicles.new(mp.joaat('sanchez2'), vehicleData[teamName].Location,
                        locked: false, 
                        heading: vehicleData[teamName].Heading,
                        dimension: 0
            veh.setColor(vehicleData[teamName].Color, vehicleData[teamName].Color);           
            setTimeout( () => {
                player.putIntoVehicle(veh, 0);
                }, 200);        
            player.setVariable('veh', veh);

And when player death i destroy it with this event.

mp.events.add("playerDeath", (player) => {
    let veh = player.getVariable('veh');
    if (veh) setTimeout(() => {
        if (veh) veh.destroy();
    }, 7500);

When i am testing the server solo all work fine but when we are playing more than 2 players spawning cars everytime we die, some random times the server crash and let me this error when the server have to destroy the car in the playerDeath event.

'Expired multiplayer object has been used'

What i'm doing wrong or how i could do this system of create/destroy vehicles? so i can evade the server crash.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...