Jump to content

Need help with onCameraTarget


adamb

Recommended Posts

Posted

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?

Posted

That code is so wrong, I just gave you the functions...

See, if you want to turn off the vehicle engine while having your ped looking at one of them, use these two functions above.

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