JohnDoe91286 Posted July 18, 2009 Share Posted July 18, 2009 Is there a command to put in a script that makes a bind key for players like when freeroam is on "F" becomes the bind key for Jeptack toggle. I want to make a vehicle engine on/off toggle. Link to comment
jkub Posted July 18, 2009 Share Posted July 18, 2009 Try this. As for disabling the other keys in the freeroam script I think youd have to do that manualy But here the toggles are I guess:) function toggleEngine ( thePlayer ) local isOn = getVehicleEngineState ( getPlayerOccupiedVehicle(thePlayer) ) if isPlayerInVehicle ( thePlayer ) then if isOn == true then setVehicleEngineState ( getPlayerOccupiedVehicle(thePlayer), false ) outputChatBox ( "*Engine off*", thePlayer ) elseif isOn == false then setVehicleEngineState ( getPlayerOccupiedVehicle(thePlayer), true ) outputChatBox ( "*Engine on*", thePlayer ) end end end function toggleJetpack ( thePlayer ) local hasJetpack = doesPlayerHaveJetpack ( thePlayer ) if isPlayerInVehicle ( thePlayer ) then --... else if hasJetpack == true then removePlayerJetPack ( thePlayer ) outputChatBox ( "*Jetpack removed*", thePlayer ) elseif hasJetpack == false then givePlayerJetPack ( thePlayer ) outputChatBox ( "*Jetpack equip*", thePlayer ) end end end function bindControls ( ) bindKey ( thePlayer, "o", "down", toggleEngine ) bindKey ( thePlayer, "f", "down", toggleJetpack ) end addEventHandler ( "onPlayerSpawn", getRootElement(), bindControls ) Link to comment
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