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

Wysłany: 2019-07-13, 15:59


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam posiadam prace busy kt?ra dzieli si? na linie miejsk? i pozamiejsk? problem jest z tym ze gdy wybieram linie miejsk? dostaje normalnie pieni?dze a gdy wybieram linie pozamiejska daje bilety i nie dostaje pieni?dzy :/

pystories-bus --> c.lua
sxsy guiGetScreenSize(  )

text createElement"text" )
setElementPositiontext114.341106.6813.71 )
setElementDatatext"name""Kierowca autobusu\nZarobki:\nLinia miejska: 35$\nLinia pozamiejska: 45$\nWynagrodzenie zale?y od\nzadowolenia klient?w" )

praca createMarker114.341106.6813.71-0.9"cylinder")
createBlipAttachedTopraca4622552552552550250 )

addEventHandler"onClientRender"root, function()
    if isElementWithinMarkerlocalPlayerpraca then
        dxDrawImagesx 350 2sy 200 2350200"panel.png" )
        if isMouseInPositionsx 112 60sy 64 211264 then
            dxDrawImagesx 112 60sy 64 211264"miejska.png" )
        end
        if isMouseInPositionsx 112 60sy 64 211264 then
            dxDrawImagesx 112 60sy 64 211264"pozamiejska.png" )
        end
        showCursortruefalse )
    else
        showCursorfalsefalse )
    end
end )

addEventHandler"onClientClick"root, function( buttonstateabsoluteXabsoluteYworldXworldYworldZclickedElement )
    if button == "left" and state == "down" then
        if isElementWithinMarkerlocalPlayerpraca then
            if isMouseInPositionsx 112 60sy 64 211264 then
                if getElementDatalocalPlayer"player:srp" ) < 0 then
                    exports["pystories-notifications"]:createAlert"Nie posiadasz wymaganej reputacji. (0 RP)" )
                else
                    if getElementDatalocalPlayer"player:license:pjC" ) ~= and getElementDatalocalPlayer"player:license:pjC" ) ~= true then
                        exports["pystories-notifications"]:createAlert"Nie posiadasz prawajazdy kategorii C." )
                    else
                        triggerServerEvent "startujPrace"resourceRootlocalPlayer"miejska" )
                    end
                end
            end
            if isMouseInPositionsx 112 60sy 64 211264 then
                if getElementDatalocalPlayer"player:srp" ) < 25 then
                    exports["pystories-notifications"]:createAlert"Nie posiadasz wymaganej reputacji. (25 RP)" )
                else
                    triggerServerEvent "startujPrace"resourceRootlocalPlayer"pozamiejska" )
                end
            end
        end
    end
end )

setTimer( function()
    for k,v in pairsgetElementsByType"vehicle" ) ) do
        if getElementDatav"disabledCols" then
            newalpha 255
            lastAlpha 255
            for _,v2 in pairsgetElementsByType"vehicle" ) ) do
                if ~= v2 then
                    xygetElementPosition)
                    x2y2z2 getElementPositionv2 )
                    dist getDistanceBetweenPoints3Dxyzx2y2z2 )
                    alpha 255
                    if dist 4 then
                        alpha 100
                    elseif dist 3 then
                        alpha 40
                    elseif dist 2 then
                        alpha 10
                    end
                    if lastAlpha alpha then newalpha alpha end
                    setElementCollidableWithv2vfalse )
                    setElementCollidableWithvv2false )
                end
            end
            setElementAlphavnewalpha )
        end
    end
end1000)

addEvent"wylaczKolizje"true )
addEventHandler"wylaczKolizje"localPlayer, function( veh )
    for k,v in pairsgetElementsByType"vehicle" ) ) do
        setElementCollidableWithvehvfalse )
        setElementCollidableWithvvehfalse )
    end
end )

function zakonczPrace()
    destroyElementblip )
    destroyElementmarkerPracy )
    triggerServerEvent"koniecPracusi"resourceRootlocalPlayer )
    pracuje false
    zadowolenie 100
end

addEvent"stopPracy"true )
addEventHandler"stopPracy"localPlayerzakonczPrace )

stacjeMiejskie = {
    {9.201201.2819.20-.9}, -- 431 Bus
    {-206.421201.2919.59}, -- 431 Bus
    {-298.581095.2219.60-.9}, -- 431 Bus
    {-238.031095.5519.59-.9}, -- 431 Bus
    {-162.761095.3819.59-.9}, -- 431 Bus
    {-45.131095.7819.59-.9}, -- 431 Bus
    {-44.391195.4219.21-.9}, -- 431 Bus
    {54.501195.7218.73-.9}, -- 431 Bus
    {89.361063.9713.61-.9}, -- 431 Bus
}

