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

Wysłany: 2018-04-01, 17:36


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

Witam!
Ot?? morduje si? z tym problemem ju? godzin? i nie wiem co jest grane. Po naci?ni?ciu przycisku 'Anuluj' zabiera mi paczk? zamiast wy??czy? GUI. Prosze o pomoc, o poprawienie kodu. Za pomoc stawiam R* :piwo:



local praca = createMarker(1407.70, 1143.37, 5102.70-1, "cylinder", 2.0, 255, 255, 255, 80)
local t=createElement("text")
setElementData(t,"name", "Praca Dorywcza: Pracownik Magazynu")
setElementPosition(t,1407.70, 1143.37, 5102.70)
setElementDimension(t, 0)
setElementInterior(t, 0)

local screenW, screenH = guiGetScreenSize()

panel = false

local miejscamagazynier = {
    {1410.87, 1156.97, 5102.70}, 
    {1406.32, 1170.66, 5102.70},
    {1406.32, 1170.66, 5102.70},
    {1410.95, 1178.06, 5102.70},
    {1406.38, 1178.06, 5102.70},
    {1418.81, 1185.87, 5102.70},
    {1413.73, 1181.31, 5102.70},
}

function paneldx()
        dxDrawImage(screenW * 0.2833, screenH * 0.2865, screenW * 0.4334, screenH * 0.4271, "images/bg2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) - 1, (screenW * 0.4414) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) - 1, (screenW * 0.4414) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) + 1, (screenW * 0.4414) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) + 1, (screenW * 0.4414) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) - 1, (screenW * 0.6501) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) - 1, (screenW * 0.6501) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) + 1, (screenW * 0.6501) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) + 1, (screenW * 0.6501) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) - 1, (screenW * 0.5469) - 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) - 1, (screenW * 0.5469) + 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) + 1, (screenW * 0.5469) - 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) + 1, (screenW * 0.5469) + 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", screenW * 0.4553, screenH * 0.3568, screenW * 0.5469, screenH * 0.3971, tocolor(197, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) - 1, (screenW * 0.5571) - 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) - 1, (screenW * 0.5571) + 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) + 1, (screenW * 0.5571) - 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) + 1, (screenW * 0.5571) + 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", screenW * 0.4414, screenH * 0.4102, screenW * 0.5571, screenH * 0.4466, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca polegaj?ca na roznoszeniu paczek z zywno?ci?.\nPo zaniesieniu paczki otrzymamy wynagrodzenie.", screenW * 0.4451, screenH * 0.4870, screenW * 0.5542, screenH * 0.5404, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit", praca, function(el, md)
    if el ~= localPlayer then return end
    panel = true
    addEventHandler("onClientRender", root, paneldx)
    showCursor(true)
end)



addEventHandler("onClientResourceStop", resourceRoot, function()
panel = false
 setElementData(localPlayer, "player:job", false)
end,false,"high")

