Snakegold Posted July 30, 2018 Posted July 30, 2018 Hello community i wan't to disable using animations while driving how ?? i tried this code function restricanim (thePlayer) if ( isPedInVehicle (thePlayer) ) then cancelEvent() outputChatBox ("You can't use animations while driving", 255,0,0) end end addCommandHandler ( "animation", restricanim ) addEventHandler( "OnPlayerVehicleEnter", root, restricanim ) i changed alot but nothing happened
SycroX Posted July 30, 2018 Posted July 30, 2018 function onPreFunction(sourceResource, functionName, isAllowedByACL, luaFilename, luaLineNumber, ...) local args = {...} if functionName == "setPedAnimation" and isElement(args[1]) then if isPedInVehicle(args[1]) then return 'skip' end end end addDebugHook("preFunction", onPreFunction, {"setPedAnimation"}) 1
SycroX Posted July 31, 2018 Posted July 31, 2018 if you speak arabic so you have to go to arabic section https://forum.multitheftauto.com/forum/96-arabic-العربية/
MTA Team Dutchman101 Posted July 31, 2018 MTA Team Posted July 31, 2018 You could also check if the 23 hours ago, Snakegold said: function restricanim (thePlayer) if ( isPedInVehicle (thePlayer) ) then cancelEvent() outputChatBox ("You can't use animations while driving", 255,0,0) end end addCommandHandler ( "animation", restricanim ) addEventHandler( "OnPlayerVehicleEnter", root, restricanim ) This code doesn't make sense at all.. please post the part of your gamemode's code that allows players to play animations, rather than writing something that tries to intercept it externally. You should simply add some checks to the code that allows setting animations.
SycroX Posted July 31, 2018 Posted July 31, 2018 5 minutes ago, Dutchman101 said: You could also check if the This code doesn't make sense at all.. please post the part of your gamemode's code that allows players to play animations, rather than writing something that tries to intercept it externally. You should simply add some checks to the code that allows setting animations. well we can simply use addDebugHook
Addlibs Posted July 31, 2018 Posted July 31, 2018 (edited) Well, yes you can use addDebugHook, but “it should only be used when debugging scripts as it may degrade script performance.” (wiki) Edited July 31, 2018 by MrTasty
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