stacjePozaMiejskie = {
    {9.131201.1019.20-.9}, -- 431 Bus
    {-206.631200.9619.59-.9}, -- 431 Bus
    {-298.591095.5919.60-.9}, -- 431 Bus
    {-238.181095.4819.59-.9}, -- 431 Bus
    {-313.99888.5311.24-.9}, -- 431 Bus
    {38.34, -212.121.47-.9}, -- 431 Bus
    {203.28, -214.681.43-.9}, -- 431 Bus
    {305.59, -144.761.43-.9}, -- 431 Bus
    {622.64328.1019.57-.9}, -- 431 Bus
    {-187.571061.0119.59-.9}, -- 431 Bus
    {-163.091095.5119.59-.9}, -- 431 Bus
    {-45.541095.5419.59-.9}, -- 431 Bus
    {-44.031195.4919.21-.9}, -- 431 Bus
    {54.651195.5618.73-.9}, -- 431 Bus
    {89.711065.0713.61-.9}, -- 431 Bus
}

function nastepnyMarkerMiejskaidMarkeru )
    stacjeMiejskie[idMarkeru]
        if p then
        markerPracy createMarkerp[1], p[2], p[3], "cylinder")
        blip createBlipAttachedTomarkerPracy41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerPozamiejskaidMarkeru )
    stacjePozaMiejskie[idMarkeru]
        if p then
        markerPracy createMarkerp[1], p[2], p[3], "cylinder")
        blip createBlipAttachedTomarkerPracy41 )
    else
        zakonczPrace()
    end
end

function sprawdzBiletliczba )
    if bilet == liczba then
        jeszczeJeden math.random1)
        if jeszczeJeden == 1 then
            exports["pystories-notifications"]:createAlert"Podajesz bilet." )
            bxbybx2by2 sx 235sy 85sx 235sy 10
            bilet math.random1)
        else
            exports["pystories-notifications"]:createAlert"Podajesz bilet." )
            removeEventHandler"onClientRender"rootbilety )
        end
        if typPracy == "miejska" then
            zadowoleniee zadowolenie 30
            if zadowoleniee 100 then zadowoleniee 100 end
            triggerServerEvent"givePlayerMoney"localPlayer35 * (zadowoleniee 100) )
        else
            triggerServerEvent"givePlayerMoney"localPlayer45 * (zadowoleniee 100) )
        end
    else
        exports["pystories-notifications"]:createAlert"Podano z?y bilet." )
        zadowolenie zadowolenie 10
        bxbybx2by2 sx 235sy 85sx 235sy 10
    end
end

function bilety(  )
    if pracuje then
        showCursortrue )

        dxDrawRectanglesx 250sy 100500200tocolor000155 ) )
        dxDrawRectanglesx 50sy 100200200tocolor000155 ) )

        dxDrawImagebxby16575"normalny.jpg" )
        dxDrawImagebx2by216575"ulgowy.jpg" )

        if bilet == 1 then
            dxDrawText"Klient prosi o Bilet normalny"0520sxsywhite1.5"default-bold""center" )
        else
            dxDrawText"Klient prosi o Bilet ulgowy"0520sxsywhite1.5"default-bold""center" )
        end

        if isMouseInPositionbxby16575 ) and getKeyState"mouse1" then
            cxcy getCursorPosition(  )
            cxcy cx sxcy sy
            bxby cx 165 2cy 75 2
            if bx sx 50 and bx sx 100 and by sy 100 and by sy 100 then
                sprawdzBilet)
            end
        elseif isMouseInPositionbx2by216575 ) and getKeyState"mouse1" then
            cxcy getCursorPosition(  )
            cxcy cx sxcy sy
            bx2by2 cx 165 2cy 75 2
            if bx2 sx 50 and bx2 sx 100 and by2 sy 100 and by2 sy 100 then
                sprawdzBilet)
            end
        end
    end
end

function biletF(  )
    addEventHandler"onClientRender"rootbilety )
    bilet math.random1)
    setElementVelocitygetPedOccupiedVehiclelocalPlayer ), 00)
    bxbybx2by2 sx 235sy 85sx 235sy 10
end

