Jump to content

Need help with onCameraTarget


adamb

Recommended Posts

So, i wrote this, it is basically supposed to stop the NPCHLC traffic vehicle's engines off.

for k,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "n", "down", "ts") 
end 
  
function onPlayerTarget( thePlayer ) 
    local target = getCameraTarget ( thePlayer ) 
    if ( getElementType ( target ) == "vehicle" ) then 
        setVehicleEngineState ( target, false ) 
        outputChatBox ( "Walk up to the driver side window", source ) 
    end 
end 
  
addCommandHandler("ts", onPlayerTarget)    
      

Tho It doesn't work, no errors tho.

Any ideas?

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