Jump to content

[Question] aiming


Stranger

Recommended Posts

Posted

i did it like that:

setTimer (function (player) 
target = getPedTarget (player) 
if getElementType (target) == "vehicle" then 
destroyElement (target) 
end 
end, 500,0) 

but not working !

  • Moderators
Posted

of course it isn't working.

The variable player is nil is nothing and useless, when you don't define it.

setTimer (function () 
    local players = getElementsByType("player") 
    for i=1,#players do 
        local player = players[i] 
        local target = getPedTarget (player) 
        if target and getElementType (target) == "vehicle" then 
            destroyElement (target) 
        end 
    end 
end, 500,0) 

  • Moderators
Posted
onPlayerTarget event is way better.

Not really since that only get triggered when a player change from target and not when he starts aiming.

The best result would be using bindkey, but will require more bandwidth.

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