Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Autor: Malentas
- ]]
- local sx, sy = guiGetScreenSize()
- local okno1 = false
- local ulepszenia = false
- local pracodawca = createPed(27, 2076.60, -2045.03, 13.59, 180)
- setElementData(pracodawca, "name", "Pracodawca")
- setElementDimension(pracodawca, 0)
- setElementFrozen(pracodawca, true)
- local rozpoczecie = createMarker(2076.85, -2047.22, 13.59-.95, "cylinder", 1, 255, 255, 255)
- setElementData(rozpoczecie, "praca", true)
- setElementDimension(rozpoczecie, 0)
- addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
- if gracz ~= localPlayer then return end
- if getPedOccupiedVehicle(localPlayer) then return end
- if getElementData(localPlayer, "punkty") < 25 then exports["np-notyfikacje"]:noti("Nie posiadasz 25 punktów reputacji!", "error") return end
- if getElementData(localPlayer, "pracuje") then
- if getElementData(localPlayer, "pracuje") ~= "smieciarki" then exports["np-notyfikacje"]:noti("Posiadasz inną aktywną prace!", "error") return end
- end
- addEventHandler("onClientRender", root, guistart)
- okno1 = true
- showCursor(true)
- triggerServerEvent("pokazTopke:smieciarki:source", localPlayer)
- end)
- local font = dxCreateFont("cz.ttf", 10)
- local font2 = dxCreateFont("cz.ttf", 12)
- local font = dxCreateFont("cz.ttf", 10)
- local font2 = dxCreateFont("cz.ttf", 12)
- local pracownicy = { }
- local listaulepszen = {
- {"Sprint", "Dzięki temu ulepszeniu możesz biegać z koszem", 300, "dolar.png"},
- {"Szybsze ładowanie", "Dzięki temu ulepszeniu będziesz szybciej ładował śmieci", 500, "dolar.png"},
- {"Zarobek +5%", "Dzięki temu ulepszeniu zarabiasz więcej o 5%", 700, "dolar.png"},
- {"Pojemniejsza Śmieciarka", "Dzięki temu ulepszeniu twoja smieciarka zmiesci więcej koszy", 500, "dolar.png"},
- }
- function guistart()
- dxDrawImage(scale_x(402), scale_y(251), scale_x(637), scale_y(399), ":np-gui/grafiki/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- if ulepszenia == false then
- local punkty = getElementData(localPlayer, "spunkty") or 0
- local zlecenia = getElementData(localPlayer, "szlecenia") or 0
- shadowText("Praca zbieracza smieci", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- --shadowText("Wymagania:\nBRAK", scale_x(401), scale_y(295), scale_x(719), scale_y(449), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- shadowText("Wykonane zlecenia: "..zlecenia.."\nPunkty: "..punkty.."", scale_x(402), scale_y(510), scale_x(719), scale_y(646), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- shadowText("Top pracownicy:", scale_x(719), scale_y(295), scale_x(1036), scale_y(329), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- dxDrawImage(scale_x(415), scale_y(310), scale_x(304), scale_y(175), ":np-magazynier/grafiki/bg2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- shadowText("Wymagania: Kategoria C\n25 Punktów reputacji", scale_x(415), scale_y(500), scale_x(719), scale_y(548), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- if mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) then
- dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- else
- dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) then
- dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- else
- dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- if getElementData(localPlayer, "pracuje") == "smieciarki" then
- shadowText("Zakończ prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- else
- shadowText("Rozpocznij prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- end
- shadowText("Ulepszenia", scale_x(888), scale_y(592), scale_x(1028), scale_y(637), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- dxDrawImage(scale_x(1010), scale_y(261), scale_x(16), scale_y(16), ":guieditor/images/cross.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- shadowText("Nickname:", scale_x(729), scale_y(329), scale_x(880), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
- shadowText("Wykonane zlecenia:", scale_x(877), scale_y(329), scale_x(1028), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
- for i, v in ipairs(pracownicy) do
- local dodatekY = (scale_y(37))*(i-1)
- local dodatekY2 = (scale_y(74))*(i-1)
- dxDrawRectangle(scale_x(729), scale_y(363) + dodatekY, scale_x(299), scale_y(35), tocolor(0, 0, 0, 120), false)
- shadowText(v.nick, scale_x(729), scale_y(364) + dodatekY2, scale_x(877), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- shadowText(v.liczba, scale_x(880), scale_y(364) + dodatekY2, scale_x(1028), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- end
- else
- local punkty = getElementData(localPlayer, "spunkty") or 0
- shadowText("Kupno ulepszen", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- dxDrawImage(scale_x(1011), scale_y(262), scale_x(16), scale_y(16), ":np-gui/grafiki/cofnij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- dxDrawText("Posiadasz: "..punkty.." punktów", scale_x(402), scale_y(582), scale_x(1037), scale_y(648), tocolor(0, 255, 0, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- for i, v in ipairs(listaulepszen) do
- local dodatekY = (scale_y(72))*(i-1)
- local dodatekY2 = (scale_y(144))*(i-1)
- dxDrawRectangle(scale_x(417), scale_y(297)+dodatekY, scale_x(610), scale_y(70), tocolor(0, 0, 0, 120), false)
- dxDrawImage(scale_x(432), scale_y(307)+dodatekY, scale_x(50), scale_y(50), ":np-magazynier/grafiki/"..v[4].."", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- shadowText(v[1], scale_x(501), scale_y(297)+dodatekY2, scale_x(874), scale_y(332), tocolor(255, 255, 255, 255), 1.00, font2, "left", "center", false, false, false, false, false)
- shadowText(v[2], scale_x(501), scale_y(332)+dodatekY2, scale_x(874), scale_y(367), tocolor(255, 255, 255, 255), 1.00, font, "left", "center", false, false, false, false, false)
- if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) then
- dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- else
- dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- shadowText("Zakup", scale_x(904), scale_y(312)+dodatekY2, scale_x(1017), scale_y(350), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- shadowText("Cena: "..v[3].."p", scale_x(781), scale_y(297)+dodatekY2, scale_x(894), scale_y(335), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
- end
- end
- end
- addEventHandler("onClientClick", root, function(btn, state)
- if btn == "left" and state == "down" then
- if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
- if getElementData(localPlayer, "pracuje") == "smieciarki" then
- zakonczprace()
- else
- rozpocznijprace()
- end
- elseif mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
- ulepszenia = true
- elseif mysz(scale_x(1010), scale_y(261), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == false then
- removeEventHandler("onClientRender", root, guistart)
- okno1 = false
- showCursor(false)
- elseif mysz(scale_x(1011), scale_y(262), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == true then
- ulepszenia = false
- end
- for i, v in ipairs(listaulepszen) do
- local dodatekY = (scale_y(72))*(i-1)
- if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) and okno1 == true and ulepszenia == true then
- local punkty = getElementData(localPlayer, "spunkty") or 0
- if punkty < tonumber(v[3]) then exports["np-notyfikacje"]:noti("Posiadasz za mało punktów by zakupić to ulepszenie", "error") return end
- if v[1] == "Szybsze ładowanie" then
- if getElementData(localPlayer, "smieciarki:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz już to ulepszenie", "error") return end
- setElementData(localPlayer, "smieciarki:ulepszenie2", 1)
- elseif v[1] == "Sprint" then
- if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz już to ulepszenie", "error") return end
- setElementData(localPlayer, "smieciarki:ulepszenie1", 1)
- elseif v[1] == "Zarobek +5%" then
- if getElementData(localPlayer, "smieciarki:ulepszenie3") == 1 then exports["np-notyfikacje"]:noti("Posiadasz już to ulepszenie", "error") return end
- setElementData(localPlayer, "smieciarki:ulepszenie3", 1)
- elseif v[1] == "Pojemniejsza Śmieciarka" then
- if getElementData(localPlayer, "smieciarki:ulepszenie4") == 1 then exports["np-notyfikacje"]:noti("Posiadasz już to ulepszenie", "error") return end
- setElementData(localPlayer, "smieciarki:ulepszenie4", 1)
- end
- exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
- setElementData(localPlayer, "spunkty", punkty-tonumber(v[3]))
- end
- end
- end
- end)
- addEvent("pokazTopke:smieciarki:client", true)
- addEventHandler("pokazTopke:smieciarki:client", root, function(tabelka)
- pracownicy = tabelka
- end)
- --praca
- local kosz = {}
- local kmarker = {}
- local kblip = {}
- local liczbakoszy = 5
- local max = 20
- local czas = 4000
- --Jefferson
- local miejsce1 = {
- {2134.10, -1375.30, 23.98},
- {2190.74, -1375.72, 23.99},
- {2138.45, -1406.00, 23.99},
- {2138.42, -1411.33, 23.99},
- {2138.24, -1452.13, 23.98},
- }
- --Ganton
- local miejsce2 = {
- {2498.26, -1686.70, 13.48},
- {2505.73, -1654.07, 13.59},
- {2490.30, -1647.08, 14.08},
- {2468.72, -1648.26, 13.47},
- {2471.70, -1684.67, 13.51},
- }
- --Idlewood
- local miejsce3 = {
- {2067.43, -1733.55, 13.88},
- {2065.64, -1701.91, 14.15},
- {2072.29, -1653.71, 13.55},
- {2013.18, -1653.42, 13.55},
- {2012.33, -1629.07, 13.55},
- }
- --Glen Park
- local miejsce4 = {
- {1937.65, -1126.89, 25.42},
- {1903.61, -1116.77, 25.66},
- {1939.73, -1062.33, 24.42},
- {2025.53, -1056.79, 24.69},
- {1858.05, -1159.61, 23.86},
- }
- --Market
- local miejsce5 = {
- {1184.90, -1257.63, 15.18},
- {1185.32, -1257.91, 18.90},
- {1181.94, -1230.21, 18.55},
- {1185.18, -1230.07, 22.14},
- {1134.85, -1211.10, 18.55},
- }
- --Marina
- local miejsce6 = {
- {819.46, -1495.79, 13.59},
- {867.32, -1509.56, 13.55},
- {843.90, -1481.20, 13.60},
- {785.13, -1460.96, 13.55},
- {811.44, -1553.44, 13.59},
- }
- --Richman
- local miejsce7 = {
- {298.88, -1335.26, 53.44},
- {253.61, -1364.64, 53.11},
- {250.39, -1271.32, 73.84},
- {254.48, -1219.24, 75.31},
- {280.82, -1259.10, 73.92},
- }
- --Las Colinas
- local miejsce8 = {
- {2528.09, -1036.69, 69.58},
- {2501.15, -1062.82, 70.16},
- {2488.55, -1013.44, 65.40},
- {2629.20, -1071.08, 69.62},
- {2556.71, -956.12, 82.73},
- }
- function rozpocznijprace()
- if getElementData(localPlayer, "prawko_c") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat. c", "error") return end
- setElementData(localPlayer, "pracuje", "smieciarki")
- triggerServerEvent("skin:praca", localPlayer, 260)
- triggerServerEvent("dajSmieciarke:smieciarki", localPlayer)
- removeEventHandler("onClientRender", root, guistart)
- okno1 = false
- showCursor(false)
- stowrzKosze()
- wysypisko = createMarker(2080.57, -2000.48, 12.65, "cylinder", 4.5, 0, 255, 0)
- bwysypisko = createBlipAttachedTo(wysypisko, 11)
- setElementData(localPlayer, "liczbakoszy", 0)
- addEventHandler("onClientMarkerHit", wysypisko, function(gracz)
- if gracz ~= localPlayer then return end
- local ile = getElementData(localPlayer, "liczbakoszy")
- if ile <= 1 then exports["np-notyfikacje"]:noti("Aby wyładować smieciarke musisz załadować więcej niż 1 kosz!", "error") return end
- local zarobek = 45*ile
- if getElementData(localPlayer, "premium") then
- zarobek = zarobek+(zarobek*0.2)
- end
- if getElementData(localPlayer, "smieciarki:ulepszenie3") == 1 then
- zarobek = zarobek+(zarobek*0.05)
- end
- setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek)
- exports["np-notyfikacje"]:noti("Wyładowałeś smieciarke zarabiasz: "..zarobek.." PLN")
- setElementData(localPlayer, "liczbakoszy", 0)
- setElementData(getPedOccupiedVehicle(localPlayer), "nametag", "")
- end)
- end
- function stowrzKosze()
- local los = math.random(1, 8)
- if los == 1 then
- trasa = miejsce1
- elseif los == 2 then
- trasa = miejsce2
- elseif los == 3 then
- trasa = miejsce3
- elseif los == 4 then
- trasa = miejsce4
- elseif los == 5 then
- trasa = miejsce5
- elseif los == 6 then
- trasa = miejsce6
- elseif los == 7 then
- trasa = miejsce7
- elseif los == 8 then
- trasa = miejsce8
- end
- liczbakoszy = 5
- for i, v in ipairs(trasa) do
- kmarker[i] = createMarker(v[1], v[2], v[3], "corona", 1.2, 0,0,0,0)
- kosz[i] = createObject(1339, v[1], v[2], v[3]-0.35)
- kblip[i] = createBlipAttachedTo(kosz[i], 41)
- setElementData(kmarker[i], "kosz", kosz[i])
- setElementData(kmarker[i], "blip", kblip[i])
- setElementCollisionsEnabled(kosz[i], false)
- addEventHandler("onClientMarkerHit", kmarker[i], function(gracz)
- if gracz ~= localPlayer then return end
- if getPedOccupiedVehicle(localPlayer) then return end
- if getElementData(localPlayer, "kosz") then return end
- --destroyElement(getElementData(source, "kosz"))
- attachElements(getElementData(source, "kosz"), localPlayer, 0, 0.7, -0.4, 0, 0, 180)
- setElementData(localPlayer, "kosz", getElementData(source, "kosz"))
- destroyElement(getElementData(source, "blip"))
- destroyElement(source)
- if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then
- toggleControl("walk", true)
- setControlState(localPlayer, "walk", false)
- else
- toggleControl("walk", false)
- setControlState(localPlayer, "walk", true)
- end
- setPedWalkingStyle(localPlayer, 66)
- end)
- end
- end
- addEventHandler("onClientVehicleExit", root, function(gracz, seat)
- if gracz ~= localPlayer then return end
- if getElementData(localPlayer, "pracuje") == "smieciarki" then
- local x,y,z = getElementPosition(source)
- pmarker = createMarker(x,y,z, "corona", 1, 0,0,0,0)
- setElementData(pmarker, "pojazd", source)
- attachElements(pmarker, source, 0.121, -4.047, -0.641)
- addEventHandler("onClientMarkerHit", pmarker, function(gracz)
- if gracz ~= localPlayer then return end
- if getElementData(localPlayer, "kosz") then
- local ile = getElementData(localPlayer, "liczbakoszy") or 0
- if getElementData(localPlayer, "smieciarki:ulepszenie4") == 1 then
- max = 30
- else
- max = 20
- end
- if ile == max then exports["np-notyfikacje"]:noti("Twoja Śmieciarka jest już pełna! Jedź ją wyładować.") return end
- exports["np-notyfikacje"]:noti("Trwa wypróżnianie kosza...")
- setElementFrozen(localPlayer, true)
- if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then
- czas = 2000
- else
- czas = 4000
- end
- setTimer(function()
- local ile = getElementData(localPlayer, "liczbakoszy") or 0
- setElementData(localPlayer, "liczbakoszy", ile+1)
- setElementFrozen(localPlayer, false)
- exports["np-notyfikacje"]:noti("Kosz został wypróżniony")
- destroyElement(getElementData(localPlayer, "kosz"))
- local x,y,z = getElementPosition(pmarker)
- local rx,ry,rz = getElementRotation(getElementData(pmarker, "pojazd"))
- toggleControl("walk", true)
- setControlState(localPlayer, "walk", false)
- setPedWalkingStyle(localPlayer, 0)
- setElementData(localPlayer, "kosz", false)
- liczbakoszy = liczbakoszy-1
- local pkt = getElementData(localPlayer, "spunkty") or 0
- setElementData(localPlayer, "spunkty", pkt+math.random(0, 2))
- for i, v in ipairs(getElementsByType("vehicle")) do
- if getElementData(v, "kierowca:smieciarki") and getElementData(v, "kierowca:smieciarki") == getElementData(localPlayer, "dbid") then
- setElementData(v, "nametag", "Zapełnienie "..getElementData(localPlayer, "liczbakoszy").."/"..max)
- end
- end
- if liczbakoszy == 0 then
- stowrzKosze()
- triggerServerEvent("daj:szlecenia", localPlayer, localPlayer)
- end
- end, czas, 1)
- end
- end)
- end
- end)
- addEventHandler("onClientVehicleEnter", root, function(gracz, seat)
- if gracz ~= localPlayer then return end
- if getElementData(localPlayer, "pracuje") == "smieciarki" then
- if isElement(pmarker) then
- destroyElement(pmarker)
- end
- end
- end)
- function zakonczprace()
- setElementData(localPlayer, "pracuje", false)
- triggerServerEvent("skin:praca", localPlayer, getElementData(localPlayer, "skin"))
- triggerServerEvent("usunSmieciarke:smieciarki", localPlayer)
- setElementData(localPlayer, "liczbakoszy", 0)
- for i, v in ipairs(kmarker) do
- if isElement(v) then
- destroyElement(v)
- end
- end
- for i, v in ipairs(kblip) do
- if isElement(v) then
- destroyElement(v)
- end
- end
- for i, v in ipairs(kosz) do
- if isElement(v) then
- destroyElement(v)
- end
- end
- if isElement(pmarker) then
- destroyElement(pmarker)
- end
- if isElement(wysypisko) then
- destroyElement(wysypisko)
- end
- if isElement(bwysypisko) then
- destroyElement(bwysypisko)
- end
- end
- --opcje
- function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
- dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
- dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
- end
- function mysz(psx,psy,pssx,pssy,abx,aby)
- if not isCursorShowing() then return end
- cx,cy=getCursorPosition()
- cx,cy=cx*sx,cy*sy
- 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 scale_x(value)
- local result = (value / 1440) * sx
- return result
- end
- function scale_y(value)
- local result = (value / 900) * sy
- return result
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement