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

Wysłany: 2018-08-22, 16:52


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

Witam. Mam problem taki jak w tytule czyli gdy chce ulepszy? silnik lub cokolwiek w db3 wyskakuje ?e event nie jest dodany do serverside a jest dodany
wszystkie kody:
function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

tuningmechaniczny = false
tuningmechaniczny_marker = exports.custom_markers:createCustomMarker(-2328.54663, -166.21710, 34.3, "cylinder", 4.0, 255, 255, 0)

    function tuningmechaniczny_gui()
        dxDrawImage(286, 100, 694, 506, ":K-UlepszSilnik/files/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 105, 175, 179, ":K-UlepszSilnik/files/button1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 284, 175, 179, ":K-UlepszSilnik/files/button2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 463, 175, 179, ":K-UlepszSilnik/files/button3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Witaj w panelu ulepszania silnika pojazd?w. Mi?ego tuningowania :)", 509 - 1, 337 - 1, 915 - 1, 405 - 1, tocolor(143, 1, 253, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu ulepszania silnika pojazd?w. Mi?ego tuningowania :)", 509 + 1, 337 - 1, 915 + 1, 405 - 1, tocolor(143, 1, 253, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu ulepszania silnika pojazd?w. Mi?ego tuningowania :)", 509 - 1, 337 + 1, 915 - 1, 405 + 1, tocolor(143, 1, 253, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu ulepszania silnika pojazd?w. Mi?ego tuningowania :)", 509 + 1, 337 + 1, 915 + 1, 405 + 1, tocolor(143, 1, 253, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu ulepszania silnika pojazd?w. Mi?ego tuningowania :)", 509, 337, 915, 405, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawImage(946, 110, 24, 24, ":K-UlepszSilnik/files/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end

addEventHandler("onClientMarkerHit", tuningmechaniczny_marker, function()
if tuningmechaniczny == false then
    addEventHandler("onClientRender", root, tuningmechaniczny_gui)
    showCursor(true)
    tuningmechaniczny = true
end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuningmechaniczny == true then
            if isMouseInPosition(946, 110, 24, 24) then
                removeEventHandler("onClientRender", root, tuningmechaniczny_gui)
                showCursor(false)
                tuningmechaniczny = false
            end
            if tuningmechaniczny == true then
                if isMouseInPosition(264, 105, 175, 179) then
                    removeEventHandler("onClientRender", root, tuningmechaniczny_gui)
                    addEventHandler("onClientRender", root, tunesilnika_gui)
                    tuningmechaniczny = false
                    tunesilnika = true
                end
                if tuningmechaniczny == true then
                    if isMouseInPosition(264, 284, 175, 179) then
                        removeEventHandler("onClientRender", root, tuningmechaniczny_gui)
                        addEventHandler("onClientRender", root, tunenapedu_gui)
                        tuningmechaniczny = false
                        tunenapedu = true
                    end
                    if tuningmechaniczny == true then
                        if isMouseInPosition(264, 463, 175, 179) then
                            removeEventHandler("onClientRender", root, tuningmechaniczny_gui)
                            addEventHandler("onClientRender", root, tuneskretu_gui)
                            tuningmechaniczny = false
                            tuneskretu = true
                        end
                    end
                end
            end
        end
    end
end
)
end
)

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

