Wysłany: 2018-08-26, 22:02
kajetan254
Wiek: 28 Na forum: 3184 dni Posty: 42
Nick w MP: Kajetan
Piwa : 93
Witam, czy m?g?by mi kto? pom?c wstawi? 'end' aby kod dzia?a?, error z db3: https://imgur.com/Lz046fc
Za pomoc stawiam
local sound = {}
function updateEngineSound ()
local allVehicles = getElementsByType ( "vehicle" )
for index , veh in ipairs ( allVehicles ) do
for _ , v in pairs ( getElementsByType ( "vehicle" )) do
local model = getElementModel ( veh )
if model == 494 then
if getElementData ( v , "vehicle:id" ) == 678 then
if getVehicleEngineState ( veh ) then
if isElement ( sound [ veh ]) then
local gear = getVehicleCurrentGear ( veh ) or 1
local velocityX , velocityY , velocityZ = getElementVelocity ( veh )
local actualspeed = (( velocityX ^ 2 + velocityY ^ 2 + velocityZ ^ 2 )^( 0.5 )) * (( 11 - gear ) / 10 )
local mph = actualspeed * 70 * 111.847
local minSoundSpeed = 0.20
local soundSpeed = mph /( 1000 + 1000 / minSoundSpeed ) + minSoundSpeed
setSoundSpeed ( sound [ veh ], soundSpeed )
else
local x , y , z = getElementPosition ( veh )
sound [ veh ] = playSound3D ( "sounds/engine.wav" , x , y , z , true )
attachElements ( sound [ veh ], veh )
end
else
if isElement ( sound [ veh ]) then
destroyElement ( sound [ veh ])
end
end
end
end
end
addEventHandler ( "onClientPreRender" , root , updateEngineSound )
local sound = {}
function updateEngineSound ()
local allVehicles = getElementsByType ( "vehicle" )
for index , veh in ipairs ( allVehicles ) do
local model = getElementModel ( veh )
if model == 502 then
if getVehicleEngineState ( veh ) then
if isElement ( sound [ veh ]) then
local gear = getVehicleCurrentGear ( veh ) or 1
local velocityX , velocityY , velocityZ = getElementVelocity ( veh )
local actualspeed = (( velocityX ^ 2 + velocityY ^ 2 + velocityZ ^ 2 )^( 0.5 )) * (( 11 - gear ) / 10 )
local mph = actualspeed * 70 * 111.847
local minSoundSpeed = 0.20
local soundSpeed = mph /( 1000 + 1000 / minSoundSpeed ) + minSoundSpeed
setSoundSpeed ( sound [ veh ], soundSpeed )
else
local x , y , z = getElementPosition ( veh )
sound [ veh ] = playSound3D ( "sounds/engine2.wav" , x , y , z , true )
attachElements ( sound [ veh ], veh )
end
else
if isElement ( sound [ veh ]) then
destroyElement ( sound [ veh ])
end
end
end
end
end
addEventHandler ( "onClientPreRender" , root , updateEngineSound )
Wysłany: 2018-08-26, 22:06
NyAngel
Wiek: 22 Na forum: 3950 dni Posty: 128
Nick w MP: NyAngel
Piwa : 556
local sound = {}
function updateEngineSound ()
local allVehicles = getElementsByType ( "vehicle" )
for index , veh in ipairs ( allVehicles ) do
for _ , v in pairs ( getElementsByType ( "vehicle" )) do
local model = getElementModel ( veh )
if model == 494 then
if getElementData ( v , "vehicle:id" ) == 678 then
if getVehicleEngineState ( veh ) then
if isElement ( sound [ veh ]) then
local gear = getVehicleCurrentGear ( veh ) or 1
local velocityX , velocityY , velocityZ = getElementVelocity ( veh )
local actualspeed = (( velocityX ^ 2 + velocityY ^ 2 + velocityZ ^ 2 )^( 0.5 )) * (( 11 - gear ) / 10 )
local mph = actualspeed * 70 * 111.847
local minSoundSpeed = 0.20
local soundSpeed = mph /( 1000 + 1000 / minSoundSpeed ) + minSoundSpeed
setSoundSpeed ( sound [ veh ], soundSpeed )
else
local x , y , z = getElementPosition ( veh )
sound [ veh ] = playSound3D ( "sounds/engine.wav" , x , y , z , true )
attachElements ( sound [ veh ], veh )
end
else
if isElement ( sound [ veh ]) then
destroyElement ( sound [ veh ])
end
end
end
end
end
end
addEventHandler ( "onClientPreRender" , root , updateEngineSound )
Tagi: end
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: