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: 3733 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
sx, sy = guiGetScreenSize(  )

text = createElement( "text" )
setElementPosition( text, 114.34, 1106.68, 13.71 )
setElementData( text, "name", "Kierowca autobusu\nZarobki:\nLinia miejska: 35$\nLinia pozamiejska: 45$\nWynagrodzenie zale?y od\nzadowolenia klient?w" )

praca = createMarker( 114.34, 1106.68, 13.71-0.9, "cylinder", 1 )
createBlipAttachedTo( praca, 46, 2, 255, 255, 255, 255, 0, 250 )

addEventHandler( "onClientRender", root, function()
    if isElementWithinMarker( localPlayer, praca ) then
        dxDrawImage( sx / 2 - 350 / 2, sy / 2 - 200 / 2, 350, 200, "panel.png" )
        if isMouseInPosition( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64 ) then
            dxDrawImage( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64, "miejska.png" )
        end
        if isMouseInPosition( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64 ) then
            dxDrawImage( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64, "pozamiejska.png" )
        end
        showCursor( true, false )
    else
        showCursor( false, false )
    end
end )

addEventHandler( "onClientClick", root, function( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement )
    if button == "left" and state == "down" then
        if isElementWithinMarker( localPlayer, praca ) then
            if isMouseInPosition( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64 ) then
                if getElementData( localPlayer, "player:srp" ) < 0 then
                    exports["pystories-notifications"]:createAlert( "Nie posiadasz wymaganej reputacji. (0 RP)" )
                else
                    if getElementData( localPlayer, "player:license:pjC" ) ~= 1 and getElementData( localPlayer, "player:license:pjC" ) ~= true then
                        exports["pystories-notifications"]:createAlert( "Nie posiadasz prawajazdy kategorii C." )
                    else
                        triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "miejska" )
                    end
                end
            end
            if isMouseInPosition( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64 ) then
                if getElementData( localPlayer, "player:srp" ) < 25 then
                    exports["pystories-notifications"]:createAlert( "Nie posiadasz wymaganej reputacji. (25 RP)" )
                else
                    triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "pozamiejska" )
                end
            end
        end
    end
end )

setTimer( function()
    for k,v in pairs( getElementsByType( "vehicle" ) ) do
        if getElementData( v, "disabledCols" ) then
            newalpha = 255
            lastAlpha = 255
            for _,v2 in pairs( getElementsByType( "vehicle" ) ) do
                if v ~= v2 then
                    x, y, z = getElementPosition( v )
                    x2, y2, z2 = getElementPosition( v2 )
                    dist = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 )
                    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
                    setElementCollidableWith( v2, v, false )
                    setElementCollidableWith( v, v2, false )
                end
            end
            setElementAlpha( v, newalpha )
        end
    end
end, 1000, 0 )

addEvent( "wylaczKolizje", true )
addEventHandler( "wylaczKolizje", localPlayer, function( veh )
    for k,v in pairs( getElementsByType( "vehicle" ) ) do
        setElementCollidableWith( veh, v, false )
        setElementCollidableWith( v, veh, false )
    end
end )

function zakonczPrace()
    destroyElement( blip )
    destroyElement( markerPracy )
    triggerServerEvent( "koniecPracusi", resourceRoot, localPlayer )
    pracuje = false
    zadowolenie = 100
end

addEvent( "stopPracy", true )
addEventHandler( "stopPracy", localPlayer, zakonczPrace )

stacjeMiejskie = {
    {9.20, 1201.28, 19.20-.9}, -- 431 - Bus
    {-206.42, 1201.29, 19.59}, -- 431 - Bus
    {-298.58, 1095.22, 19.60-.9}, -- 431 - Bus
    {-238.03, 1095.55, 19.59-.9}, -- 431 - Bus
    {-162.76, 1095.38, 19.59-.9}, -- 431 - Bus
    {-45.13, 1095.78, 19.59-.9}, -- 431 - Bus
    {-44.39, 1195.42, 19.21-.9}, -- 431 - Bus
    {54.50, 1195.72, 18.73-.9}, -- 431 - Bus
    {89.36, 1063.97, 13.61-.9}, -- 431 - Bus
}

