LuanSantos_ Posted June 17, 2021 Share Posted June 17, 2021 (edited) Queria saber como eu faço para um veiculo andar sozinho eu estou tentando usar o setElementSpeed mas diz que é invalido e não funciona de forma alguma não sei se a função não esta funcionando ou estou fazendo algo errado o codigo é esse function fcriar(player) if isElementWithinMarker(player, mcriar) then barco = createVehicle(452, 378.264, -2098.727, 5.192, -0, 0, 85.148) ancora = createMarker(373.217, -2098.592, 3.564, "cylinder", 1,5, 432,543,654) attachElements(ancora, barco, 0,6,2) setElementSpeed(barco, "mph", 10) end end addCommandHandler("criar", fcriar) Edited June 17, 2021 by LuanSantos_ Link to comment
Other Languages Moderators Lord Henry Posted June 21, 2021 Other Languages Moderators Share Posted June 21, 2021 (edited) A função setElementSpeed é do tipo útil. Portanto vc precisa adicionar o código-fonte dela no seu script antes de usar. function setElementSpeed(element, unit, speed) local unit = unit or 0 local speed = tonumber(speed) or 0 local acSpeed = getElementSpeed (element, unit) if acSpeed and acSpeed ~= 0 then -- if true - element is valid, no need to check again local diff = speed / acSpeed if diff ~= diff then return false end -- if the number is a 'NaN' return false. local x, y, z = getElementVelocity (element) return setElementVelocity (element, x*diff, y*diff, z*diff) end return false end Edited June 21, 2021 by Lord Henry Link to comment
LuanSantos_ Posted June 21, 2021 Author Share Posted June 21, 2021 (edited) 3 hours ago, Lord Henry said: A função setElementSpeed é do tipo útil. Portanto vc precisa adicionar o código-fonte dela no seu script antes de usar. function setElementSpeed(element, unit, speed) local unit = unit or 0 local speed = tonumber(speed) or 0 local acSpeed = getElementSpeed (element, unit) if acSpeed and acSpeed ~= 0 then -- if true - element is valid, no need to check again local diff = speed / acSpeed if diff ~= diff then return false end -- if the number is a 'NaN' return false. local x, y, z = getElementVelocity (element) return setElementVelocity (element, x*diff, y*diff, z*diff) end return false end nossa eu não tinha prestado atenção nisso desculpa pelo incomodo Edited June 21, 2021 by LuanSantos_ Link to comment
Other Languages Moderators Lord Henry Posted June 22, 2021 Other Languages Moderators Share Posted June 22, 2021 Sem problemas. Estamos aqui pra ajudar. 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