Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-08-26, 22:02


kajetan254







Wiek: 29
Na forum: 3325 dni
Posty: 42
Nick w MP: Kajetan

Piwa: 5

Respekt: 60

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 :piwo: :D
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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-26, 22:06


NyAngel







Wiek: 23
Na forum: 4091 dni
Posty: 128
Nick w MP: NyAngel

Piwa: 556

Respekt: 86,8


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)


Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: end
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » end Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku