ODutii Posted August 4, 2019 Share Posted August 4, 2019 Qual a function, a distance e o Command Handler para localizar o veículo mais proximo do jogador, e quando der o comando o veículo ser reparado? Link to comment
ODutii Posted August 4, 2019 Author Share Posted August 4, 2019 function getNearestVeicle(player) local x, y, z = getElementPosition(player) local prevDistance local nearestVehicle for i, v in ipairs( getElementsByType( "vehicle" ) ) do local dist = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if dist <= ( prevDistance or dist + 1 ) then prevDistance = dist nearestVehicle = v setElementHealth ( v, 800 ) end end return nearestVehicle or false end addCommandHandler("repaircar", getNearestVeicle) Esse é o script e não está funcionando, peguei na internet e tentei editar algumas coisas más mesmo assim não funciona Link to comment
Eficiencia Posted August 4, 2019 Share Posted August 4, 2019 Use: FixVehicle, GetElementPosition e o comando pode ser o que você quiser. 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