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

Wysłany: 2018-08-29, 21:01


BabyKonik







Wiek: 36
Na forum: 3294 dni
Posty: 9
Nick w MP: BabyKonik

Piwa: 1

Respekt: 50

Witam, przychodze z takim problemem, poniewa? mam gm z new place kiedy chce rozpocz?? prace kosiarek to ona si? nie respi. Prosze o pomoc ! Stawiam :piwo:



Debugscript
https://imgur.com/a/Q82G8Vc

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
swierzak18
Wysłany: 2018-08-29, 21:04


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Nie ma nast?puj?cych event?w:
- usunKosiarke:kosiarki,
- dajKosiarke:kosiarki,
- pokazTopke:kosiarki.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
BabyKonik
Wysłany: 2018-08-29, 21:05


BabyKonik







Wiek: 36
Na forum: 3294 dni
Posty: 9
Nick w MP: BabyKonik

Piwa: 1

Respekt: 50

Jak mam je doda? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 21:10


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

Nie wiem. Nie pisa?em kodu b?d? nie czyta trigger?w... - nie wiem bo nie poda?e? kodu a moja magiczna kula zepsu?a si?...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 21:14


BabyKonik







Wiek: 36
Na forum: 3294 dni
Posty: 9
Nick w MP: BabyKonik

Piwa: 1

Respekt: 50

c.lua

--[[
    Autor: Malentas
]]
 
local sx, sy = guiGetScreenSize()
local okno1 = false
local ulepszenia = false

local dostal_powiadomienie = false;
 
