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

Wysłany: 2018-07-30, 21:07


BlackSkorpion

Uczę się LUA






Wiek: 26
Na forum: 3612 dni
Posty: 53
Nick w MP: Black

Piwa: 371

Respekt: 50

mam problem z prac? kuriera powiem, ze ta praca to jest orginalna wersja np kupion?.
kod lua
--[[
    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 pracodawca = createPed(153, 1042.48, -1444.91, 23.18, 59.347457885742)
setElementData(pracodawca, "name", "Pracodawca")
setElementDimension(pracodawca, 15)
setElementFrozen(pracodawca, true)
local rozpoczecie = createMarker(1040.02, -1444.11, 23.18-.95, "cylinder", 1, 255, 255, 255)
setElementData(rozpoczecie, "praca", true)
setElementDimension(rozpoczecie, 15)
 
 
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") ~= "kurier" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
    end
    addEventHandler("onClientRender", root, guistart)
    okno1 = true
    showCursor(true)
    triggerServerEvent("pokazTopke:kurier:source", localPlayer)
end)
 
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 paczk?", 300, "dolar.png"},
    {"Szybszy pojazd", "Dzi?ki temu ulepszeniu tw?j pojazd je?dzi szybciej", 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, "kpunkty") or 0
       local zlecenia = getElementData(localPlayer, "kzlecenia") or 0
        shadowText("Praca dostawcy paczek", 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 C\n34 poziom ", 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") == "kurier" 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") == "kurier" then
            zakonczprace()
        else
            if not getElementData(localPlayer, "lvl") or getElementData(localPlayer, "lvl") < 34 then
                exports['np-notyfikacje']:noti("Posiadasz zbyt ma?y poziom by tutaj pracowa?", "error");
                return false;
            end
            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, "kurier:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "kurier:ulepszenie2", 1)
            elseif v[1] == "Sprint" then
                if getElementData(localPlayer, "kurier:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "kurier:ulepszenie1", 1)
            elseif v[1] == "Zarobek +5%" then
                if getElementData(localPlayer, "kurier:ulepszenie3") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "kurier:ulepszenie3", 1)
            end
            exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
            setElementData(localPlayer, "kpunkty", punkty-tonumber(v[3]))
        end
    end
  end
end)
 
addEvent("pokazTopke:kurier:client", true)
addEventHandler("pokazTopke:kurier:client", root, function(tabelka)
  pracownicy = tabelka
end)
 
-- praca
 
local miejsca1 = {
    {1081.36, -298.33, 73.99, 185, 5},
    {1050.45, -359.91, 73.99, 0, 0},
    {1113.24, -355.61, 73.99, 90, 280},
    {1106.34, -314.58, 73.99, 0, 35},
    {1102.40, -300.29, 73.99, 180, 105},
}

local miejsca2 = {
    {242.33, -88.37, 1.58, 90, 270},
    {242.73, -123.68, 1.5, 130, 240},
    {325.00, -88.30, 1.58, 270, 90},
    {292.14, -55.73, 1.80, 90, 270},
    {254.55, -61.72, 1.57, 180, 0},
}

local miejsca3 = {
    {342.09, 62.57, 3.85, 120, 300},
    {340.61, 33.77, 6.41, 310, 180},
    {316.81, 17.53, 4.52, 180, 0},
    {285.84, 41.78, 2.53, 190, 190},
    {317.22, 55.07, 3.38, 230, 50},
}

local miejsca4 = {
    {1283.46, 164.04, 20.46, 0, 180},
    {1292.41, 171.73, 20.47, 70, 250},
    {1300.93, 192.28, 20.46, 210, 28},
    {1312.93, 170.85, 20.46, 333, 159},
    {1307.21, 148.87, 20.34, 250, 70},
}

local miejsca5 = {
    {1475.62, 373.80, 19.66, 330, 150},
    {1452.17, 373.30, 19.10, 220, 30},
    {1427.19, 355.08, 18.84, 150, 330},
    {1409.83, 345.47, 18.88, 277, 6},
    {1414.76, 323.91, 18.84, 135, 316},
}

local miejsca6 = {
    {-49.35, 1085.48, 20.20, 360, 180},
    {-22.60, 1114.99, 19.74, 180, 270},
    {1.14, 1080.69, 19.74, 0, 180},
    {-149.14, 1081.05, 19.74, 360, 260},
    {-180.04, 1091.07, 19.74, 0, 180},
}

local miejsca7 = {
    {-362.03, 1106.81, 19.74, 265, 360},
    {-22.60, 1114.99, 19.74, 180, 270},
    {-366.35, 1166.35, 19.74, 223, 41},
    {-320.44, 1161.59, 20.24, 180, 360},
    {-290.27, 1174.56, 20.94, 180, 352},
}

local miejsca8 = {
    {801.17, 360.04, 19.39, 80, 264},
    {784.71, 379.77, 21.21, 324, 143},
    {753.64, 377.97, 23.18, 319, 142},
    {749.96, 348.62, 20.42, 216, 30},
    {805.44, 372.55, 19.60, 85, 266},
}