stacjePozaMiejskie = {
    {9.13, 1201.10, 19.20-.9}, -- 431 - Bus
    {-206.63, 1200.96, 19.59-.9}, -- 431 - Bus
    {-298.59, 1095.59, 19.60-.9}, -- 431 - Bus
    {-238.18, 1095.48, 19.59-.9}, -- 431 - Bus
    {-313.99, 888.53, 11.24-.9}, -- 431 - Bus
    {38.34, -212.12, 1.47-.9}, -- 431 - Bus
    {203.28, -214.68, 1.43-.9}, -- 431 - Bus
    {305.59, -144.76, 1.43-.9}, -- 431 - Bus
    {622.64, 328.10, 19.57-.9}, -- 431 - Bus
    {-187.57, 1061.01, 19.59-.9}, -- 431 - Bus
    {-163.09, 1095.51, 19.59-.9}, -- 431 - Bus
    {-45.54, 1095.54, 19.59-.9}, -- 431 - Bus
    {-44.03, 1195.49, 19.21-.9}, -- 431 - Bus
    {54.65, 1195.56, 18.73-.9}, -- 431 - Bus
    {89.71, 1065.07, 13.61-.9}, -- 431 - Bus
}

function nastepnyMarkerMiejska( idMarkeru )
    p = stacjeMiejskie[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 3 )
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerPozamiejska( idMarkeru )
    p = stacjePozaMiejskie[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 3 )
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function sprawdzBilet( liczba )
    if bilet == liczba then
        jeszczeJeden = math.random( 1, 4 )
        if jeszczeJeden == 1 then
            exports["pystories-notifications"]:createAlert( "Podajesz bilet." )
            bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
            bilet = math.random( 1, 2 )
        else
            exports["pystories-notifications"]:createAlert( "Podajesz bilet." )
            removeEventHandler( "onClientRender", root, bilety )
        end
        if typPracy == "miejska" then
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end
            triggerServerEvent( "givePlayerMoney", localPlayer, 35 * (zadowoleniee / 100) )
        else
            triggerServerEvent( "givePlayerMoney", localPlayer, 45 * (zadowoleniee / 100) )
        end
    else
        exports["pystories-notifications"]:createAlert( "Podano z?y bilet." )
        zadowolenie = zadowolenie - 10
        bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
    end
end

function bilety(  )
    if pracuje then
        showCursor( true )

        dxDrawRectangle( sx / 2 - 250, sy / 2 - 100, 500, 200, tocolor( 0, 0, 0, 155 ) )
        dxDrawRectangle( sx / 2 + 50, sy / 2 - 100, 200, 200, tocolor( 0, 0, 0, 155 ) )

        dxDrawImage( bx, by, 165, 75, "normalny.jpg" )
        dxDrawImage( bx2, by2, 165, 75, "ulgowy.jpg" )

        if bilet == 1 then
            dxDrawText( "Klient prosi o Bilet normalny", 0, 520, sx, sy, white, 1.5, "default-bold", "center" )
        else
            dxDrawText( "Klient prosi o Bilet ulgowy", 0, 520, sx, sy, white, 1.5, "default-bold", "center" )
        end

        if isMouseInPosition( bx, by, 165, 75 ) and getKeyState( "mouse1" ) then
            cx, cy = getCursorPosition(  )
            cx, cy = cx * sx, cy * sy
            bx, by = cx - 165 / 2, cy - 75 / 2
            if bx > sx / 2 + 50 and bx < sx / 2 + 100 and by > sy / 2 - 100 and by < sy / 2 + 100 then
                sprawdzBilet( 1 )
            end
        elseif isMouseInPosition( bx2, by2, 165, 75 ) and getKeyState( "mouse1" ) then
            cx, cy = getCursorPosition(  )
            cx, cy = cx * sx, cy * sy
            bx2, by2 = cx - 165 / 2, cy - 75 / 2
            if bx2 > sx / 2 + 50 and bx2 < sx / 2 + 100 and by2 > sy / 2 - 100 and by2 < sy / 2 + 100 then
                sprawdzBilet( 2 )
            end
        end
    end
end

