Jump to content

Delete car after disconnect


Teddy_Hatchet

Recommended Posts

How can I delete a player's car after leaving the game?

mp.events.add('mycar', (player=>
    if(!player.vehicle){
        DB.Handle.query('SELECT * FROM accounts WHERE nickname = ?', [player.name], function(e,res){
            if(res[0]){
                let target = mp.players.at(player.id);
                var cVeh = player.getVariable('playerVeh'+player.id);
                if(cVeh !=nullcVeh.destroy();
                let pos;
                pos = target.position;
                var playerVeh = mp.vehicles.new(mp.joaat(res[0].veh), new mp.Vector3(pos.x,pos.y,pos.z),{
                    heading: target.heading,
                });
                player.putIntoVehicle (playerVeh0);
                playerVeh.setColor(parseInt(res[0].col1), parseInt(res[0].col2));
                player.setVariable('playerVeh'+player.id,playerVeh); 
            }
        });
    }
    else return;
});
 
 
  • Like 1
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...