local pracodawca = createPed(16, 773.27, -1305.94, 13.56, 0)
setElementData(pracodawca, "name", "Pracodawca")
setElementDimension(pracodawca, 0)
setElementFrozen(pracodawca, true)
local rozpoczecie = createMarker(773.18, -1304.66, 13.56-.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, "pracuje") then
        if getElementData(localPlayer, "pracuje") ~= "kosiarki" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
    end
    addEventHandler("onClientRender", root, guistart)
    okno1 = true
    showCursor(true)
    triggerServerEvent("pokazTopke:kosiarki: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 = {
    {"Pojemniejsza kosiarka", "Dzi?ki temu twoja kosiarka ma wieksz? pojemno?? kosza", 500, "dolar.png"},
    {"Zarobek +5%", "Dzi?ki temu ulepszeniu zarabiasz wi?cej o 5%", 700, "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, "kospunkty") or 0
       local zlecenia = getElementData(localPlayer, "koszlecenia") or 0
        shadowText("Praca piel?gnowania trawnika", 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/bg4.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Wymagania: brak", 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") == "kosiarki" 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("Skoszone pola:", 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, "kospunkty") 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") == "kosiarki" 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, "kospunkty") 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] == "Pojemniejsza kosiarka" then
                if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "kosiarki:ulepszenie1", 1)
            elseif v[1] == "Zarobek +5%" then
                if getElementData(localPlayer, "kosiarki:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "kosiarki:ulepszenie2", 1)
            end
            exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
            setElementData(localPlayer, "kospunkty", punkty-tonumber(v[3]))
        end
    end
  end
end)
 
addEvent("pokazTopke:kosiarki:client", true)
addEventHandler("pokazTopke:kosiarki:client", root, function(tabelka)
  pracownicy = tabelka
end)
 
 
-- praca
 
 
 
local trawy = 0
 
function rozpocznijprace()
    setElementData(localPlayer, "pracuje", "kosiarki")
    triggerServerEvent("dajKosiarke:kosiarki", localPlayer)
    losuj()
    zaladunek = 0
    removeEventHandler("onClientRender", root, guistart)
    okno1 = false
    showCursor(false)
    wyladunek = createMarker(735.11, -1303.03, 13.57-.95, "cylinder", 2, 25, 131)
    addEventHandler("onClientMarkerHit", wyladunek, function(gracz)
        if gracz ~= localPlayer then return end
        if not getPedOccupiedVehicle(localPlayer) then return end
        if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then
            ilosc = 500
        else
            ilosc = 250
        end
        if zaladunek ~= ilosc then return end
        if ilosc == 250 then
            zarobek =  math.random(400, 600)
        elseif ilosc == 500 then
            zarobek =  math.random(100, 900)
        end
        if getElementData(localPlayer, "premium") then
            zarobek = zarobek + zarobek*1
        end
        if getElementData(localPlayer, "kosiarki:ulepszenie1") == 2 then
            zarobek = zarobek + zarobek*0.05
        end
        local nagroda = math.random(1, 5)
        if tonumber(nagroda) == 5 then
            local los2 = math.random(1, 3)
            if getElementData(localPlayer, "premium") then
                los2 = math.random(2, 6)
            end
            setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
            exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
        end
        local zarobek2 = string.format("%1d", zarobek)
        setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
        exports["np-notyfikacje"]:noti("Wy?adowa?e? trawe zarabiasz "..zarobek2.." PLN")
        dostal_powiadomienie = false;
        zaladunek = 0
        local los = math.random(1,3)
        local pkt = getElementData(localPlayer, "kospunkty") or 0
        setElementData(localPlayer, "kospunkty", pkt+los)
    end)
end
 
function zakonczprace()
    setElementData(localPlayer, "pracuje", false)
    triggerServerEvent("usunKosiarke:kosiarki", localPlayer)
    for i, v in ipairs(getElementsByType("marker")) do
        if getElementData(v, "element") then
            destroyElement(getElementData(v, "element"))
            destroyElement(v)
        end
    end
    destroyElement(wyladunek)
end
 
 
local miejsca = {
    {773.27, -1295.40, 13.56},
    {752.78, -1295.84, 13.57},
    {752.78, -1253.25, 13.56},
    {774.34, -1253.13, 13.56},
}
 
function losuj()
    trawy = 0
    local los = miejsca[math.random(#miejsca)]
    for i = 1, 30 do
        local add = i
        obj = createObject(818, los[1], los[2]+add, los[3]-2)
        setObjectScale(obj, 0.5)
        marker = createMarker(los[1], los[2]+add, los[3], "corona", 0.8, 255, 255, 255, 0)
        setElementData(marker, "element", obj)
        trawy = trawy + 1
    end
    for i = 1, 14 do
        local add = i
        obj = createObject(818, los[1]-add, los[2], los[3]-2)
        setObjectScale(obj, 0.5)
        marker = createMarker(los[1]-add, los[2], los[3], "corona", 0.8, 255, 255, 255, 0)
        setElementData(marker, "element", obj)
        trawy = trawy + 1
        for i2 = 1, 30 do
            local add2 = i2
            obj = createObject(818, los[1]-add, los[2]+add2, los[3]-2)
            setObjectScale(obj, 0.5)
            marker = createMarker(los[1]-add, los[2]+add2, los[3], "corona", 0.8, 255, 255, 255, 0)
            setElementData(marker, "element", obj)
            trawy = trawy + 1
        end
    end
    addEventHandler("onClientMarkerHit", root, function(gracz)
        if gracz ~= localPlayer then return end
        if not source then return end
        if not getElementData(source, "element") then return end
        if not getPedOccupiedVehicle(gracz) then return end
        if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then
            ilosc = 350
        else
            ilosc = 250
        end
        if zaladunek == ilosc then 
            if not dostal_powiadomienie then
                exports["np-notyfikacje"]:noti("Twoja kosiarka jest pe?na musisz j? wy?adowa?", "error");
                dostal_powiadomienie = true;
            end
            return;
        end
        destroyElement(getElementData(source, "element"))
        destroyElement(source)
        trawy = trawy - 1
        zaladunek = zaladunek + 1
        if trawy == 0 then
            for i, v in ipairs(getElementsByType("marker")) do
                if getElementData(v, "element") then
                    destroyElement(getElementData(v, "element"))
                    destroyElement(v)
                end
            end
            marker = false
            losuj()
            triggerServerEvent("daj:koszlecenia", localPlayer, localPlayer)
        end
    end)
end
 
strefa = createColCuboid(722.99, -1308.70, 13.57-1, 60, 100, 10)

addEventHandler("onClientColShapeLeave", strefa, function(gracz)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "pracuje") == "kosiarki" then
        zakonczprace()
    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




s.lua

function pokazpracownikow()
    local q = exports['np-mysql']:wykonaj("SELECT * from konta order by koszlecenia desc")
    local topka = {}

    for i = 1,5 do
        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["koszlecenia"]})
    end

    return topka
end


tablica = pokazpracownikow()

setTimer(function()
    tablica = pokazpracownikow()
end, 600000, 0)

addEvent("pokazTopke:kosiarki:source", true)
addEventHandler("pokazTopke:kosiarki:source", root, function()
    triggerClientEvent(source, "pokazTopke:kosiarki:client", source, tablica)
end)

kosiarka = { }

addEvent("dajKosiarke:kosiarki", true)
addEventHandler("dajKosiarke:kosiarki", root, function()
    kosiarka[source] = createVehicle(572, 770.50, -1306.18, 13.14, 0.9, 0.0, 3.4)
    warpPedIntoVehicle(source, kosiarka[source])
    triggerClientEvent(root, "ghost:vehicle", root, kosiarka[source])
    setElementData(kosiarka[source], "kierowca:kosiarki", getElementData(source, "dbid"))
end)

addEvent("usunKosiarke:kosiarki", true)
addEventHandler("usunKosiarke:kosiarki", root, function()
    if isElement(kosiarka[client]) then
        destroyElement(kosiarka[client])
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if isElement(kosiarka[source]) then
        destroyElement(kosiarka[source])
    end
end)

addEvent("daj:koszlecenia", true)
addEventHandler("daj:koszlecenia", root, function(player)
    local dbid = getElementData(player, "dbid")
    local ilosc = getElementData(player, "koszlecenia") or 0
    local q = exports['np-mysql']:wykonaj("UPDATE konta SET koszlecenia=koszlecenia+1 where dbid=?", dbid)
    setElementData(player, "koszlecenia", ilosc+1)
end)

addEventHandler("onVehicleStartEnter", root, function(gracz, seat)
    if seat ~= 0 then return end
    if getElementData(gracz, "pracuje") == "kosiarki" then
        if getElementData(source, "id") then
            cancelEvent()
        end
        if getElementData(source, "kierowca:kosiarki") ~= getElementData(gracz, "dbid") then
            cancelEvent()
        end
    else
        if getElementData(source, "kierowca:kosiarki") then
            cancelEvent()
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 08:45


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

Musisz mie? odpalone
np-mysql
np-notyfikacje
np-gui
Skrypt na markery
+ by? mo?e co? jeszcze co wywo?uje
- usunKosiarke:kosiarki,
- dajKosiarke:kosiarki,
- pokazTopke:kosiarki.

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
BabyKonik
Wysłany: 2018-08-30, 10:18


BabyKonik







Wiek: 36
Na forum: 3294 dni
Posty: 9
Nick w MP: BabyKonik

Piwa: 1

Respekt: 50

np-pizza ma te triggery ale nawet jak jest odpalone to nie dzia?a

[ Dodano: 2018-08-30, 10:24 ]
c.lua np-pizza
--[[
    Autor: Malentas
]]
 
local sx, sy = guiGetScreenSize()
local okno1 = false
local niesie = false
local ulepszenia = false
local alpha = 250
local ile = 0
local trasa = " "
 
local oddanie = {}
local oddanieped = {}
local boddanie = {}
 

local rozpoczecie = createMarker(2105.49, -1806.45, 13.55, "cylinder", 1, 255, 255, 255)
setElementData(rozpoczecie, "praca", true)
setElementDimension(rozpoczecie, 0)
 
 
addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "block:prawko") then exports["np-notyfikacje"]:noti("Posiadasz zabrane prawo jazdy kat. A, B, C", "error") return end
    if getElementData(localPlayer, "pracuje") then
        if getElementData(localPlayer, "pracuje") ~= "pizza" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
    end
    addEventHandler("onClientRender", root, guistart)
    okno1 = true
    showCursor(true)
    triggerServerEvent("pokazTopke:pizza:source", localPlayer)
end)
 
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
 
