Teddy_Hatchet Posted October 26, 2020 Share Posted October 26, 2020 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 !=null) cVeh.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 (playerVeh, 0); playerVeh.setColor(parseInt(res[0].col1), parseInt(res[0].col2)); player.setVariable('playerVeh'+player.id,playerVeh); } }); } else return; }); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now