Guest Posted July 28, 2018 Share Posted July 28, 2018 Guys i wan't to disable using animation while driving a car i tried this code function restricAnimation (thePlayer, seat) cancelEvent() outputChatBox ("You can't use animations in vehicles ",seat) end addCommandHandler("anim", restricAnimation) addEventHandler ( "onVehicleEnter", getRootElement(), restricAnimation ) Link to comment
xMKHx Posted July 28, 2018 Share Posted July 28, 2018 function restricAnimation () local theVehicle = getPlayerOccupiedVehicle ( source ) if ( theVehicle ) then cancelEvent() outputChatBox ("You can't use animations in vehicles ",source) end end addCommandHandler("anim", restricAnimation) Link to comment
SycroX Posted July 28, 2018 Share Posted July 28, 2018 (edited) there's no event to cancel it so simply use return instead off cancelEvent addCommandHandler("anim", function(player) if isPlayerInVehicle(player) then outputChatBox("u can't use any animation while in vehicle", player, 255, 0, 0) return end --#your code end ) or try this way addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "anim" then if isPedInVehicle(source) then outputChatBox("u can't use animations while in vehicle", source, 255, 0, 0) cancelEvent() end end end ) Edited July 28, 2018 by #َxLysandeR 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