function biletF(  )
    addEventHandler( "onClientRender", root, bilety )
    bilet = math.random( 1, 2 )
    setElementVelocity( getPedOccupiedVehicle( localPlayer ), 0, 0, 0 )
    bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
end

addEventHandler( "onClientMarkerHit", root, function( plr, dim )
    if plr == localPlayer then
        if source == markerPracy then
            aktualnyMarker = aktualnyMarker + 1
            destroyElement( markerPracy )
            destroyElement( blip )
            zadowolenie = zadowolenie + 30
            biletF()
            if typPracy == "miejska" then
                nastepnyMarkerMiejska( aktualnyMarker )
            else
                nastepnyMarkerPozamiejska( aktualnyMarker )
            end
        end
    end
end )

addEventHandler( "onClientVehicleDamage", root, function(t, te, loss)
    if pracuje then
        zadowolenie = zadowolenie - loss / 10
    end
end )

pracuje = false
zadowolenie = 100

addEvent( "startPracy", true )
addEventHandler( "startPracy", localPlayer, function( veh, typ )
    if typ == "miejska" then
        aktualnyMarker = 1
        nastepnyMarkerMiejska( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    if typ == "pozamiejska" then
        aktualnyMarker = 1
        nastepnyMarkerPozamiejska( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    typPracy = typ
end )

addEventHandler( "onClientRender", root, function()
    if pracuje then
        dxDrawRectangle( sx / 2 - 125, 10, 250, 50, tocolor( 0, 0, 0, 155 ) )
        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
        dxDrawText( ztt .. "\n" .. math.floor(zadowolenie) .. "%", sx / 2 - 16, 35 - 16, sx / 2 + 16, 35 + 16, white, 1, "default-bold", "center", "center" )
    end
end )

setTimer( function()
    zadowolenie = zadowolenie - 1
end, 1000, 0 )

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


DEBUGSCRIPT 3
 ERROR: [skrypty]\pystories-busy\c.lua:163: attempt 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: 21
Na forum: 3651 dni
Posty: 131
Nick w MP: bover.

Piwa: 906

Respekt: 150
Respekt: 150Respekt: 150

sx, sy = guiGetScreenSize(  )

text = createElement( "text" )
setElementPosition( text, 114.34, 1106.68, 13.71 )
setElementData( text, "name", "Kierowca autobusu\nZarobki:\nLinia miejska: 35$\nLinia pozamiejska: 45$\nWynagrodzenie zale?y od\nzadowolenia klient?w" )

praca = createMarker( 114.34, 1106.68, 13.71-0.9, "cylinder", 1 )
createBlipAttachedTo( praca, 46, 2, 255, 255, 255, 255, 0, 250 )

addEventHandler( "onClientRender", root, function()
    if isElementWithinMarker( localPlayer, praca ) then
        dxDrawImage( sx / 2 - 350 / 2, sy / 2 - 200 / 2, 350, 200, "panel.png" )
        if isMouseInPosition( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64 ) then
            dxDrawImage( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64, "miejska.png" )
        end
        if isMouseInPosition( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64 ) then
            dxDrawImage( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64, "pozamiejska.png" )
        end
        showCursor( true, false )
    else
        showCursor( false, false )
    end
end )

addEventHandler( "onClientClick", root, function( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement )
    if button == "left" and state == "down" then
        if isElementWithinMarker( localPlayer, praca ) then
            if isMouseInPosition( sx / 2 - 112 / 2 - 60, sy / 2 - 64 / 2, 112, 64 ) then
                if getElementData( localPlayer, "player:srp" ) < 0 then
                    exports["pystories-notifications"]:createAlert( "Nie posiadasz wymaganej reputacji. (0 RP)" )
                else
                    if getElementData( localPlayer, "player:license:pjC" ) ~= 1 and getElementData( localPlayer, "player:license:pjC" ) ~= true then
                        exports["pystories-notifications"]:createAlert( "Nie posiadasz prawajazdy kategorii C." )
                    else
                        triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "miejska" )
                    end
                end
            end
            if isMouseInPosition( sx / 2 - 112 / 2 + 60, sy / 2 - 64 / 2, 112, 64 ) then
                if getElementData( localPlayer, "player:srp" ) < 25 then
                    exports["pystories-notifications"]:createAlert( "Nie posiadasz wymaganej reputacji. (25 RP)" )
                else
                    triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "pozamiejska" )
                end
            end
        end
    end
end )

