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

Wysłany: 2019-05-01, 23:07


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot??, jak zdedam to dalej mam punkt, pr?bowa?em co? z funkcj? onPlayerWasted lecz nic :(
kod
s.lua

addEvent( "koniecPracusi", true )
addEventHandler( "koniecPracusi", resourceRoot, function( plr )
    if pojazd[plr] then
        destroyElement( pojazd[plr] )
        pojazd[plr] = nil
    end
end )

addEvent( "startujPrace", true )
addEventHandler( "startujPrace", resourceRoot, function( plr, typ )
    if not pojazd[plr] then
        L = math.random( 1, #miejscaSpawnu )
        m = miejscaSpawnu[L]
        if typ == "1lvl" then
            pojazd[plr] = createVehicle( 462, m[1], m[2], m[3], m[4], m[5], m[6] )
        end
        if typ == "2lvl" then        
            pojazd[plr] = createVehicle( 561, m[1], m[2], m[3], m[4], m[5], m[6] )
        end
        if typ == "3lvl" then        
            pojazd[plr] = createVehicle( 482, m[1], m[2], m[3], m[4], m[5], m[6] )            
        end
        setVehicleColor(pojazd[plr], 255, 70, 0, 255, 255, 255 )
        setElementData(pojazd[plr], "plr", plr )
        setElementFrozen(pojazd[plr], true )
        warpPedIntoVehicle( plr, pojazd[plr], 0 )
        setVehicleHandling(pojazd[plr], "engineAcceleration", 15)
        setElementData (pojazd[plr], "Pojemnosc:silnika", "1.6cm3")
        setElementData (pojazd[plr], "licznik:kolor", "Pomaranczowy")
        deleteColisionsWithVehicles( pojazd[plr] )
        triggerClientEvent( plr, "startPracy", plr, pojazd, typ )
    end
end)

addEventHandler( "onPlayerVehicleExit", root, function( pojazdH )
    if getElementData( pojazdH, "plr" ) == source then
        destroyElement( pojazdH )
        pojazd[source] = nil
        triggerClientEvent( source, "stopPracy", source )
    end
end )


a tak ja pr?bowa?em
addEventHandler( "onClientPlayerWasted", resourceRoot, function( plr )
    if pojazd[plr] then
        destroyElement( pojazd[plr] )
        pojazd[plr] = nil
        triggerClientEvent( source, "stopPracy", source )
    end
end )


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-01, 23:20


Avenged

Młodszy Szkrypter






Wiek: 24
Na forum: 3651 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1572

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

Piszesz w temacie "onPlayerWasted", a u?ywasz onClientPlayerWasted. Jakby? zauwa?y? to tw?j kod jest po sside czyli event nie mo?e by? nagle po cside. U?yj do tego eventu
Więcej informacji znajdziesz w Wikipedii MTA:

onPlayerWasted
.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-01, 23:48


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Mordko, dzi?kuje za upomnienie, lecz dalej nie dzia?a :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-02, 00:06


Avenged

Młodszy Szkrypter






Wiek: 24
Na forum: 3651 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1572

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

Poka? kod

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-02, 11:23


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

c.lua
sx, sy = guiGetScreenSize(  )
local screenW, screenH = guiGetScreenSize()
local dxfont0_CaviarDreams_Bold = dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf", 9)

text = createElement( "text" )
setElementPosition( text, -2027.71, -40.87, 38.80+1.5 )
setElementData( text, "name", "Listonosz" )

praca = createMarker(-2027.71, -40.87, 38.80-0.9, "cylinder", 1, 255, 70, 0 )
createBlipAttachedTo( praca, 46, 2, 255, 255, 255, 255, 0, 250 )

addEventHandler( "onClientRender", root, function()
    if isElementWithinMarker( localPlayer, praca ) then
        dxDrawImage(screenW * 0.3932, screenH * 0.2898, screenW * 0.2057, screenH * 0.3778, "panel.png" )
        if isMouseInPosition(screenW * 0.4469, screenH * 0.3157, screenW * 0.0938, screenH * 0.0954) then
            dxDrawImage(screenW * 0.4469, screenH * 0.3157, screenW * 0.0938, screenH * 0.0954, "1lvl.png" )
        end
        if isMouseInPosition(screenW * 0.4469, screenH * 0.4296, screenW * 0.0938, screenH * 0.0954) then
            dxDrawImage(screenW * 0.4469, screenH * 0.4296, screenW * 0.0938, screenH * 0.0954, "2lvl.png" )
        end
        if isMouseInPosition(screenW * 0.4469, screenH * 0.5444, screenW * 0.0938, screenH * 0.0954) then
            dxDrawImage(screenW * 0.4469, screenH * 0.5444, screenW * 0.0938, screenH * 0.0954, "3lvl.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(screenW * 0.4469, screenH * 0.3157, screenW * 0.0938, screenH * 0.0954) then
                if getElementData( localPlayer, "player:movep" ) < 50 then
                triggerEvent("onClientAddNotification", localPlayer, "Nie posiadasz 50 MovePoints'?w :(", "error")
                else
                    if getElementData( localPlayer, "player:license:pjB" ) ~= 1 and getElementData( localPlayer, "player:license:pjB" ) ~= true then
                        triggerEvent("onClientAddNotification", localPlayer, "Nie posiadasz Prawa Jazdy Kategorii B", "info")
                    else
                        triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "1lvl" )
                    end
                end
            end
            if isMouseInPosition(screenW * 0.4469, screenH * 0.4296, screenW * 0.0938, screenH * 0.0954) then
                if getElementData( localPlayer, "player:movep" ) < 250 then
                    triggerEvent("onClientAddNotification", localPlayer, "Nie posiadasz 250 MovePoints'?w :(", "error")
                else
                    triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "2lvl" )
                end
            end
            if isMouseInPosition(screenW * 0.4469, screenH * 0.5444, screenW * 0.0938, screenH * 0.0954) then
                if getElementData( localPlayer, "player:movep" ) < 500 then
                    triggerEvent("onClientAddNotification", localPlayer, "Nie posiadasz 500 MovePoints'?w :(", "error")
                else
                    triggerServerEvent ( "startujPrace", resourceRoot, localPlayer, "3lvl" )
                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( pojazd )
    for k,v in pairs( getElementsByType( "vehicle" ) ) do
        setElementCollidableWith( pojazd, v, false )
        setElementCollidableWith( v, pojazd, 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 )

stacjeOneLVL = {
    {-2661.09,713.13,27.77},
    {-2359.63,573.23,24.74},
    {-2393.40,1112.37,55.58}, 
    {-2886.07,1162.21,13.05},
    {-2745.94,771.32,54.24},  
    {-2754.43,376.50,4.13},
    {-2637.73,165.06,4.33},   
    {-2804.24,-119.62,7.03},
    {-2450.62,1253.96,31.51}, 
    {-2531.76,984.16,78.33},    
    {-2020.77, -57.94, 35.33},
}

stacjeTwoLVL = {
    {-2102.09,1168.56,53.21},
    {-2460.56,1248.99,33.01},
    {-2880.99,1023.26,36.24},
    {-2840.01,695.90,23.73}, 
    {-2572.49,913.37,64.98}, 
    {-2584.27,999.27,78.29}, 
    {-2885.66,1174.48,10.44}, 
    {-2450.73,1338.99,8.37}, 
    {-2886.16,1070.01,31.16}, 
    {-2852.69,817.78,39.80},
    {-2710.82,-192.38,4.18}, 
    {-2701.82,-89.79,4.18}, 
    {-2657.85,371.92,4.35}, 
    {-2187.87,813.40,56.84},
    {-2274.09,1045.66,83.69},
    {-1955.66,1185.58,45.30}, 
    {-1967.25,738.64,45.30},
    {-2660.02,806.76,49.98},
    {-2828.08,884.17,43.91},
}

stacjeThreeLVL = {
    {-2274.94,1063.21,82.11}, --1
    {-2251.18,706.59,49.30 }, --2
    {-2358.94,482.56,30.64 },--3
    {-2381.51,740.23,35.02},--4
    {-2607.86,838.52,49.86},--5
    {-2749.06,797.61,52.97}, --6
    {-2340.31,670.43,38.24}, --7
    {-2188.15,1182.52,55.58},--8
    {-2503.63,910.90,64.76},--9
    {-2604.71,985.77,78.13},--10
    {-2824.05,915.78,43.91},--11
    {-2860.70,730.92,29.65},--12
    {-2605.04,448.47,14.45},--13
    {-2515.34,437.35,26.73},--14
    {-2168.89,569.02,35.02},--15
    {-2042.99,561.63,35.02},--16
    {-2048.82,733.48,57.37},--17
    {-2150.33,785.79,69.41},--18
    {-2223.91,806.97,49.30},--19
    {-2270.49,637.49,49.10},--20
    {-2357.12,569.24,24.74},--21
    {-2665.07,711.27,27.77},--22
    {-2721.35,1003.11,54.60},--23
    {-2402.20,1113.81,55.58},--24
    {-2384.70,910.63,45.30},--25
    {-2882.61,1111.13,25.96},--26
    {-2451.86,1337.88,8.67},--27
    {-2642.27,709.15,27.78}, --28
    {-2322.20,810.08,44.97}, --29
    {-2004.18,848.82,45.30}, --30,
}

function nastepnyMarkerOneLVL( idMarkeru )
    p = stacjeOneLVL[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 2.5, 255, 80, 0)
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerTwoLVL( idMarkeru )
    p = stacjeTwoLVL[idMarkeru]
        if p then
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 2.5, 255, 80, 0 )
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end

function nastepnyMarkerThreeLVL( idMarkeru )
    p = stacjeThreeLVL[idMarkeru]
        markerPracy = createMarker( p[1], p[2], p[3], "cylinder", 2.5, 255, 80, 0 )
        if p then
        blip = createBlipAttachedTo( markerPracy, 41 )
    else
        zakonczPrace()
    end
end


function sprawdzBilet( liczba )
    if bilet == liczba then
        jeszczeJeden = math.random( 1, 4 )
        if jeszczeJeden == 1 then
            bx, by, bx2, by2 = sx / 2 - 235, sy / 2 - 85, sx / 2 - 235, sy / 2 + 10
            bilet = math.random( 1, 2 )
        else
            triggerEvent("onClientAddNotification", localPlayer, "Podajesz Przesy?k? Klientowi.", "success")
            removeEventHandler( "onClientRender", root, bilety )
        end
        if typPracy == "1lvl" then
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end
            triggerServerEvent( "givePlayerMoney", localPlayer, 40000 * (zadowoleniee / 100) )
            end
            if typPracy == "2lvl" then
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end            
            triggerServerEvent( "givePlayerMoney", localPlayer, 50000* (zadowoleniee / 100) )
            end
            if typPracy == "3lvl" then
            zadowoleniee = zadowolenie + 30
            if zadowoleniee > 100 then zadowoleniee = 100 end            
            triggerServerEvent( "givePlayerMoney", localPlayer, 80000* (zadowoleniee / 100) )
            end
        else
        triggerEvent("onClientAddNotification", localPlayer, "Podano z?? przesy?k? !", "error")
        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 )

        dxDrawLine((screenW * 0.3526) - 1, (screenH * 0.3852) - 1, (screenW * 0.3526) - 1, screenH * 0.5870, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.6583, (screenH * 0.3852) - 1, (screenW * 0.3526) - 1, (screenH * 0.3852) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine((screenW * 0.3526) - 1, screenH * 0.5870, screenW * 0.6583, screenH * 0.5870, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.6583, screenH * 0.5870, screenW * 0.6583, (screenH * 0.3852) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.3526, screenH * 0.3852, screenW * 0.3057, screenH * 0.2019, tocolor(0, 0, 0, 210), false)
        dxDrawLine((screenW * 0.5245) - 1, (screenH * 0.3870) - 1, (screenW * 0.5245) - 1, screenH * 0.5870, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.6583, (screenH * 0.3870) - 1, (screenW * 0.5245) - 1, (screenH * 0.3870) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine((screenW * 0.5245) - 1, screenH * 0.5870, screenW * 0.6583, screenH * 0.5870, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.6583, screenH * 0.5870, screenW * 0.6583, (screenH * 0.3870) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.5245, screenH * 0.3870, screenW * 0.1339, screenH * 0.2000, tocolor(0, 0, 0, 0), false)        
        

        dxDrawImage( bx, by, 165, 75, "paczka.png" )
        dxDrawImage( bx2, by2, 165, 75, "list.png" )

        if bilet == 1 then
        dxDrawText("Klient Prosi o paczk? 5KG.", (screenW * 0.3995) - 1, (screenH * 0.3352) - 1, (screenW * 0.6240) - 1, (screenH * 0.3778) - 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o paczk? 5KG.", (screenW * 0.3995) + 1, (screenH * 0.3352) - 1, (screenW * 0.6240) + 1, (screenH * 0.3778) - 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o paczk? 5KG.", (screenW * 0.3995) - 1, (screenH * 0.3352) + 1, (screenW * 0.6240) - 1, (screenH * 0.3778) + 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o paczk? 5KG.", (screenW * 0.3995) + 1, (screenH * 0.3352) + 1, (screenW * 0.6240) + 1, (screenH * 0.3778) + 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o paczk? 5KG.", screenW * 0.3995, screenH * 0.3352, screenW * 0.6240, screenH * 0.3778, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        else
        dxDrawText("Klient Prosi o list.", (screenW * 0.3995) - 1, (screenH * 0.5926) - 1, (screenW * 0.6240) - 1, (screenH * 0.6352) - 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o list.", (screenW * 0.3995) + 1, (screenH * 0.5926) - 1, (screenW * 0.6240) + 1, (screenH * 0.6352) - 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o list.", (screenW * 0.3995) - 1, (screenH * 0.5926) + 1, (screenW * 0.6240) - 1, (screenH * 0.6352) + 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o list.", (screenW * 0.3995) + 1, (screenH * 0.5926) + 1, (screenW * 0.6240) + 1, (screenH * 0.6352) + 1, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Klient Prosi o list.", screenW * 0.3995, screenH * 0.5926, screenW * 0.6240, screenH * 0.6352, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        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 == "1lvl" then
                nastepnyMarkerOneLVL( aktualnyMarker )
            end
            if typPracy == "2lvl" then
                nastepnyMarkerTwoLVL( aktualnyMarker )
            end
            if typPracy == "3lvl" then
                nastepnyMarkerThreeLVL( 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( pojazd, typ )
    if typ == "1lvl" then
        aktualnyMarker = 1
        nastepnyMarkerOneLVL( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    if typ == "2lvl" then
        aktualnyMarker = 1
        nastepnyMarkerTwoLVL( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end
    if typ == "3lvl" then
        aktualnyMarker = 1
        nastepnyMarkerThreeLVL( aktualnyMarker )
        pracuje = true
        zadowolenie = 100
    end        
    typPracy = typ
end )
local px,py = (screenW/1920),(screenH/1080)
local dxfont0_CaviarDreams_Bold = dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf", 10)
addEventHandler( "onClientRender", root, function()
    if pracuje then
        dxDrawLine((screenW * 0.6828) - 1, (screenH * 0.0259) - 1, (screenW * 0.6828) - 1, screenH * 0.0583, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.7932, (screenH * 0.0259) - 1, (screenW * 0.6828) - 1, (screenH * 0.0259) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine((screenW * 0.6828) - 1, screenH * 0.0583, screenW * 0.7932, screenH * 0.0583, tocolor(255, 55, 0, 255), 1, false)
        dxDrawLine(screenW * 0.7932, screenH * 0.0583, screenW * 0.7932, (screenH * 0.0259) - 1, tocolor(255, 55, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.6828, screenH * 0.0259, screenW * 0.1104, screenH * 0.0324, tocolor(0, 0, 0, 210), false)
        if zadowolenie > 70 then
            ztt = "Stan Towaru: Dobry"
        elseif zadowolenie <= 70 and zadowolenie > 40 then
            ztt = "Stan Towaru: ?redni"
        else
            ztt = "Stan Towaru: Z?y" 
        end
        if zadowolenie < 0 then zadowolenie = 0 end
        if zadowolenie > 100 then zadowolenie = 100 end
        dxDrawText(ztt .. "\n" .. math.floor(zadowolenie) .. "%", (screenW * 0.6828) - 1, (screenH * 0.0259) - 1, (screenW * 0.7932) - 1, (screenH * 0.0583) - 1, tocolor(67, 0, 7, 255), 1.00*px, dxfont0_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText(ztt .. "\n" .. math.floor(zadowolenie) .. "%", (screenW * 0.6828) + 1, (screenH * 0.0259) - 1, (screenW * 0.7932) + 1, (screenH * 0.0583) - 1, tocolor(67, 0, 7, 255), 1.00*px, dxfont0_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText(ztt .. "\n" .. math.floor(zadowolenie) .. "%", (screenW * 0.6828) - 1, (screenH * 0.0259) + 1, (screenW * 0.7932) - 1, (screenH * 0.0583) + 1, tocolor(67, 0, 7, 255), 1.00*px, dxfont0_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText(ztt .. "\n" .. math.floor(zadowolenie) .. "%", (screenW * 0.6828) + 1, (screenH * 0.0259) + 1, (screenW * 0.7932) + 1, (screenH * 0.0583) + 1, tocolor(67, 0, 7, 255), 1.00*px, dxfont0_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText(ztt .. "\n" .. math.floor(zadowolenie) .. "%", screenW * 0.6828, screenH * 0.0259, screenW * 0.7932, screenH * 0.0583, tocolor(255, 255, 255, 255), 1.00*px, dxfont0_CaviarDreams_Bold, "center", "center", false, false, false, false, false)        
    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

s.lua

pojazd = {}

miejscaSpawnu = {
    {-2023.69,-44.44,35.03,359.7,359.0,179.5}, -- 431 - Bus
    {-2019.45,-44.96,35.00,359.7,359.0,179.9},
    {-2019.47,-51.65,35.00,359.7,359.0,180.2},
    {-2024.15,-52.80,35.02,359.5,359.3,180.4},
}

function deleteColisionsWithVehicles( pojazd )
    setElementData( pojazd, "disabledCols", true )
    for k,p in pairs( getElementsByType( "player" ) ) do
        triggerClientEvent( p, "wylaczKolizje", p, pojazd )
    end
end

addEvent( "koniecPracusi", true )
addEventHandler( "koniecPracusi", resourceRoot, function( plr )
    if pojazd[plr] then
        destroyElement( pojazd[plr] )
        pojazd[plr] = nil
    end
end )

addEvent( "startujPrace", true )
addEventHandler( "startujPrace", resourceRoot, function( plr, typ )
    if not pojazd[plr] then
        L = math.random( 1, #miejscaSpawnu )
        m = miejscaSpawnu[L]
        if typ == "1lvl" then
            pojazd[plr] = createVehicle( 462, m[1], m[2], m[3], m[4], m[5], m[6] )
        end
        if typ == "2lvl" then        
            pojazd[plr] = createVehicle( 561, m[1], m[2], m[3], m[4], m[5], m[6] )
        end
        if typ == "3lvl" then        
            pojazd[plr] = createVehicle( 482, m[1], m[2], m[3], m[4], m[5], m[6] )            
        end
        setVehicleColor(pojazd[plr], 255, 70, 0, 255, 255, 255 )
        setElementData(pojazd[plr], "plr", plr )
        setElementFrozen(pojazd[plr], true )
        warpPedIntoVehicle( plr, pojazd[plr], 0 )
        setVehicleHandling(pojazd[plr], "engineAcceleration", 15)
        setElementData (pojazd[plr], "Pojemnosc:silnika", "1.6cm3")
        setElementData (pojazd[plr], "licznik:kolor", "Pomaranczowy")
        deleteColisionsWithVehicles( pojazd[plr] )
        triggerClientEvent( plr, "startPracy", plr, pojazd, typ )
    end
end)

addEventHandler( "onPlayerVehicleExit", root, function( pojazdH )
    if getElementData( pojazdH, "plr" ) == source then
        destroyElement( pojazdH )
        pojazd[source] = nil
        triggerClientEvent( source, "stopPracy", source )
    end
end )


Postaw piwo autorowi tego posta
 

 
Tagi: funkcja :: onplayerwasted
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