local pracownicy = { }
 
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, "kpunkty") or 0
       local zlecenia = getElementData(localPlayer, "kzlecenia") or 0
        shadowText("Praca dostawcy pizzy", 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/bg3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Wymagania: Kategoria B\n10 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") == "pizza" 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, "kpunkty") 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") == "pizza" 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, "kpunkty") 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] == "Szybszy pojazd" then
                if getElementData(localPlayer, "pizza:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "pizza:ulepszenie2", 1)
            elseif v[1] == "Sprint" then
                if getElementData(localPlayer, "pizza:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "pizza:ulepszenie1", 1)
            elseif v[1] == "Zarobek +5%" then
                if getElementData(localPlayer, "pizza:ulepszenie3") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "pizza:ulepszenie3", 1)
            end
            exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
            setElementData(localPlayer, "kpunkty", punkty-tonumber(v[3]))
        end
    end
  end
end)
 
addEvent("pokazTopke:pizza:client", true)
addEventHandler("pokazTopke:pizza:client", root, function(tabelka)
  pracownicy = tabelka
end)
 
-- praca
 
local miejsca1 = {
    {1667.07, -2108.30, 13.89, 185, 5},
    {1673.64, -2122.38, 14.15, 0, 0},
    {1684.41, -2098.16, 13.83, 90, 280},
    {1695.71, -2125.83, 13.81, 0, 35},
    {1707.99, -2101.86, 13.55, 180, 105},
}

