Machine Posted November 18, 2012 Share Posted November 18, 2012 this work doesn't work why? function enterPlane(theVehicle, seat, jacked) if (getVehicleType(theVehicle) == "Plane" or "Helicopter") then outputChatBox("Welcome onboard!", source) end end addCommandHandler("test", enterPlane) i wanna when someone enter Plane or Helicopter and make command test a message appear for him! Link to comment
Machine Posted November 18, 2012 Author Share Posted November 18, 2012 so all any help? Link to comment
Kenix Posted November 18, 2012 Share Posted November 18, 2012 First argument in function-handler is player not vehicle. ( and this arguments: seat, jacked incorrect because seat is not seat it's commandName, jacked is argument when you type in command /test [argument] ). Forgot say, /test command is MTA command, so you need rename it. Also if you want get player's vehicle you need use getPedOccupiedVehicle Also outputChatBox("Welcome onboard!", source) source is not defined and if (getVehicleType(theVehicle) == "Plane" or "Helicopter") then Condition is wrong. Because condition will work with any vehicle type. For example function show( s ) if s == '1' or '2' then print 'y' else print 'n' end end show '1' --> y show '5' --> y So it's correct: local sVehicleType = getVehicleType( theVehicle ) if sVehicleType == "Plane" or sVehicleType == "Helicopter" then 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