Jump to content

Darle Velocidad a un auto


Brad96

Recommended Posts

Posted
bool setElementVelocity ( element theElement, float speedX, float speedY, float speedZ ) 

esta es la sintaxis ,el elemento es Id o solo Vehicle ?

Posted
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

Posted
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 

Posted

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

Posted

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

Posted

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 

Posted

Bueno gracias por ala ayuda .. :D pero que hace la ultima funcion de abajo ..esque queria probar esta funcion para practicar , es script simple

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...