local miejsca2 = {
    {2275.85, -1785.88, 13.55, 90, 270},
    {2247.07, -1795.70, 13.55, 130, 240},
    {2290.14, -1795.71, 13.55, 270, 90},
    {2307.68, -1785.74, 13.56, 90, 270},
    {2292.04, -1758.31, 13.55, 180, 0},
}

local miejsca3 = {
    {2018.05, -1629.92, 14.04, 120, 300},
    {2016.54, -1641.74, 14.11, 310, 180},
    {2013.58, -1656.48, 14.14, 180, 0},
    {2018.24, -1703.17, 14.23, 190, 190},
    {2016.20, -1717.29, 14.13, 230, 50},
}

function rozpocznijprace()
    if getElementData(localPlayer, "punkty") < 10 then exports["np-notyfikacje"]:noti("Nie posiadasz 10 punkt?w reputacji!", "error") return end
    if getElementData(localPlayer, "prawko_b") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat.c!", "error") return end
    if getVehicleModel(element) == 410 then end
    setElementData(localPlayer, "pracuje", "pizza")
    exports["np-notyfikacje"]:noti("Rozpoczynasz prace jako dostawca pizzy, udaj si? za?adowa? pizze.")
    triggerServerEvent("dajBus:pizza", localPlayer)
    zaladunek = createMarker(2097.32, -1815.42, 13.38-.95, "cylinder", 2.5, 255, 255, 255)
    bzaladunek = createBlipAttachedTo(zaladunek, 41)
    addEventHandler("onClientMarkerHit", zaladunek, zaladuj)
    removeEventHandler("onClientRender", root, guistart)
    okno1 = false
    showCursor(false)
    ile = 0
end
 
function zakonczprace()
    setElementData(localPlayer, "pracuje", false)
    exports["np-notyfikacje"]:noti("Zako?czy?e? prace.")
    if isElement(zaladunek) then
        destroyElement(zaladunek)
    end
    if isElement(bzaladunek) then
        destroyElement(bzaladunek)
    end
    if isElement(branieskrzynki) then
        destroyElement(branieskrzynki)
    end
    if isElement(skrzynia5) then destroyElement(skrzynia5) end
    if isElement(skrzynia4) then destroyElement(skrzynia4) end
    if isElement(skrzynia3) then destroyElement(skrzynia3) end
    if isElement(skrzynia2) then destroyElement(skrzynia2) end
    if isElement(skrzynia1) then destroyElement(skrzynia1) end
    for i, v in ipairs(oddanie) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    for i, v in ipairs(oddanieped) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    for i, v in ipairs(boddanie) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    setElementData(localPlayer, "niesieskrzynie", false)
    triggerServerEvent("usunSkrzynie:pizza", localPlayer)
    triggerServerEvent("usunBus:pizza", localPlayer)
end
 
