Jump to content

Bug


Guest

Recommended Posts

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
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

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 by #َxLysandeR
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...