PyArroz Posted October 27, 2016 Posted October 27, 2016 some resources to get on the nearest vehicle? , Sorry , My English is bad.
Walid Posted November 1, 2016 Posted November 1, 2016 On 27/10/2016 at 4:04 AM, Andres99907 said: some resources to get on the nearest vehicle? , Sorry , My English is bad. Try this local mathFloor = math.floor function getNearestVehicle( player ) if player and isElement(player) then local x, y, z = getElementPosition( player ) local vehicles = getElementsByType( "vehicle" ) local prevDistance local nearestVehicle for i=1, #vehicles do local distance = mathFloor(getDistanceBetweenPoints3D( x, y, z, getElementPosition(vehicles[i]))) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = vehicles[i] end end return nearestVehicle or false end end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
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