function zaladuj(gracz)
    if gracz ~= localPlayer then return end
    if getPedOccupiedVehicle(localPlayer) and (getElementData(getPedOccupiedVehicle(localPlayer), "kierowca:pizza") or 0) == getElementData(localPlayer, "dbid") then
        if isElement(zaladunek) then
            destroyElement(zaladunek)
        end
        if isElement(bzaladunek) then
            destroyElement(bzaladunek)
        end
        local pojazd = getPedOccupiedVehicle(localPlayer)
        skrzynia1 = createObject(1582, 0,0,0)
        skrzynia2 = createObject(1582, 0,0,0)
        skrzynia3 = createObject(1582, 0,0,0)
        skrzynia4 = createObject(1582, 0,0,0)
        skrzynia5 = createObject(1582, 0,0,0)
        attachElements(skrzynia1, pojazd, -0.45, -0.7, -0.1)
        setObjectScale(skrzynia1, 0.6)
        attachElements(skrzynia2, pojazd, 0.45, -0.7, -0.1)
        setObjectScale(skrzynia2, 0.6)
        attachElements(skrzynia3, pojazd, -0.45, -1.4, -0.1)
        setObjectScale(skrzynia3, 0.6)
        attachElements(skrzynia4, pojazd, 0.45, -1.4, -0.1)
        setObjectScale(skrzynia4, 0.6)
        attachElements(skrzynia5, pojazd, 0.45, -2.1, -0.1)
        setObjectScale(skrzynia5, 0.6)
        ile = 5
        local los = math.random(1, 3)
        if los == 1 then
            trasa = miejsca1
        elseif los == 2 then
            trasa =  miejsca2
        elseif los == 3 then
            trasa =  miejsca3
        elseif los == 4 then
            trasa =  miejsca4
        elseif los == 5 then
            trasa =  miejsca5
        elseif los == 6 then
            trasa =  miejsca6
        elseif los == 7 then
            trasa =  miejsca7
       elseif los == 8 then
            trasa =  miejsca8
       elseif los == 9 then
            trasa =  miejsca9
        end
        exports["np-notyfikacje"]:noti("Pomy?lnie za?adowa?e? pizze, udaj si? do klient?w.")
        for i, v in ipairs(trasa) do
            local skin = math.random(10, 41)
            oddanie[i] = createMarker(v[1], v[2], v[3]-.95, "cylinder", 1.5, 255, 255, 255)
            oddanieped[i] = createPed(skin, v[1], v[2], v[3], v[4])
            boddanie[i] = createBlipAttachedTo(oddanie[i], 41)
            setElementData(oddanie[i], "ped", oddanieped[i])
            setElementData(oddanie[i], "blip", boddanie[i])
            setPedAnimation(oddanieped[i], 'ped','XPRESSscratch')
            setElementFrozen(oddanieped[i], true)
            addEventHandler("onClientMarkerHit", oddanie[i], function(gracz)
            if gracz ~= localPlayer then return end
                if not getElementData(localPlayer, "niesieskrzynie") then exports["np-notyfikacje"]:noti("Nie posiadasz pizzy dla klienta.", "error") return end
                local ped = getElementData(source, "ped")
                local blip = getElementData(source, "blip")
                setElementFrozen(ped, false)
                setElementRotation(ped, -0.00, 0.00, v[5])
                setPedAnimation(ped, 'ped', 'WOMAN_walknorm')
                setElementData(localPlayer, "ped", ped)
                fade = true
                destroyElement(source)
                destroyElement(blip)
                ile = ile - 1
                setElementData(localPlayer, "niesieskrzynie", false)
                triggerServerEvent("usunSkrzynie:pizza", localPlayer)
                local zarobek = math.random(300, 800)
                if getElementData(localPlayer, "premium") then
                    zarobek = zarobek + zarobek*0.20
                end
                local nagroda = math.random(0,1)
                if getElementData(localPlayer, "premium") then
                    nagroda = nagroda + nagroda*2
                end
                if getElementData(localPlayer, "pizza:ulepszenie3") then
                    zarobek = zarobek + zarobek*0.05
                end
                local nagroda = math.random(1, 2)
                if tonumber(nagroda) == 5 then
                    local los2 = math.random(1,3)
                    if getElementData(localPlayer, "premium") then
                        los2 = math.random(2, 3)
                    end
                    setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
                    exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
                end
                local pkt = math.random(0, 2)
                local zarobek2 = string.format("%1d", zarobek)
                setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+nagroda)
                setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
                setElementData(localPlayer, "kpunkty", getElementData(localPlayer, "kpunkty")+pkt)
                if ile == 0 then
                    zaladunek = createMarker(2097.32, -1815.42, 13.38-.95, "cylinder", 2.5, 255, 255, 255)
                    bzaladunek = createBlipAttachedTo(zaladunek, 41)
                    addEventHandler("onClientMarkerHit", zaladunek, zaladuj)
                    exports["np-notyfikacje"]:noti("Dowioz?e? pizze do klienta otrzymujesz: "..zarobek2.." PLN.\nUdaj si? po nowe zlecenie")
                    triggerServerEvent("daj:kzlecenia", localPlayer, localPlayer)
                else
                    exports["np-notyfikacje"]:noti("Dowioz?e? pizze do klienta otrzymujesz: "..zarobek2.." PLN.\nZosta?o: "..ile.." pizzy")
                end
                setTimer(function()
                    fade = false
                    destroyElement(ped)
                    setElementData(localPlayer, "ped", false)
                    alpha = 255
                end, 3000, 1)
            end)
        end
    end
