Sande Posted March 29, 2013 Share Posted March 29, 2013 Hello, i try make emergencybrake for train or something. Engine turns off but togglecontrols not work. So can someone fix this pls THAANKS! function emg ( player, command, target, source ) local targetPlayer = getPlayerFromName ( target ) if ( targetPlayer ) then local theVehicle = getPedOccupiedVehicle ( targetPlayer ) if ( theVehicle ) then setVehicleEngineState ( theVehicle, false ) toggleControl ( source, "brake_reverse", true ) toggleControl ( soource, "accelerate", true ) end end end addCommandHandler ( "emg", emg ) function emgoff ( player, command, target, source ) local targetPlayer = getPlayerFromName ( target ) if ( targetPlayer ) then local theVehicle = getPedOccupiedVehicle ( targetPlayer ) if ( theVehicle ) then setVehicleEngineState ( theVehicle, true ) toggleControl ( source, "brake_reverse", false ) toggleControl ( source, "accelerate", false ) end end end addCommandHandler ( "emg-off", emgoff ) Link to comment
iPrestege Posted March 29, 2013 Share Posted March 29, 2013 Change source > player and try . Link to comment
Sande Posted March 29, 2013 Author Share Posted March 29, 2013 , not work new code function emg ( player, command, target, source ) local targetPlayer = getPlayerFromName ( target ) if ( targetPlayer ) then local theVehicle = getPedOccupiedVehicle ( targetPlayer ) if ( theVehicle ) then setVehicleEngineState ( theVehicle, false ) if ( player ) then toggleControl ( player, "brake_reverse", true ) toggleControl ( player, "accelerate", true ) end end end addCommandHandler ( "emg", emg ) function emgoff ( player, command, target, source ) local targetPlayer = getPlayerFromName ( target ) if ( targetPlayer ) then local theVehicle = getPedOccupiedVehicle ( targetPlayer ) if ( theVehicle ) then setVehicleEngineState ( theVehicle, true ) if ( player ) then toggleControl ( player, "brake_reverse", false ) toggleControl ( player, "accelerate", false ) end end end addCommandHandler ( "emg-off", emgoff ) Link to comment
Sande Posted March 29, 2013 Author Share Posted March 29, 2013 Hmm, it doesnt work in train. How i can code it to work in train 538 ? 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