Karmakun Posted March 3, 2019 Posted March 3, 2019 Hello Friendly Coders, I'm currently going crazy, i'm trying to output the vehicle name in chat. Once i enter a car, it should say "You're in an Vehicle. Hash: ${vehicle.model}, Seat: ${seat} , Name: ${vehicleName}". My Code: function playerEnterVehicleHandler(vehicle, seat) { var vehHash = vehicle.model; var vehName = vehHash.toString(); mp.gui.chat.push(`You're in an Vehicle. Hash: ${vehicle.model}, Seat: ${seat} , Name: ${vehicleName}.`); } Anything but the actual name works. I also tried: var vehicleHash = vehicle.model; var vehicleName = vehicleHash.toString(); I could work that out with an Array, but it would consider a lot of work... Any good tipps or work arounds? Best regards Karmakun, thanks for anyhelp!
Karmakun Posted March 3, 2019 Author Posted March 3, 2019 function playerEnterVehicleHandler(vehicle, seat) { var vehicleName = mp.game.ui.getLabelText(mp.game.vehicle.getDisplayNameFromVehicleModel(vehicle.model)); mp.gui.chat.push(`You're in an Vehicle. Hash: ${vehicle.model}, Seat: ${seat} , Name: ${vehicleName}.`); }); } Edit:mp.game.vehicle.getDisplayNameFromVehicleModel whas my answer... That whas a pain my nervs... With all respects, it couldn't got be done a little simplified?
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