end
 
function skinAlpha()
    if fade == true then
        alpha = alpha-1.5
        if alpha > 0 then
            setElementAlpha(getElementData(localPlayer, "ped"), alpha)
        elseif alpha < 0 then
            fade = false
        end
    end
end
addEventHandler('onClientRender', root, skinAlpha)
 
addEventHandler("onClientVehicleExit", root, function(gracz, seat)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "pracuje") == "pizza" then
        local x, y, z = getVehicleComponentPosition(source, "boot_dummy")
        setVehicleComponentPosition(source, "boot_dummy", x, y, z+1)
        local rx, ry, rz = getVehicleComponentRotation(source, "boot_dummy")
        setVehicleComponentRotation(source, "boot_dummy", rx+90, ry, rz)
        branieskrzynki = createMarker(0,0,0, "cylinder", 1.5, 25, 175, 131)
        attachElements(branieskrzynki, source, 0, -3.5, -0.9)
        setElementData(branieskrzynki, "auto", source)
        addEventHandler("onClientMarkerHit", branieskrzynki, function(gracz)
            if gracz ~= localPlayer then return end
            if ile == 0 then exports["np-notyfikacje"]:noti("Nie posiadasz paczek.", "error") return end
            if not getElementData(localPlayer, "niesieskrzynie") then
                setElementData(localPlayer, "niesieskrzynie", true)
                triggerServerEvent("dajSkrzynie:pizza", localPlayer)
                if ile == 5 then
                    if isElement(skrzynia5) then destroyElement(skrzynia5) end
                elseif ile == 4 then
                    if isElement(skrzynia4) then destroyElement(skrzynia4) end
                elseif ile == 3 then
                    if isElement(skrzynia3) then destroyElement(skrzynia3) end
                elseif ile == 2 then
                    if isElement(skrzynia2) then destroyElement(skrzynia2) end
                elseif ile == 1 then
                    if isElement(skrzynia1) then destroyElement(skrzynia1) end
                end
            else
                setElementData(localPlayer, "niesieskrzynie", false)
                triggerServerEvent("usunSkrzynie:pizza", localPlayer)
                local veh = getElementData(source, "auto")
                if ile == 5 then
                    skrzynia5 = createObject(1582, 0,0,0)
                    attachElements(skrzynia5, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia5, 0.6)
                elseif ile == 4 then
                    skrzynia4 = createObject(1582, 0,0,0)
                    attachElements(skrzynia4, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia4, 0.6)
                elseif ile == 3 then
                    skrzynia3 = createObject(1582, 0,0,0)
                    attachElements(skrzynia3, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia3, 0.6)
                elseif ile == 2 then
                    skrzynia2 = createObject(1582, 0,0,0)
                    attachElements(skrzynia2, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia2, 0.6)
                elseif ile == 1 then
                    skrzynia5 = createObject(1582, 0,0,0)
                    attachElements(skrzynia1, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia1, 0.6)
                end
            end
        end)
    end
end)
 
addEventHandler("onClientVehicleEnter", root, function(gracz, seat)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "pracuje") == "pizza" then
        local x, y, z = getVehicleComponentPosition(source, "boot_dummy")
        setVehicleComponentPosition(source, "boot_dummy", x, y, z-1)
        local rx, ry, rz = getVehicleComponentRotation(source, "boot_dummy")
        setVehicleComponentRotation(source, "boot_dummy", rx-90, ry, rz)
        if isElement(branieskrzynki) then
            destroyElement(branieskrzynki)
        end
    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




