hi guys i want when vehicle dont have driver player's Cant push it
function carfreez()
setTimer ( function()
for _,veh in ipairs (getElementsByType("vehicle")) do
if veh then
if isVehicleEmpty(veh) then
local speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( veh ) )
if speed and speed < 2 then
setElementFrozen(veh,true)
end
end
end
end
end, 1000, 0 )
end
carfreez()
function addHelmetOnEnter ( theVehicle, seat, jacked )
setElementFrozen(theVehicle,false)
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), addHelmetOnEnter )
it worked but i want when any car want push another car and car dont have driver , car move. any idea ?