local miejsca9 = {
    {2447.72, 54.13, 26.87, 175, 0},
    {2452.03, 27.10, 26.56, 270, 91},
    {2480.20, -20.80, 26.87, 359, 179},
    {2547.91, 1.40, 26.48, 90, 272},
    {2530.34, 123.82, 26.48, 178, 358},
}

 
function rozpocznijprace()
    --if getElementData(localPlayer, "punkty") < 320 then exports["np-notyfikacje"]:noti("Nie posiadasz 400 punkt?w reputacji!", "error") return end
    if getElementData(localPlayer, "prawko_c") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat.c!", "error") return end
    if getVehicleModel(element) == 410 then end
    setElementData(localPlayer, "pracuje", "kurier")
    exports["np-notyfikacje"]:noti("Rozpoczynasz prace jako dostawca paczek, udaj si? za?adowa? pojazd.")
    triggerServerEvent("dajBus:kurier", localPlayer)
    zaladunek = createMarker(790.00, -609.01, 16.34-.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:kurier", localPlayer)
    triggerServerEvent("usunBus:kurier", localPlayer)
end
 
function zaladuj(gracz)
    if gracz ~= localPlayer then return end
    if getPedOccupiedVehicle(localPlayer) and (getElementData(getPedOccupiedVehicle(localPlayer), "kierowca:kurier") 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(2912, 0,0,0)
        skrzynia2 = createObject(2912, 0,0,0)
        skrzynia3 = createObject(2912, 0,0,0)
        skrzynia4 = createObject(2912, 0,0,0)
        skrzynia5 = createObject(2912, 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, 8)
        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? paczki, 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 paczki 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:kurier", localPlayer)
                local zarobek = math.random(79, 85)
                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, "kurier:ulepszenie3") then
                    zarobek = zarobek + zarobek*0.05
                end
               
            local los2 = 100
            if getElementData(localPlayer, "premium") then
                los2 = 110
            end
            setElementData(localPlayer, "lvl:xp", getElementData(localPlayer, "lvl:xp")+los2)
            exports["np-notyfikacje"]:noti("Zdobywasz "..los2.." punkt?w do?wiadczenia")


                local pkt = math.random(0, 2)
                local zarobek2 = string.format("%1d", zarobek)
                setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
                setElementData(localPlayer, "kpunkty", getElementData(localPlayer, "kpunkty")+pkt)
                if ile == 0 then
                    zaladunek = createMarker(790.00, -609.01, 16.34-.95, "cylinder", 2.5, 255, 255, 255)
                    bzaladunek = createBlipAttachedTo(zaladunek, 41)
                    addEventHandler("onClientMarkerHit", zaladunek, zaladuj)
                    exports["np-notyfikacje"]:noti("Dowioz?e? paczke do klienta otrzymujesz: "..zarobek2.." PLN.\nUdaj si? po nowe zlecenie")
                    triggerServerEvent("daj:kzlecenia", localPlayer, localPlayer)
                else
                    exports["np-notyfikacje"]:noti("Dowioz?e? paczke do klienta otrzymujesz: "..zarobek2.." PLN.\nZosta?o: "..ile.." paczek")
                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") == "kurier" 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:kurier", 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:kurier", localPlayer)
                local veh = getElementData(source, "auto")
                if ile == 5 then
                    skrzynia5 = createObject(2912, 0,0,0)
                    attachElements(skrzynia5, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia5, 0.6)
                elseif ile == 4 then
                    skrzynia4 = createObject(2912, 0,0,0)
                    attachElements(skrzynia4, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia4, 0.6)
                elseif ile == 3 then
                    skrzynia3 = createObject(2912, 0,0,0)
                    attachElements(skrzynia3, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia3, 0.6)
                elseif ile == 2 then
                    skrzynia2 = createObject(2912, 0,0,0)
                    attachElements(skrzynia2, veh, 0.45, -2.1, -0.1)
                    setObjectScale(skrzynia2, 0.6)
                elseif ile == 1 then
                    skrzynia5 = createObject(2912, 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") == "kurier" 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


b??dy z db3:[2018-07-30 21:05] ERROR: [prace]/np-kurier/s.lua:8: attempt to index field '?' (a nil value)

Podpis
Pomagam na tyle ile mogę :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-30, 21:25


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

wska? linijk? w kt?rej wywala b??d

PS. poda?e? stron? clienta, a b??d wywala po serverze

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-30, 21:27


BlackSkorpion

Uczę się LUA






Wiek: 26
Na forum: 3612 dni
Posty: 53
Nick w MP: Black

Piwa: 371

Respekt: 50

local ulepszenia = false


Podpis
Pomagam na tyle ile mogę :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-30, 21:30


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

podaj stron? serwer bo tam pokazuje b??d

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-30, 21:34


BlackSkorpion

Uczę się LUA






Wiek: 26
Na forum: 3612 dni
Posty: 53
Nick w MP: Black

Piwa: 371

Respekt: 50

        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["kzlecenia"]})


Podpis
Pomagam na tyle ile mogę :D
Postaw piwo autorowi tego posta
 

 
Tagi: kurier
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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