addEventHandler"onClientMarkerHit"root, function( plrdim )
    if plr == localPlayer then
        if source == markerPracy then
            aktualnyMarker aktualnyMarker 1
            destroyElementmarkerPracy )
            destroyElementblip )
            zadowolenie zadowolenie 30
            biletF()
            if typPracy == "miejska" then
                nastepnyMarkerMiejskaaktualnyMarker )
            else
                nastepnyMarkerPozamiejskaaktualnyMarker )
            end
        end
    end
end )

addEventHandler"onClientVehicleDamage"root, function(tteloss)
    if pracuje then
        zadowolenie zadowolenie loss 10
    end
end )

pracuje false
zadowolenie 100

addEvent"startPracy"true )
addEventHandler"startPracy"localPlayer, function( vehtyp )
    if typ == "miejska" then
        aktualnyMarker 1
        nastepnyMarkerMiejskaaktualnyMarker )
        pracuje true
        zadowolenie 100
    end
    if typ == "pozamiejska" then
        aktualnyMarker 1
        nastepnyMarkerPozamiejskaaktualnyMarker )
        pracuje true
        zadowolenie 100
    end
    typPracy typ
end )

addEventHandler"onClientRender"root, function()
    if pracuje then
        dxDrawRectanglesx 1251025050tocolor000155 ) )
        if zadowolenie 70 then
            ztt "Pasa?erowie s? zadowoleni!"
        elseif zadowolenie <= 70 and zadowolenie 40 then
            ztt "Pasa?erowie s? neutralni."
        else
            ztt "Pasa?erowie s? ?li!" 
        end
        if zadowolenie 0 then zadowolenie 0 end
        if zadowolenie 100 then zadowolenie 100 end
        dxDrawTextztt .. "\n" .. math.floor(zadowolenie) .. "%"sx 1635 16sx 1635 16white1"default-bold""center""center" )
    end
end )

setTimer( function()
    zadowolenie zadowolenie 1
end1000)

function isMouseInPosition xywidthheight )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sxsy guiGetScreenSize ( )
    local cxcy getCursorPosition ( )
    local cxcy = ( cx sx ), ( cy sy )
    if ( cx >= and cx <= width ) and ( cy >= and cy <= height then
        return true
    else
        return false
    end
end


DEBUGSCRIPT 3
 ERROR: [skrypty]\pystories-busy\c.lua:163attempt to perform arithmetic on global 'zadowoleniee' (a nil value


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-13, 16:02


JakisPolak199

wieczny student






Wiek: 20
Na forum: 3510 dni
Posty: 131
Nick w MP: bover.

Piwa: 905

Respekt: 150
Respekt: 150Respekt: 150

sxsy guiGetScreenSize(  )

text createElement"text" )
setElementPositiontext114.341106.6813.71 )
setElementDatatext"name""Kierowca autobusu\nZarobki:\nLinia miejska: 35$\nLinia pozamiejska: 45$\nWynagrodzenie zale?y od\nzadowolenia klient?w" )

praca createMarker114.341106.6813.71-0.9"cylinder")
createBlipAttachedTopraca4622552552552550250 )

addEventHandler"onClientRender"root, function()
    if isElementWithinMarkerlocalPlayerpraca then
        dxDrawImagesx 350 2sy 200 2350200"panel.png" )
        if isMouseInPositionsx 112 60sy 64 211264 then
            dxDrawImagesx 112 60sy 64 211264"miejska.png" )
        end
        if isMouseInPositionsx 112 60sy 64 211264 then
            dxDrawImagesx 112 60sy 64 211264"pozamiejska.png" )
        end
        showCursortruefalse )
    else
        showCursorfalsefalse )
    end
end )

addEventHandler"onClientClick"root, function( buttonstateabsoluteXabsoluteYworldXworldYworldZclickedElement )
    if button == "left" and state == "down" then
        if isElementWithinMarkerlocalPlayerpraca then
            if isMouseInPositionsx 112 60sy 64 211264 then
                if getElementDatalocalPlayer"player:srp" ) < 0 then
                    exports["pystories-notifications"]:createAlert"Nie posiadasz wymaganej reputacji. (0 RP)" )
                else
                    if getElementDatalocalPlayer"player:license:pjC" ) ~= and getElementDatalocalPlayer"player:license:pjC" ) ~= true then
                        exports["pystories-notifications"]:createAlert"Nie posiadasz prawajazdy kategorii C." )
                    else
                        triggerServerEvent "startujPrace"resourceRootlocalPlayer"miejska" )
                    end
                end
            end
            if isMouseInPositionsx 112 60sy 64 211264 then
                if getElementDatalocalPlayer"player:srp" ) < 25 then
                    exports["pystories-notifications"]:createAlert"Nie posiadasz wymaganej reputacji. (25 RP)" )
                else
                    triggerServerEvent "startujPrace"resourceRootlocalPlayer"pozamiejska" )
                end
            end
        end
    end
