carolus Posted September 23 Posted September 23 so, i had trouble when i get inside a vehicle, the player turn on the engine automaticly, i want to prevent that by making some script when my player get into vehicle [ServerEvent(Event.PlayerEnterVehicle)] public void OnPlayerEnterVehicle(Player player, Vehicle vehicle, sbyte seatId) { player.TriggerEvent("disableDefaultEngineBehaviour"); if (seatId == -1) { bool engineStatus = vehicle.HasData("engine_status") ? vehicle.GetData<bool>("engine_status") : false; if (!engineStatus) { vehicle.EngineStatus = false; player.SendChatMessage("engine is off"); } else { player.SendChatMessage("engine is on."); } } } but, it didn;t work. so, i hope you can help me, thank you... for disableDefaultEngineBehaviour events mp.events.add('disableDefaultEngineBehaviour', () => { mp.game.vehicle.defaultEngineBehaviour = false; });
Kopra Posted September 23 Posted September 23 (edited) This needs to be applied each time player spawns: const PED_FLAG_STOP_ENGINE_TURNING = 429; mp.players.local.setConfigFlag(PED_FLAG_STOP_ENGINE_TURNING , true); This needs to be applied once in playerReady event: mp.game1.vehicle.defaultEngineBehaviour = false; mp.game.vehicle.defaultEngineBehaviour = false; Edited September 23 by Kopra
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