Brad96 Posted September 6, 2013 Share Posted September 6, 2013 con que funcion le doy velocidad a un auto ej :300km/h o velocidades exageradas ? gracias Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 bool setElementVelocity ( element theElement, float speedX, float speedY, float speedZ ) esta es la sintaxis ,el elemento es Id o solo Vehicle ? Link to comment
NodZen Posted September 6, 2013 Share Posted September 6, 2013 Es el elemento a que queres darle velocidad Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 function sp(vehicle) setElementVelocity ( vehicle , 0 , 50 , 0) end function bind() bindKey (vehicle , "mouse1" , "down" , sp) end addEventHandler ("onPlayerVehicleEnter",getRootElement(),bind que pasa ahi ? no funciona Link to comment
Arsilex Posted September 6, 2013 Share Posted September 6, 2013 function sp(vehicle) setElementVelocity ( vehicle , 0 , 50 , 0) end function bind() bindKey (vehicle , "mouse1" , "down" , sp) end addEventHandler ("onPlayerVehicleEnter",getRootElement(),bind que pasa ahi ? no funciona function sp(player) local vehicle = getPedOccupiedVehicle ( player) setElementVelocity ( vehicle , 0 , 50 , 0) end function bind() bindKey (source, "mouse1" , "down" , sp) end addEventHandler ("onPlayerVehicleEnter",getRootElement(),bind Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 pero le da una velocidad al auto no realista ..hay una funcion que solo lo empuje parecida a esta ? Link to comment
NodZen Posted September 6, 2013 Share Posted September 6, 2013 pero le da una velocidad al auto no realista ..hay una funcion que solo lo empuje parecida a esta ? Sacá el 50 y probale 10 o menos. Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 si lo empuja , pero solo lo empuja para x ,y z , yo quisiera que lo empujara para donde vaya el auto , y no puedo usar getElementRotation Link to comment
NodZen Posted September 6, 2013 Share Posted September 6, 2013 Algun ejemplo de lo que quieres puede ser? Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 eeh , quiero hacer que al presionar por ej : la tecla 0 el auto empieze a cojer mucha velocidad hasta que yo suelte el bind .. pero como dije con esta funcion se ve poco realista .. o de lo que quiero Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 Tambien podes cambiar el handling del vehiculo con setVehicleHandling. Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 como siempre aprecio tu ayuda solid , pero por ahora no es lo que busco , todavia Link to comment
Sensacion Posted September 6, 2013 Share Posted September 6, 2013 Con setVehicleHandling puedes aumentar a la velocidad, aceleración, motor, etc a la que quieras mientras presionas un tecla usando un bind. Link to comment
Brad96 Posted September 6, 2013 Author Share Posted September 6, 2013 pero necesito hadling o son strings pequeños ? Link to comment
Sasu Posted September 7, 2013 Share Posted September 7, 2013 Usa la funcion useful setElementSpeed Link to comment
GamerDeMTA Posted September 7, 2013 Share Posted September 7, 2013 Usa la funcion useful setElementSpeed es una useful function... Link to comment
manawydan Posted September 7, 2013 Share Posted September 7, 2013 try function sp(player) local vehicle = getPedOccupiedVehicle ( player) setElementSpeed(vehicle, "kph", 50) end function bind() bindKey (source, "mouse1" , "down" , sp) end addEventHandler ("onPlayerVehicleEnter",getRootElement(),bind) function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.8 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end Link to comment
Brad96 Posted September 7, 2013 Author Share Posted September 7, 2013 Bueno gracias por ala ayuda .. pero que hace la ultima funcion de abajo ..esque queria probar esta funcion para practicar , es script simple Link to comment
Sasu Posted September 7, 2013 Share Posted September 7, 2013 Usa la funcion useful setElementSpeed es una useful function... Y yo que dije? Link to comment
GamerDeMTA Posted September 8, 2013 Share Posted September 8, 2013 Usa la funcion useful setElementSpeed es una useful function... Y yo que dije? pero con esa funcion tambien necesitaria la useful function getElementSpeed . Link to comment
Recommended Posts