s.lua
local bus = {}

function pokazpracownikow()
    local q = exports['np-mysql']:wykonaj("SELECT * from konta order by kzlecenia desc")
    local topka = {}

    for i = 1,5 do
        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["kzlecenia"]})
    end

    return topka
end

tablica = pokazpracownikow()

setTimer(function()
    tablica = pokazpracownikow()
end, 600000, 0)

addEvent("pokazTopke:pizza:source", true)
addEventHandler("pokazTopke:pizza:source", root, function()
    triggerClientEvent(source, "pokazTopke:pizza:client", source, tablica)
end)


addEvent("dajBus:pizza", true)
addEventHandler("dajBus:pizza", root, function()
    bus[source] = createVehicle(404, 2095.36, -1799.02, 13.12, 359.7, 359.9, 91.1)
    warpPedIntoVehicle(source, bus[source])
    setVehicleVariant(bus[source], 255, 255)
    setElementDimension(bus[source], 0)
    setVehicleDamageProof(bus[source], true)
    triggerClientEvent(root, "ghost:vehicle", root, bus[source])
    setElementData(bus[source], "kierowca:pizza", getElementData(source, "dbid"))
    if getElementData(source, "pizza:ulepszenie2") == 1 then
        setVehicleColor(bus[source], 230, 0, 0)
        setVehicleHandling(bus[source], "driveType", "awd")
        setVehicleHandling(bus[source], "engineAcceleration", getVehicleHandling(bus[source]).engineAcceleration+2)
        setVehicleHandling(bus[source], "maxVelocity", getVehicleHandling(bus[source]).maxVelocity+30)
    else
        setVehicleColor(bus[source], 0, 19, 0)
    end
end)

addEvent("usunBus:pizza", true)
addEventHandler("usunBus:pizza", root, function()
    if isElement(bus[source]) then
        destroyElement(bus[source])
    end
end)

addEvent("daj:kzlecenia", true)
addEventHandler("daj:kzlecenia", root, function(player)
    local dbid = getElementData(player, "dbid")
    local ilosc = getElementData(player, "kzlecenia") or 0
    local q = exports['np-mysql']:wykonaj("UPDATE konta SET kzlecenia=kzlecenia+1 where dbid=?", dbid)
    setElementData(player, "kzlecenia", ilosc+1)
end)

addEventHandler("onVehicleStartEnter", root, function(gracz, seat)
    if getElementData(gracz, "pracuje") == "pizza" then
        if getElementData(source, "id") then
            cancelEvent()
        end
        if getElementData(source, "kierowca:pizza") ~= getElementData(gracz, "dbid") then
            cancelEvent()
        end
        if getElementData(gracz, "niesieskrzynie") then 
            exports["np-notyfikacje"]:noti("Nie mo?esz wej?? do pojazdu z pizza", gracz, "error") 
            cancelEvent() 
        end
    else
        if getElementData(source, "kierowca:pizza") then
            cancelEvent()
        end
    end
end)


local skrzynka = {}
local timer = {}


addEvent("dajSkrzynie:pizza", true)
addEventHandler("dajSkrzynie:pizza", root, function()
    local x,y,z = getElementPosition(source)
    skrzynka[source] = createObject(1582, x,y,z)
    pudelko = exports.bone_attach:attachElementToBone(skrzynka[source],source,11,-0.15,0.00,0.10,-92.00,-5.00,5.00)
    setPedAnimation(source,"CARRY","crry_prtial",0,true,true,false,true)
    toggleControl(source,"sprint", false) 
    toggleControl(source,"jump", false) 
    toggleControl(source,"fire", false) 
    if getElementData(source, "pizza:ulepszenie1") then
        toggleControl(source,"walk", true) 
        setControlState(source,"walk", false)
    else
        toggleControl(source,"walk", false) 
        setControlState(source,"walk", true)
    end
    setObjectScale(skrzynka[source], 0.6)
    unbug(source)
end)