function isMouseInPosition(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*screenW,cy*screenH
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function klik()
    if panel == true then
        if isMouseInPosition(screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549) then
            if not getElementData(localPlayer, "player:job") then
                if panel == false then cancelEvent() end
                local losuj = math.random(2, #miejscamagazynier)
                setElementData(localPlayer, "player:job", true)
                setPedControlState(localPlayer, "walk", true)
                toggleControl("crouch",false)
                toggleControl("jump", false)
                toggleControl("sprint", false)
                setPedAnimation ( localPlayer, "CARRY", "crry_prtial", 1,true )
                removeEventHandler("onClientRender", root, paneldx)
                showCursor(false)
                panel = false

                local skrzynia = createObject(1271, 0, 0, 0)
                attachElements ( skrzynia, localPlayer, 0, 0.8, 0.5)
                
                local cel = createMarker(miejscamagazynier[losuj][1], miejscamagazynier[losuj][2], miejscamagazynier[losuj][3]-1.0, "checkpoint", 1.0, 255, 0, 0)
                local blip = createBlipAttachedTo(cel, 41)
                
                addEventHandler("onClientMarkerHit", cel, function(el, md)
                    if not md or getElementType(el) ~= "player" then return end
                    if el ~= localPlayer then return end

                    if getPedOccupiedVehicle(el) then
                    exports["lr_noti"]:addNotification("* Nie mo?esz tego od?o?y? b?d?c w poje?dzie.")
                        return
                    end


                    destroyElement(blip)
                    setElementFrozen(el, true)
                    exports["lr_noti"]:addNotification("* K?adziesz skrzynie, odczekaj 5 sekund.")
                    setTimer(function()
                        setElementFrozen(el, false)
                        destroyElement(skrzynia)
                        destroyElement(cel)
                        setPedControlState(localPlayer, "walk", false)
                        setPedAnimation(localPlayer, false)
                        toggleControl("jump", true)
                        toggleControl("crouch",true)
                        toggleControl("sprint", true)
                        setElementData(el, "player:job", false)
                        if getElementData(el,"player:premium") then
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 35$.")
                        triggerServerEvent("givePlayerMoney", el, 25, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        else
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 8$.")
                        triggerServerEvent("givePlayerMoney", el, 8, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        end
                    end, 4000, 1)
                end)
            else
                exports["lr_noti"]:addNotification("* Posiadasz aktywn? prac?.")
            end
        elseif isMouseInPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) then
            if panel == false then cancelEvent() end
            removeEventHandler("onClientRender", root, paneldx)
            showCursor(false)
            panel = false
        end
    end
end
addEventHandler("onClientClick", root, klik)

fileDelete("praca_c.lua")


Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:07


NoKill1997

Online






Wiek: 29
Na forum: 3365 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 783

Respekt: 80,5

Spr?buj tak:
        elseif isMouseInPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) then
            if panel == false then cancelEvent() end
            removeEventHandler("onClientRender", root, paneldx)
            showCursor(false)
            panel = false
        end
    end
end
addEventHandler("onClientClick", getRootElement(), klik)


Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:14


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

NoKill1997, Nadal to samo

Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:23


NoKill1997

Online






Wiek: 29
Na forum: 3365 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 783

Respekt: 80,5

"PenkY." napisał/a:

NoKill1997, Nadal to samo
Jakie? b??dy w DB3?

Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:27


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Nie rozumiem za bardzo kodu, wyt?umacz co nie dzia?a i co chcia?by? uzyska? aby dzia?a?o bez zarzut?w.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:28


NoKill1997

Online






Wiek: 29
Na forum: 3365 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 783

Respekt: 80,5

"Kalizman" napisał/a:

Nie rozumiem za bardzo kodu, wyt?umacz co nie dzia?a i co chcia?by? uzyska? aby dzia?a?o bez zarzut?w.
Wydaje mi si?, ?e kolega Chce zrobi? funkcje zamkni?cia okna, kt?ra w pewnym stopniu dzia?a, lecz zabiera skrzyni? graczowi. (Chyba dobrze zrozumialem)

Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:30


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

NoKill1997, Tak dobrze napisa?e? oto mi w?asnie chodzi.

Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:32


NoKill1997

Online






Wiek: 29
Na forum: 3365 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 783

Respekt: 80,5

"PenkY." napisał/a:

NoKill1997, Tak dobrze napisa?e? oto mi w?asnie chodzi.
A spr?buj doda? now? funkcj?, odpowiadaj?c?, za zamkniecie GUI. Masz tu przyk?ad:
function Closegui(button, state)
    if panel and button == "left" and state == "down" then
           if cursorPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) then
                        removeEventHandler("onClientRender",root, paneldx)
                        panel = false
                        showCursor (false) 
         end
    end
end
addEventHandler("onClientClick", getRootElement(), Closegui)


Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:33


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Powinno dzia?a?. Gdy zamkniesz okno na czacie powinna wy?wietli? si? informacja.

local praca = createMarker(1407.70, 1143.37, 5102.70-1, "cylinder", 2.0, 255, 255, 255, 80)
local t=createElement("text")
setElementData(t,"name", "Praca Dorywcza: Pracownik Magazynu")
setElementPosition(t,1407.70, 1143.37, 5102.70)
setElementDimension(t, 0)
setElementInterior(t, 0)

local screenW, screenH = guiGetScreenSize()

panel = false

local miejscamagazynier = {
    {1410.87, 1156.97, 5102.70}, 
    {1406.32, 1170.66, 5102.70},
    {1406.32, 1170.66, 5102.70},
    {1410.95, 1178.06, 5102.70},
    {1406.38, 1178.06, 5102.70},
    {1418.81, 1185.87, 5102.70},
    {1413.73, 1181.31, 5102.70},
}

function paneldx()
        dxDrawImage(screenW * 0.2833, screenH * 0.2865, screenW * 0.4334, screenH * 0.4271, "images/bg2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) - 1, (screenW * 0.4414) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) - 1, (screenW * 0.4414) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) + 1, (screenW * 0.4414) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) + 1, (screenW * 0.4414) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) - 1, (screenW * 0.6501) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) - 1, (screenW * 0.6501) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) + 1, (screenW * 0.6501) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) + 1, (screenW * 0.6501) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) - 1, (screenW * 0.5469) - 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) - 1, (screenW * 0.5469) + 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) + 1, (screenW * 0.5469) - 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) + 1, (screenW * 0.5469) + 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", screenW * 0.4553, screenH * 0.3568, screenW * 0.5469, screenH * 0.3971, tocolor(197, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) - 1, (screenW * 0.5571) - 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) - 1, (screenW * 0.5571) + 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) + 1, (screenW * 0.5571) - 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) + 1, (screenW * 0.5571) + 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", screenW * 0.4414, screenH * 0.4102, screenW * 0.5571, screenH * 0.4466, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca polegaj?ca na roznoszeniu paczek z zywno?ci?.\nPo zaniesieniu paczki otrzymamy wynagrodzenie.", screenW * 0.4451, screenH * 0.4870, screenW * 0.5542, screenH * 0.5404, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit", praca, function(el, md)
    if el ~= localPlayer then return end
    panel = true
    addEventHandler("onClientRender", root, paneldx)
    showCursor(true)