tunenapedu = false

    function tunenapedu_gui()
        dxDrawImage(286, 100, 694, 506, ":K-UlepszSilnik/files/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 105, 175, 179, ":K-UlepszSilnik/files/button1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 284, 175, 179, ":K-UlepszSilnik/files/button2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 463, 175, 179, ":K-UlepszSilnik/files/button3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(946, 110, 24, 24, ":K-UlepszSilnik/files/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(461, 171, 194, 184, ":K-UlepszSilnik/files/button6.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(753, 171, 183, 184, ":K-UlepszSilnik/files/button8.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(606, 387, 194, 184, ":K-UlepszSilnik/files/button7.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end

addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tunenapedu == true then
            if isMouseInPosition(946, 110, 24, 24) then
                removeEventHandler("onClientRender", root, tunenapedu_gui)
                showCursor(false)
                tunenapedu = false
            end
            if tunenapedu == true then
                if isMouseInPosition(461, 171, 194, 184) then
                    triggerServerEvent("ustawawd", localPlayer)
                    removeEventHandler("onClientRender", root, tunenapedu_gui)
                    showCursor(false)
                    tunenapedu = false
                end
                if tunenapedu == true then
                    if isMouseInPosition(606, 387, 194, 184) then
                        triggerServerEvent("ustawfwd", localPlayer)
                        removeEventHandler("onClientRender", root, tunenapedu_gui)
                        showCursor(false)
                        tunenapedu = false
                    end
                    if tunenapedu == true then
                        if isMouseInPosition(753, 171, 183, 184) then
                            triggerServerEvent("ustawrwd", localPlayer)
                            removeEventHandler("onClientRender", root ,tunenapedu_gui)
                            showCursor(false)
                            tunenapedu = false
                        end
                    end
                end
            end
        end
    end
end
)

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

tunesilnika = false

    function tunesilnika_gui()
        dxDrawImage(286, 100, 694, 506, ":K-UlepszSilnik/files/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 105, 175, 179, ":K-UlepszSilnik/files/button1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 284, 175, 179, ":K-UlepszSilnik/files/button2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 463, 175, 179, ":K-UlepszSilnik/files/button3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(946, 110, 24, 24, ":K-UlepszSilnik/files/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(602, 273, 193, 200, ":K-UlepszSilnik/files/button4.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end

addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tunesilnika == true then
            if isMouseInPosition(946, 110, 24, 24) then
                removeEventHandler("onClientRender", root, tunesilnika_gui)
                showCursor(false)
                tunesilnika = false
            end
            if tunesilnika == true then
                if isMouseInPosition(602, 273, 193, 200) then
                    triggerServerEvent("ulepszsilnik", localPlayer)
                    removeEventHandler("onClientRender", root, tunesilnika_gui)
                    showCursor(false)
                    tunesilnika = false
                end
            end
        end
    end
end
)

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

tuneskretu = false

    function tuneskretu_gui()
        dxDrawImage(286, 100, 694, 506, ":K-UlepszSilnik/files/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 105, 175, 179, ":K-UlepszSilnik/files/button1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 284, 175, 179, ":K-UlepszSilnik/files/button2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(264, 463, 175, 179, ":K-UlepszSilnik/files/button3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(946, 110, 24, 24, ":K-UlepszSilnik/files/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(591, 273, 213, 200, ":K-UlepszSilnik/files/button5.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end

addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuneskretu == true then
            if isMouseInPosition(946, 110, 24, 24) then
                removeEventHandler("onClientRender", root, tuneskretu_gui)
                showCursor(false)
                tuneskretu = false
            end
            if tuneskretu == true then
                if isMouseInPosition(591, 273, 213, 200) then
                    triggerServerEvent("skret", localPlayer)
                    removeEventHandler("onClientRender", root, tuneskretu_gui)
                    showCursor(false)                    
                    tuneskretu = false
                end
            end
        end
    end
end
)

ulepszaniesilnika = 65000
naped_awd = 35000
naped_rwd = 25000
naped_fwd = 15000
zmianaskretu = 30000

addEvent("ulepszsilnik", true)
addEventHandler("ulepszsilnik", root, function()
if (getPlayerMoney(source) > tonumber(ulepszaniesilnika)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, ulepszeniesilnika)
        outputChatBox( "Ulepszy?e? silnik w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "maxVelocity", 270.0 )
setVehicleHandling(pojazd, "engineAcceleration", 14.0 )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ulepszenie silnika w poje?dzie!", getRootElement(), 255, 255, 255, true)

addEvent("skret", true)
addEventHandler("skret", root, function()
if (getPlayerMoney(source) > tonumber(zmianaskretu)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_awd)
        outputChatBox( "Powi?kszy?e? stopni skr?tu w twoim poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "steeringLock", 45.5 )
else
    outputChatBox ("#ff0000Nie sta? Ci? na powi?kszenie stopni skr?tu w poje?dzie", getRootElement(), 255, 255, 255, true)

addEvent("ustawawd", true)
addEventHandler("ustawawd", root, function()
if (getPlayerMoney(source) > tonumber(naped_awd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_awd)
        outputChatBox( "Ustawi?e? nap?d AWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "awd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du AWD w poje?dzie", getRootElement(), 255, 255, 255, true)

addEvent("ustawfwd", true)
addEventHandler("ustawfwd", root, function()
if (getPlayerMoney(source) > tonumber(naped_fwd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_fwd)
        outputChatBox( "Ustawi?e? nap?d FWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "fwd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du FWD w poje?dzie", getRootElement(), 255, 255, 255, true)

addEvent("ustawrwd", true)
addEventHandler("ustawrwd", root, function()
if (getPlayerMoney(source) > tonumber(naped_rwd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_rwd)
        outputChatBox( "Ustawi?e? nap?d RWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "rwd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du RWD w poje?dzie", getRootElement(), 255, 255, 255, true)
end
end
)
end
end
)
end
end
)
end
end
)
end
end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 17:15


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

podaj ten b??d

[ Dodano: 2018-08-22, 17:17 ]
doko?cz te wszystkie eventy, a nie na samym ko?cu ko?czysz wszystkie eventHandlery, co? takiego robisz:
addEvent("ulepszsilnik", true)
addEventHandler("ulepszsilnik", root, function()
if (getPlayerMoney(source) > tonumber(ulepszaniesilnika)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, ulepszeniesilnika)
        outputChatBox( "Ulepszy?e? silnik w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "maxVelocity", 270.0 )
setVehicleHandling(pojazd, "engineAcceleration", 14.0 )
else
 outputChatBox ("#ff0000Nie sta? Ci? na ulepszenie silnika w poje?dzie!", getRootElement(), 255, 255, 255, true)
-- gdzie tu jest KONIEC eventu? na samym ko?cu kodu...

addEvent("skret", true)
addEventHandler("skret", root, function()

popraw to

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 18:08


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

i nadal wyskakuje ERROR: Client (czlowiekjaja) triggered serverside event ulepszsilnik, but event is not added serverside

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 20:30


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

poka? teraz ten "zmodyfikowany przez Ciebie kod"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 20:49


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

ulepszaniesilnika = 65000
naped_awd = 35000
naped_rwd = 25000
naped_fwd = 15000
zmianaskretu = 30000

addEvent("ulepszsilnik", true)
addEventHandler("ulepszsilnik", root, function()
if (getPlayerMoney(source) > tonumber(ulepszaniesilnika)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, ulepszeniesilnika)
        outputChatBox( "Ulepszy?e? silnik w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "maxVelocity", 270.0 )
setVehicleHandling(pojazd, "engineAcceleration", 14.0 )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ulepszenie silnika w poje?dzie!", getRootElement(), 255, 255, 255, true)
end

addEvent("skret", true)
addEventHandler("skret", root, function()
if (getPlayerMoney(source) > tonumber(zmianaskretu)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_awd)
        outputChatBox( "Powi?kszy?e? stopni skr?tu w twoim poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "steeringLock", 45.5 )
else
    outputChatBox ("#ff0000Nie sta? Ci? na powi?kszenie stopni skr?tu w poje?dzie", getRootElement(), 255, 255, 255, true)
end

addEvent("ustawawd", true)
addEventHandler("ustawawd", root, function()
if (getPlayerMoney(source) > tonumber(naped_awd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_awd)
        outputChatBox( "Ustawi?e? nap?d AWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "awd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du AWD w poje?dzie", getRootElement(), 255, 255, 255, true)
end

addEvent("ustawfwd", true)
addEventHandler("ustawfwd", root, function()
if (getPlayerMoney(source) > tonumber(naped_fwd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_fwd)
        outputChatBox( "Ustawi?e? nap?d FWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "fwd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du FWD w poje?dzie", getRootElement(), 255, 255, 255, true)
end

addEvent("ustawrwd", true)
addEventHandler("ustawrwd", root, function()
if (getPlayerMoney(source) > tonumber(naped_rwd)) then 
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
        takePlayerMoney(source, naped_rwd)
        outputChatBox( "Ustawi?e? nap?d RWD w poje?dzie", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "rwd" )
else
    outputChatBox ("#ff0000Nie sta? Ci? na ustawienie nap?du RWD w poje?dzie", getRootElement(), 255, 255, 255, true)
end
end
)
end
end
)
end
end
)
end
end
)
end
end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 20:58


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

nie dzia?a bo nadal jakie? dodatkowe endy na ko?cu kodu.
porada: naucz si? lua i wtedy skryptuj, robisz co? na "hama" w tej dziedzinie, o kt?rej nie masz zielonego poj?cia...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 21:08


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

Tylko ?e jak tych end?w na ko?cu nie ma to wtedy wyskakuje end expected

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 21:13


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

W czym skryptujesz? W notatniku? No sorry, prostej rzeczy nie ma ni? poprawi?. Piszesz, ?e end?w nie ma na ko?cu? Mo?e zjed? na sam koniec kodu to je zauwa?ysz...

Tw?j kod: http://prntscr.com/klr5wg
Po dopisaniu nawiasu kt?ry odpowiada za zamkni?cie addEventHandler: http://prntscr.com/klr6hg

PS. O ile end?w si? znalaz?o :x http://prntscr.com/klr6sp I od czego te endy? Od pustych linijek? Nie s?dze... :-?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-22, 21:36


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

No to teraz mam unexpected symbol near ')'

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: czyta :: eventów :: serverside
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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