function unbug(gracz)
    timer[gracz] = setTimer(function()
        toggleControl(gracz,"sprint", false) 
        toggleControl(gracz,"jump", false) 
        toggleControl(gracz,"fire", false) 
        if getElementData(gracz, "pizza:ulepszenie1") == 1 then
            toggleControl(gracz,"walk", true) 
            setControlState(gracz,"walk", false)
        else
            toggleControl(gracz,"walk", false) 
            setControlState(gracz,"walk", true)
        end
    end, 51, 0)
end



addEvent("usunSkrzynie:pizza", true)
addEventHandler("usunSkrzynie:pizza", root, function()
    if isElement(skrzynka[source]) then destroyElement(skrzynka[source]) end
    setPedAnimation(source,"ped","facanger",-1,false,true,true,false)
    toggleControl(source,"sprint", true) 
    toggleControl(source,"jump", true) 
    toggleControl(source,"fire", false) 
    toggleControl(source,"walk", true) 
    setControlState(source,"walk", false)
    if isTimer(timer[source]) then
        killTimer(timer[source])
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if isTimer(timer[source]) then
        killTimer(timer[source])
    end
    if isElement(skrzynka[source]) then 
        destroyElement(skrzynka[source]) 
    end
    if isElement(bus[source]) then
        destroyElement(bus[source])
    end
end)





Debugscript jak jest odpalone np-pizza

https://imgur.com/a/HA5riti

[ Dodano: 2018-08-30, 10:54 ]
Dzi?kuje wszystkim za pomoc, naprawi?em ! Stawiam :piwo: jak obieca?em :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 13:05


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

BabyKonik, ka?da praca b?dzie mie? jakie? triggery, spr?buj wgra? core b?d? co? typu ,,ustawienia" ,,settings"

[ Dodano: 2018-08-30, 13:09 ]
Do serverside musisz doda? -
usunKosiarke:kosiarki,
- dajKosiarke:kosiarki,
- pokazTopke:kosiarki.

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 15:11


Mikołajj







Wiek: 23
Na forum: 3026 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

"Thinks" napisał/a:

BabyKonik, ka?da praca b?dzie mie? jakie? triggery, spr?buj wgra? core b?d? co? typu ,,ustawienia" ,,settings"

[ Dodano: 2018-08-30, 13:09 ]
Do serverside musisz doda? -
usunKosiarke:kosiarki,
- dajKosiarke:kosiarki,
- pokazTopke:kosiarki.


Przecie? to jest dodane, popatrz najpierw zanim co? napiszesz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 15:13


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

ST4GE, Jak co? piszesz, to chocia? pisz to zrozumiale i bez offtopicowo, a czy napisa?em gdzie ma doda??

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 17:26


radziowarsss







Wiek: 26
Na forum: 3472 dni
Posty: 9
Nick w MP: radziowarsss

Piwa: 1

Respekt: 50

Babykonik, moglbys napisac w jaki sposob to naprawiles? Bo ja nie mam pojecia ca?y czas.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:03


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4128 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

radziowarsss,

BabyKonik, ka?da praca b?dzie mie? jakie? triggery, spr?buj wgra? core b?d? co? typu ,,ustawienia" ,,settings"

[ Dodano: 2018-08-30, 13:09 ]
Do serverside musisz doda? -
usunKosiarke:kosiarki,
- dajKosiarke:kosiarki,
- pokazTopke:kosiarki.


Nie dzi?kuj...

Jezu ludzie patrzcie uwa?nie....

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 01:07


radziowarsss







Wiek: 26
Na forum: 3472 dni
Posty: 9
Nick w MP: radziowarsss

Piwa: 1

Respekt: 50

Chodzi o to, ?e czyta?em to, lecz rozumiem z tego tylko tyle, ?e powinnem wgra? jaki? skrypt "co? typu ,,ustawienia" ,,settings" ". Ale nie mam poj?cia jak mam doda? do serverside powy?sze triggery. Sorka, ale jestem laikiem w tym temacie, a chc? si? nauczy?, mam nadziej?, ?e mnie rozumiesz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 07:29


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4128 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

radziowarsss, spk, przeanalizuj jeszcze raz, a jak ju? nie.b?dziesz mia? pomys?u, to napisz😉

Postaw piwo autorowi tego posta
 

 
Tagi: kosiarki :: nie :: działają
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Kosiarki nie działają 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