end)



addEventHandler("onClientResourceStop", resourceRoot, function()
panel = false
 setElementData(localPlayer, "player:job", false)
end,false,"high")

function isMouseInPosition(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*screenW,cy*screenH
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function klik()
--    if panel == true then
        if isMouseInPosition(screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549) and panel == true then
            if not getElementData(localPlayer, "player:job") then
                if panel == false then cancelEvent() end
                local losuj = math.random(2, #miejscamagazynier)
                setElementData(localPlayer, "player:job", true)
                setPedControlState(localPlayer, "walk", true)
                toggleControl("crouch",false)
                toggleControl("jump", false)
                toggleControl("sprint", false)
                setPedAnimation ( localPlayer, "CARRY", "crry_prtial", 1,true )
                removeEventHandler("onClientRender", root, paneldx)
                showCursor(false)
                panel = false

                local skrzynia = createObject(1271, 0, 0, 0)
                attachElements ( skrzynia, localPlayer, 0, 0.8, 0.5)
                
                local cel = createMarker(miejscamagazynier[losuj][1], miejscamagazynier[losuj][2], miejscamagazynier[losuj][3]-1.0, "checkpoint", 1.0, 255, 0, 0)
                local blip = createBlipAttachedTo(cel, 41)
                
                addEventHandler("onClientMarkerHit", cel, function(el, md)
                    if not md or getElementType(el) ~= "player" then return end
                    if el ~= localPlayer then return end

                    if getPedOccupiedVehicle(el) then
                    exports["lr_noti"]:addNotification("* Nie mo?esz tego od?o?y? b?d?c w poje?dzie.")
                        return
                    end


                    destroyElement(blip)
                    setElementFrozen(el, true)
                    exports["lr_noti"]:addNotification("* K?adziesz skrzynie, odczekaj 5 sekund.")
                    setTimer(function()
                        setElementFrozen(el, false)
                        destroyElement(skrzynia)
                        destroyElement(cel)
                        setPedControlState(localPlayer, "walk", false)
                        setPedAnimation(localPlayer, false)
                        toggleControl("jump", true)
                        toggleControl("crouch",true)
                        toggleControl("sprint", true)
                        setElementData(el, "player:job", false)
                        if getElementData(el,"player:premium") then
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 35$.")
                        triggerServerEvent("givePlayerMoney", el, 25, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        else
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 8$.")
                        triggerServerEvent("givePlayerMoney", el, 8, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        end
                    end, 4000, 1)
                end)
            else
                exports["lr_noti"]:addNotification("* Posiadasz aktywn? prac?.")
            end
        elseif isMouseInPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) and panel == true then
            removeEventHandler("onClientRender", root, paneldx)
            showCursor(false)
            panel = false
            outputChatBox ("okno zamkni?te")
        end
--    end
end
addEventHandler("onClientClick", root, klik)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:38


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

Kalizman, Nic z tego zamyka sie okienko ale te? zabiera mi skrzynie.

Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:42


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Powinno ju? dzia?a?, je?eli nie b?dzie trzeba pobawi? si? z dzia?aniem pracy po naci?ni?ciu buttona.
local praca = createMarker(1407.70, 1143.37, 5102.70-1, "cylinder", 2.0, 255, 255, 255, 80)
local t=createElement("text")
setElementData(t,"name", "Praca Dorywcza: Pracownik Magazynu")
setElementPosition(t,1407.70, 1143.37, 5102.70)
setElementDimension(t, 0)
setElementInterior(t, 0)

local screenW, screenH = guiGetScreenSize()

panel = false

local miejscamagazynier = {
    {1410.87, 1156.97, 5102.70}, 
    {1406.32, 1170.66, 5102.70},
    {1406.32, 1170.66, 5102.70},
    {1410.95, 1178.06, 5102.70},
    {1406.38, 1178.06, 5102.70},
    {1418.81, 1185.87, 5102.70},
    {1413.73, 1181.31, 5102.70},
}

function paneldx()
        dxDrawImage(screenW * 0.2833, screenH * 0.2865, screenW * 0.4334, screenH * 0.4271, "images/bg2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) - 1, (screenW * 0.4414) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) - 1, (screenW * 0.4414) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) - 1, (screenH * 0.6029) + 1, (screenW * 0.4414) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", (screenW * 0.3587) + 1, (screenH * 0.6029) + 1, (screenW * 0.4414) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Rozpocznij", screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) - 1, (screenW * 0.6501) - 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) - 1, (screenW * 0.6501) + 1, (screenH * 0.6549) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) - 1, (screenH * 0.6094) + 1, (screenW * 0.6501) - 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", (screenW * 0.5688) + 1, (screenH * 0.6094) + 1, (screenW * 0.6501) + 1, (screenH * 0.6549) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Anuluj", screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) - 1, (screenW * 0.5469) - 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) - 1, (screenW * 0.5469) + 1, (screenH * 0.3971) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) - 1, (screenH * 0.3568) + 1, (screenW * 0.5469) - 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", (screenW * 0.4553) + 1, (screenH * 0.3568) + 1, (screenW * 0.5469) + 1, (screenH * 0.3971) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca Magazyniera", screenW * 0.4553, screenH * 0.3568, screenW * 0.5469, screenH * 0.3971, tocolor(197, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) - 1, (screenW * 0.5571) - 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) - 1, (screenW * 0.5571) + 1, (screenH * 0.4466) - 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) - 1, (screenH * 0.4102) + 1, (screenW * 0.5571) - 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", (screenW * 0.4414) + 1, (screenH * 0.4102) + 1, (screenW * 0.5571) + 1, (screenH * 0.4466) + 1, tocolor(0, 0, 0, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Opis Pracy", screenW * 0.4414, screenH * 0.4102, screenW * 0.5571, screenH * 0.4466, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText("Praca polegaj?ca na roznoszeniu paczek z zywno?ci?.\nPo zaniesieniu paczki otrzymamy wynagrodzenie.", screenW * 0.4451, screenH * 0.4870, screenW * 0.5542, screenH * 0.5404, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit", praca, function(el, md)
    if el ~= localPlayer then return end
    panel = true
    addEventHandler("onClientRender", root, paneldx)
    showCursor(true)
end)



addEventHandler("onClientResourceStop", resourceRoot, function()
panel = false
 setElementData(localPlayer, "player:job", false)
end,false,"high")

function isMouseInPosition(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*screenW,cy*screenH
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function klik()
--    if panel == true then
        if isMouseInPosition(screenW * 0.3587, screenH * 0.6029, screenW * 0.4414, screenH * 0.6549) and panel == true then
            if not getElementData(localPlayer, "player:job") then
                local losuj = math.random(2, #miejscamagazynier)
                setElementData(localPlayer, "player:job", true)
                setPedControlState(localPlayer, "walk", true)
                toggleControl("crouch",false)
                toggleControl("jump", false)
                toggleControl("sprint", false)
                setPedAnimation ( localPlayer, "CARRY", "crry_prtial", 1,true )
                removeEventHandler("onClientRender", root, paneldx)
                showCursor(false)
                panel = false

                local skrzynia = createObject(1271, 0, 0, 0)
                attachElements ( skrzynia, localPlayer, 0, 0.8, 0.5)
                
                local cel = createMarker(miejscamagazynier[losuj][1], miejscamagazynier[losuj][2], miejscamagazynier[losuj][3]-1.0, "checkpoint", 1.0, 255, 0, 0)
                local blip = createBlipAttachedTo(cel, 41)
                
                addEventHandler("onClientMarkerHit", cel, function(el, md)
                    if not md or getElementType(el) ~= "player" then return end
                    if el ~= localPlayer then return end

                    if getPedOccupiedVehicle(el) then
                    exports["lr_noti"]:addNotification("* Nie mo?esz tego od?o?y? b?d?c w poje?dzie.")
                        return
                    end


                    destroyElement(blip)
                    setElementFrozen(el, true)
                    exports["lr_noti"]:addNotification("* K?adziesz skrzynie, odczekaj 5 sekund.")
                    setTimer(function()
                        setElementFrozen(el, false)
                        destroyElement(skrzynia)
                        destroyElement(cel)
                        setPedControlState(localPlayer, "walk", false)
                        setPedAnimation(localPlayer, false)
                        toggleControl("jump", true)
                        toggleControl("crouch",true)
                        toggleControl("sprint", true)
                        setElementData(el, "player:job", false)
                        if getElementData(el,"player:premium") then
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 35$.")
                        triggerServerEvent("givePlayerMoney", el, 25, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        else
                        exports["lr_noti"]:addNotification("* Od?o?y?e?(a?) skrzyni?. Za od?o?enie skrzynii, otrzymujesz 8$.")
                        triggerServerEvent("givePlayerMoney", el, 8, 0)
                        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
                        end
                    end, 4000, 1)
                end)
            else
                exports["lr_noti"]:addNotification("* Posiadasz aktywn? prac?.")
            end
        elseif isMouseInPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) and panel == true then
            removeEventHandler("onClientRender", root, paneldx)
            showCursor(false)
            panel = false
            outputChatBox ("okno zamkni?te")
        end
--    end
end
addEventHandler("onClientClick", root, klik)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 18:46


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

Kalizman, No niestety to samo...

Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 19:30


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Zr?b Sobie osobny przycisk na 'Anuluj',

addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseInPosition(screenW * 0.5688, screenH * 0.6094, screenW * 0.6501, screenH * 0.6549) then
        showCursor(false)
        removeEventHandler("onClientRender", root, paneldx)
        panel = false
        end
    end
end)


Jakie? b??dy w /debugscript 3 po naci?ni?ciu w przycisk?

Podpis
As-salamu alaykum
Ostatnio zmieniony przez Ciastuuś 2018-04-01, 20:10, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 20:09


PenkY

Mapper






Wiek: 24
Na forum: 3606 dni
Posty: 223
Nick w MP: penky

Piwa: 2225

Respekt: 472
Respekt: 472

Ciastuu?, Niestety ta opcja te? nie dzia?a.

Podpis
Discord: p3nky.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-01, 20:10


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Jakie? b??dy po naci?ni?ciu w przycisk? /debugscript 3

Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Tagi: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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