end )

setTimer( function()
    for k,v in pairsgetElementsByType"vehicle" ) ) do
        if getElementDatav"disabledCols" then
            newalpha 255
            lastAlpha 255
            for _,v2 in pairsgetElementsByType"vehicle" ) ) do
                if ~= v2 then
                    xygetElementPosition)
                    x2y2z2 getElementPositionv2 )
                    dist getDistanceBetweenPoints3Dxyzx2y2z2 )
                    alpha 255
                    if dist 4 then
                        alpha 100
                    elseif dist 3 then
                        alpha 40
                    elseif dist 2 then
                        alpha 10
                    end
                    if lastAlpha alpha then newalpha alpha end
                    setElementCollidableWithv2vfalse )
                    setElementCollidableWithvv2false )
                end
            end
            setElementAlphavnewalpha )
        end
    end
end1000)

addEvent"wylaczKolizje"true )
addEventHandler"wylaczKolizje"localPlayer, function( veh )
    for k,v in pairsgetElementsByType"vehicle" ) ) do
        setElementCollidableWithvehvfalse )
        setElementCollidableWithvvehfalse )
    end
end )

function zakonczPrace()
    destroyElementblip )
    destroyElementmarkerPracy )
    triggerServerEvent"koniecPracusi"resourceRootlocalPlayer )
    pracuje false
    zadowolenie 100
end

addEvent"stopPracy"true )
addEventHandler"stopPracy"localPlayerzakonczPrace )

stacjeMiejskie = {
    {9.201201.2819.20-.9}, -- 431 Bus
    {-206.421201.2919.59}, -- 431 Bus
    {-298.581095.2219.60-.9}, -- 431 Bus
    {-238.031095.5519.59-.9}, -- 431 Bus
    {-162.761095.3819.59-.9}, -- 431 Bus
    {-45.131095.7819.59-.9}, -- 431 Bus
    {-44.391195.4219.21-.9}, -- 431 Bus
    {54.501195.7218.73-.9}, -- 431 Bus
    {89.361063.9713.61-.9}, -- 431 Bus
}

stacjePozaMiejskie = {
    {9.131201.1019.20-.9}, -- 431 Bus
    {-206.631200.9619.59-.9}, -- 431 Bus
    {-298.591095.5919.60-.9}, -- 431 Bus
    {-238.181095.4819.59-.9}, -- 431 Bus
    {-313.99888.5311.24-.9}, -- 431 Bus
    {38.34, -212.121.47-.9}, -- 431 Bus
    {203.28, -214.681.43-.9}, -- 431 Bus
    {305.59, -144.761.43-.9}, -- 431 Bus
    {622.64328.1019.57-.9}, -- 431 Bus
    {-187.571061.0119.59-.9}, -- 431 Bus
    {-163.091095.5119.59-.9}, -- 431 Bus
    {-45.541095.5419.59-.9}, -- 431 Bus
    {-44.031195.4919.21-.9}, -- 431 Bus
    {54.651195.5618.73-.9}, -- 431 Bus
    {89.711065.0713.61-.9}, -- 431 Bus
}

function nastepnyMarkerMiejskaidMarkeru )
    stacjeMiejskie[idMarkeru]
        if p then
        markerPracy createMarkerp[1], p[2], p[3], "cylinder")
        blip createBlipAttachedTomarkerPracy41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerPozamiejskaidMarkeru )
    stacjePozaMiejskie[idMarkeru]
        if p then
        markerPracy createMarkerp[1], p[2], p[3], "cylinder")
        blip createBlipAttachedTomarkerPracy41 )
    else
        zakonczPrace()
    end
end

function sprawdzBiletliczba )
    if bilet == liczba then
        jeszczeJeden math.random1)
        if jeszczeJeden == 1 then
            exports["pystories-notifications"]:createAlert"Podajesz bilet." )
            bxbybx2by2 sx 235sy 85sx 235sy 10
            bilet math.random1)
        else
            exports["pystories-notifications"]:createAlert"Podajesz bilet." )
            removeEventHandler"onClientRender"rootbilety )
        end
        if typPracy == "miejska" then
            zadowoleniee zadowolenie 30
            if zadowoleniee 100 then zadowoleniee 100 end
            triggerServerEvent"givePlayerMoney"localPlayer35 * (zadowoleniee 100) )
        else
            zadowoleniee zadowolenie 30
            if zadowoleniee 100 then zadowoleniee 100 end
            triggerServerEvent"givePlayerMoney"localPlayer45 * (zadowoleniee 100) )
        end
    else
        exports["pystories-notifications"]:createAlert"Podano z?y bilet." )
        zadowolenie zadowolenie 10
        bxbybx2by2 sx 235sy 85sx 235sy 10
    end