setTimer( function()
    for k,v in pairs( getElementsByType( "vehicle" ) ) do
        if getElementData( v, "disabledCols" ) then
            newalpha = 255
            lastAlpha = 255
            for _,v2 in pairs( getElementsByType( "vehicle" ) ) do
                if v ~= v2 then
                    x, y, z = getElementPosition( v )
                    x2, y2, z2 = getElementPosition( v2 )
                    dist = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 )
                    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
                    setElementCollidableWith( v2, v, false )
                    setElementCollidableWith( v, v2, false )
                end
            end
            setElementAlpha( v, newalpha )
        end
    end
end, 1000, 0 )

addEvent( "wylaczKolizje", true )
addEventHandler( "wylaczKolizje", localPlayer, function( veh )
    for k,v in pairs( getElementsByType( "vehicle" ) ) do
        setElementCollidableWith( veh, v, false )
        setElementCollidableWith( v, veh, false )
    end
end )

function zakonczPrace()
    destroyElement( blip )
    destroyElement( markerPracy )
    triggerServerEvent( "koniecPracusi", resourceRoot, localPlayer )
    pracuje = false
    zadowolenie = 100
end

addEvent( "stopPracy", true )
addEventHandler( "stopPracy", localPlayer, zakonczPrace )

stacjeMiejskie = {
    {9.20, 1201.28, 19.20-.9}, -- 431 - Bus
    {-206.42, 1201.29, 19.59}, -- 431 - Bus
    {-298.58, 1095.22, 19.60-.9}, -- 431 - Bus
    {-238.03, 1095.55, 19.59-.9}, -- 431 - Bus
    {-162.76, 1095.38, 19.59-.9}, -- 431 - Bus
    {-45.13, 1095.78, 19.59-.9}, -- 431 - Bus
    {-44.39, 1195.42, 19.21-.9}, -- 431 - Bus
    {54.50, 1195.72, 18.73-.9}, -- 431 - Bus
    {89.36, 1063.97, 13.61-.9}, -- 431 - Bus
}

stacjePozaMiejskie = {
    {9.13, 1201.10, 19.20-.9}, -- 431 - Bus
    {-206.63, 1200.96, 19.59-.9}, -- 431 - Bus
    {-298.59, 1095.59, 19.60-.9}, -- 431 - Bus
    {-238.18, 1095.48, 19.59-.9}, -- 431 - Bus
    {-313.99, 888.53, 11.24-.9}, -- 431 - Bus
    {38.34, -212.12, 1.47-.9}, -- 431 - Bus
    {203.28, -214.68, 1.43-.9}, -- 431 - Bus
    {305.59, -144.76, 1.43-.9}, -- 431 - Bus
    {622.64, 328.10, 19.57-.9}, -- 431 - Bus
    {-187.57, 1061.01, 19.59-.9}, -- 431 - Bus
    {-163.09, 1095.51, 19.59-.9}, -- 431 - Bus
    {-45.54, 1095.54, 19.59-.9}, -- 431 - Bus
    {-44.03, 1195.49, 19.21-.9}, -- 431 - Bus
    {54.65, 1195.56, 18.73-.9}, -- 431 - Bus
    {89.71, 1065.07, 13.61-.9}, -- 431 - Bus
}

function nastepnyMarkerMiejska( idMarkeru )
    p = stacjeMiejskie[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 3 )
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerPozamiejska( idMarkeru )
    p = stacjePozaMiejskie[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 3 )
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function sprawdzBilet( liczba )
    if bilet == liczba then
        jeszczeJeden = math.random( 1, 4 )
        if jeszczeJeden == 1 then
            exports["pystories-notifications"]:createAlert( "Podajesz bilet." )
            bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
            bilet = math.random( 1, 2 )
        else
            exports["pystories-notifications"]:createAlert( "Podajesz bilet." )
            removeEventHandler( "onClientRender", root, bilety )
        end
        if typPracy == "miejska" then
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end
            triggerServerEvent( "givePlayerMoney", localPlayer, 35 * (zadowoleniee / 100) )
        else
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end
            triggerServerEvent( "givePlayerMoney", localPlayer, 45 * (zadowoleniee / 100) )
        end
    else
        exports["pystories-notifications"]:createAlert( "Podano z?y bilet." )
        zadowolenie = zadowolenie - 10
        bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
    end
