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

Wysłany: 2020-05-04, 19:30


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

Kod:

'addEventHandler' ['onClientPreRender' with this function is already handled]

taki blad wyskakuje w debugu zaznaczylem w kodzie w ktorych linijkach wyskakuje

leci = false
leci2 = false 
leci3 = false 
 
 
function interpolateCam()
    local now = getTickCount()
    local endTime = start + 2000
    local elapsedTime = now - start
    local duration = endTime - start
    local progress = elapsedTime / duration
    local px, py, pz = getElementPosition(localPlayer)
    local x, y, z = interpolateBetween ( dx, dy, dz, -1524.50, 890.68, 28.31, progress, "OutQuad")
    setCameraMatrix(x, y, z, -1502.29, 919.74, 7.19+0.6, 0, 0)
end

function interpolateCam2()
    local now = getTickCount()
    local endTime = start2 + 2000
    local elapsedTime = now - start2
    local duration = endTime - start2
    local progress = elapsedTime / duration
    local px, py, pz = getElementPosition(localPlayer)
    local x, y, z = interpolateBetween ( dx, dy, dz, -1704.22, 917.29, 58.05, progress, "OutQuad")
    setCameraMatrix(x, y, z, -1748.76, 949.68, 24.74+0.6, 0, 0)
end

function interpolateCam3()
    local now = getTickCount()
    local endTime = start3 + 2000
    local elapsedTime = now - start3
    local duration = endTime - start3
    local progress = elapsedTime / duration
    local px, py, pz = getElementPosition(localPlayer)
    local x, y, z = interpolateBetween ( dx, dy, dz, -2011.35, 1103.20, 95.72, progress, "OutQuad")
    setCameraMatrix(x, y, z, -1995.07, 1045.37, 55.72+0.6, 0, 0)
end

function renderZoneBox()
    if data.info then dxDrawText(data.info, sx*252/1024, sy*232/768, sx*800/1024, sy*255/768, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false) end
        f1 = f12

        local x,y=getPointFromDistanceRotation(-2021.68, 175.80, dist, angler)
        angler=(angler+0.1)

    if leci == true then
        addEventHandler("onClientPreRender", root, interpolateCam) ---- tutaj warning
    else
        leci = false
        removeEventHandler("onClientPreRender", root, interpolateCam)
        start = nil
    end

    
    if leci2 == true then
        addEventHandler("onClientPreRender", root, interpolateCam2) ---- tutaj warning
    else
        removeEventHandler("onClientPreRender", root, interpolateCam2)
        leci2 = false
        start2 = nil
    end

    
    if leci3 == true then
        addEventHandler("onClientPreRender", root, interpolateCam3) ---- tutaj warning
    else
        removeEventHandler("onClientPreRender", root, interpolateCam3)
        leci3 = false
        start3 = nil
    end

    if isMouseIn(screenW * -0.0016, screenH * 0.0600, screenW * 0.2573, screenH * 0.1083) then
        start = getTickCount()
        dx, dy, dz, lx, ly, lz = getCameraMatrix()
        leci = true
        leci2 = false 
        leci3 = false
        dxDrawImage(wysun, screenH * 0.0600, screenW * 0.2573, screenH * 0.1083, "xxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawImage(wysun, screenH * 0.0600, screenW * 0.2573, screenH * 0.1083, "xxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    if isMouseIn(screenW * -0.0016, screenH * 0.2000, screenW * 0.2573, screenH * 0.1083) then
        start2 = getTickCount()
        dx, dy, dz, lx, ly, lz = getCameraMatrix()
        leci = false
        leci3 = false 
        leci2 = true
        dxDrawImage(wysun2, screenH * 0.2000, screenW * 0.2573, screenH * 0.1083, "xxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawImage(wysun2, screenH * 0.2000, screenW * 0.2573, screenH * 0.1083, "xxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    if isMouseIn(screenW * -0.0016, screenH * 0.3400, screenW * 0.2573, screenH * 0.1083) then
        start3 = getTickCount()
        dx, dy, dz, lx, ly, lz = getCameraMatrix()
        leci = false
        leci3 = true 
        leci2 = false
        dxDrawImage(wysun3, screenH * 0.3400, screenW * 0.2573, screenH * 0.1083, "xxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawImage(wysun3, screenH * 0.3400, screenW * 0.2573, screenH * 0.1083, "xxxxxxx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end


bardzo mozliwe ze ten kod jest koszmarnie napisany, ucze sie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-04, 19:34


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pr?bujesz podpi?? event do funkcji ju? wcze?niej podpi?tej funkcji, 2 razy wykonuje Ci si? warunek sprawdzaj?cy - jest on po prostu ?le zrobiony.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-04, 19:35


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

no z angielskiego rozumiem ze tak sie dzieje ale nie wiem wlasnie jak to naprawic

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-04, 21:31


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3443 dni
Posty: 391
Nick w MP: kamison

Piwa: 599

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Dodaj jak?? zmienn? na zasadzie

handler = false

I jak handler si? nadaje to zmie? na true i przy sprawdzaniu


if handler == false then
addEventHandler()
end

Mo?esz spr?bowa? z usuwaniem hanldera jak jest z???czony(o ilenie b?dzie to przeszkadza? w dzia?aniu skryptu)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-04, 23:34


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

ale przeciez tak mam

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-05, 08:03


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to musisz poprawi? najwyra?niej ten warunek skoro kiedy chcesz w??czy? lub wy??czy? nagle u?ywasz z?ej zmiennej.

Postaw piwo autorowi tego posta
 

 
Tagi: [with :: this :: function :: already :: handled] :: warning
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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