end

function bilety(  )
    if pracuje then
        showCursortrue )

        dxDrawRectanglesx 250sy 100500200tocolor000155 ) )
        dxDrawRectanglesx 50sy 100200200tocolor000155 ) )

        dxDrawImagebxby16575"normalny.jpg" )
        dxDrawImagebx2by216575"ulgowy.jpg" )

        if bilet == 1 then
            dxDrawText"Klient prosi o Bilet normalny"0520sxsywhite1.5"default-bold""center" )
        else
            dxDrawText"Klient prosi o Bilet ulgowy"0520sxsywhite1.5"default-bold""center" )
        end

        if isMouseInPositionbxby16575 ) and getKeyState"mouse1" then
            cxcy getCursorPosition(  )
            cxcy cx sxcy sy
            bxby cx 165 2cy 75 2
            if bx sx 50 and bx sx 100 and by sy 100 and by sy 100 then
                sprawdzBilet)
            end
        elseif isMouseInPositionbx2by216575 ) and getKeyState"mouse1" then
            cxcy getCursorPosition(  )
            cxcy cx sxcy sy
            bx2by2 cx 165 2cy 75 2
            if bx2 sx 50 and bx2 sx 100 and by2 sy 100 and by2 sy 100 then
                sprawdzBilet)
            end
        end
    end
end

function biletF(  )
    addEventHandler"onClientRender"rootbilety )
    bilet math.random1)
    setElementVelocitygetPedOccupiedVehiclelocalPlayer ), 00)
    bxbybx2by2 sx 235sy 85sx 235sy 10
end

addEventHandler"onClientMarkerHit"root, function( plrdim )
    if plr == localPlayer then
        if source == markerPracy then
            aktualnyMarker aktualnyMarker 1
            destroyElementmarkerPracy )
            destroyElementblip )
            zadowolenie zadowolenie 30
            biletF()
            if typPracy == "miejska" then
                nastepnyMarkerMiejskaaktualnyMarker )
            else
                nastepnyMarkerPozamiejskaaktualnyMarker )
            end
        end
    end
end )

addEventHandler"onClientVehicleDamage"root, function(tteloss)
    if pracuje then
        zadowolenie zadowolenie loss 10
    end
end )

pracuje false
zadowolenie 100

addEvent"startPracy"true )
addEventHandler"startPracy"localPlayer, function( vehtyp )
    if typ == "miejska" then
        aktualnyMarker 1
        nastepnyMarkerMiejskaaktualnyMarker )
        pracuje true
        zadowolenie 100
    end
    if typ == "pozamiejska" then
        aktualnyMarker 1
        nastepnyMarkerPozamiejskaaktualnyMarker )
        pracuje true
        zadowolenie 100
    end
    typPracy typ
end )

addEventHandler"onClientRender"root, function()
    if pracuje then
        dxDrawRectanglesx 1251025050tocolor000155 ) )
        if zadowolenie 70 then
            ztt "Pasa?erowie s? zadowoleni!"
        elseif zadowolenie <= 70 and zadowolenie 40 then
            ztt "Pasa?erowie s? neutralni."
        else
            ztt "Pasa?erowie s? ?li!" 
        end
        if zadowolenie 0 then zadowolenie 0 end
        if zadowolenie 100 then zadowolenie 100 end
        dxDrawTextztt .. "\n" .. math.floor(zadowolenie) .. "%"sx 1635 16sx 1635 16white1"default-bold""center""center" )
    end
end )

setTimer( function()
    zadowolenie zadowolenie 1
end1000)

function isMouseInPosition xywidthheight )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sxsy guiGetScreenSize ( )
    local cxcy getCursorPosition ( )
    local cxcy = ( cx sx ), ( cy sy )
    if ( cx >= and cx <= width ) and ( cy >= and cy <= height then
        return true
    else
        return false
    end
end


Powinno dzialac, mam nadzieje ze pomoglem

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-13, 16:05


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Dzieki wielkie :)

Postaw piwo autorowi tego posta
 

 
Tagi: praca :: busy
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