end

function bilety(  )
    if pracuje then
        showCursor( true )

        dxDrawRectangle( sx / 2 - 250, sy / 2 - 100, 500, 200, tocolor( 0, 0, 0, 155 ) )
        dxDrawRectangle( sx / 2 + 50, sy / 2 - 100, 200, 200, tocolor( 0, 0, 0, 155 ) )

        dxDrawImage( bx, by, 165, 75, "normalny.jpg" )
        dxDrawImage( bx2, by2, 165, 75, "ulgowy.jpg" )

        if bilet == 1 then
            dxDrawText( "Klient prosi o Bilet normalny", 0, 520, sx, sy, white, 1.5, "default-bold", "center" )
        else
            dxDrawText( "Klient prosi o Bilet ulgowy", 0, 520, sx, sy, white, 1.5, "default-bold", "center" )
        end

        if isMouseInPosition( bx, by, 165, 75 ) and getKeyState( "mouse1" ) then
            cx, cy = getCursorPosition(  )
            cx, cy = cx * sx, cy * sy
            bx, by = cx - 165 / 2, cy - 75 / 2
            if bx > sx / 2 + 50 and bx < sx / 2 + 100 and by > sy / 2 - 100 and by < sy / 2 + 100 then
                sprawdzBilet( 1 )
            end
        elseif isMouseInPosition( bx2, by2, 165, 75 ) and getKeyState( "mouse1" ) then
            cx, cy = getCursorPosition(  )
            cx, cy = cx * sx, cy * sy
            bx2, by2 = cx - 165 / 2, cy - 75 / 2
            if bx2 > sx / 2 + 50 and bx2 < sx / 2 + 100 and by2 > sy / 2 - 100 and by2 < sy / 2 + 100 then
                sprawdzBilet( 2 )
            end
        end
    end
end

function biletF(  )
    addEventHandler( "onClientRender", root, bilety )
    bilet = math.random( 1, 2 )
    setElementVelocity( getPedOccupiedVehicle( localPlayer ), 0, 0, 0 )
    bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
end

addEventHandler( "onClientMarkerHit", root, function( plr, dim )
    if plr == localPlayer then
        if source == markerPracy then
            aktualnyMarker = aktualnyMarker + 1
            destroyElement( markerPracy )
            destroyElement( blip )
            zadowolenie = zadowolenie + 30
            biletF()
            if typPracy == "miejska" then
                nastepnyMarkerMiejska( aktualnyMarker )
            else
                nastepnyMarkerPozamiejska( aktualnyMarker )
            end
        end
    end
end )

addEventHandler( "onClientVehicleDamage", root, function(t, te, loss)
    if pracuje then
        zadowolenie = zadowolenie - loss / 10
    end
end )

pracuje = false
zadowolenie = 100

addEvent( "startPracy", true )
addEventHandler( "startPracy", localPlayer, function( veh, typ )
    if typ == "miejska" then
        aktualnyMarker = 1
        nastepnyMarkerMiejska( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    if typ == "pozamiejska" then
        aktualnyMarker = 1
        nastepnyMarkerPozamiejska( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    typPracy = typ
end )

addEventHandler( "onClientRender", root, function()
    if pracuje then
        dxDrawRectangle( sx / 2 - 125, 10, 250, 50, tocolor( 0, 0, 0, 155 ) )
        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
        dxDrawText( ztt .. "\n" .. math.floor(zadowolenie) .. "%", sx / 2 - 16, 35 - 16, sx / 2 + 16, 35 + 16, white, 1, "default-bold", "center", "center" )
    end
end )

setTimer( function()
    zadowolenie = zadowolenie - 1
end, 1000, 0 )

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


Powinno dzialac, mam nadzieje ze pomoglem

Postaw piwo autorowi tego posta
 

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


Fl!k







Wiek: 26
Na forum: 3733 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 » Praca Busy 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