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

Wysłany: 2018-07-25, 16:53


Awruk2003







Wiek: 36
Na forum: 3631 dni
Posty: 7
Nick w MP: Suchy

Piwa: 13

Respekt: 50

Otoz mam bug. Posiadam gm own-worlda i jest tam praca busy.
Podchodzi do markeru wyswietla sie (panel) i klikasz zatrudnij sie i potem poziom 1 2 3 i nie moge kliknac tego poziom 1 2 3 zeby tepnac jakis bug pomoze ktos: (sr za orto):
KOD:
notepad: C:


-[[
    autor: Asper & Payro
    for: Own World
    All rights reserved!
]]

local sx, sy = guiGetScreenSize()
local screenW, screenH = guiGetScreenSize()

function isMouseIn(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 math.percent(percent,maxvalue)
    if tonumber(percent) and tonumber(maxvalue) then
        local x = (maxvalue*percent)/100
        return x
    end
    return false
end

local x, y = screenW * 0.2625, screenH * 0.3926
local trzymam = false
local git = false

local x2, y2 = screenW * 0.2625, screenH * 0.4815
local trzymam2 = false
local git2 = false

local potrzebny = "?"

local m_marker = false 

local w_marker = false
local w_blip = false

local marker = false
local blip = false

local e_marker = false
local e_blip = false

local zamowienie = 0

local punkty_bus = {
    {--[[marker]] -187.36990356445, 1126.4725341797, 19.692775726318, --[[ped1]] -184.2621307373, 1128.2377929688, 19.7421875, 90, --[[ped2]] -184.2283782959, 1126.2680664063, 19.7421875, 90, --[[ped3]] -184.33763122559, 1124.7784423828, 19.7421875, 90},
    {--[[marker]] -167.31036376953, 1195.3295898438, 19.691059112549, --[[ped1]] -165.82420349121, 1192.1715087891, 19.7421875, 0, --[[ped2]] -167.4857635498, 1192.1612548828, 19.7421875, 0, --[[ped3]] -169.59733581543, 1192.1766357422, 19.7421875, 0},
    {--[[marker]] 40.225219726563, 1195.3433837891, 18.945724487305, --[[ped1]] 42.195659637451, 1192.0336914063, 19.0078125, 0, --[[ped2]] 40.163932800293, 1192.1838378906, 19.0078125, 0, --[[ped3]] 38.317443847656, 1192.2233886719, 19.0078125, 0},
    {--[[marker]] 193.75100708008, 1047.4169921875, 21.955835342407, --[[ped1]] 190.96209716797, 1045.2436523438, 22.08535194397, 280, --[[ped2]] 190.91339111328, 1046.8256835938, 21.882541656494, 280, --[[ped3]] 190.38256835938, 1048.5487060547, 21.679428100586, 280},
    {--[[marker]] 27.862340927124, 890.58764648438, 24.226137161255, --[[ped1]] 25.76025390625, 894.08624267578, 24.250886917114, 180, --[[ped2]] 27.403675079346, 893.77453613281, 24.285215377808, 180, --[[ped3]] 29.099042892456, 893.994140625, 24.352968215942, 180},
    {--[[marker]] -817.53942871094, 1489.0703125, 19.76505279541, --[[ped1]] -816.17993164063, 1485.7761230469, 19.974075317383, 0, --[[ped2]] -817.91748046875, 1485.6773681641, 19.81131362915, 0, --[[ped3]] -819.59832763672, 1485.8848876953, 19.61812210083, 0},
    {--[[marker]] -837.16528320313, 1620.1318359375, 27.060836791992, --[[ped1]] -838.76373291016, 1623.3553466797, 27.060398101807, 180, --[[ped2]] -837.02667236328, 1623.5140380859, 27.038764953613, 180, --[[ped3]] -835.90417480469, 1623.4603271484, 27.024785995483, 180},
    {--[[marker]] -1452.8852539063, 2674.1506347656, 55.785316467285, --[[ped1]] -1454.6430664063, 2677.5588378906, 55.8359375, 180, --[[ped2]] -1452.7293701172, 2677.3325195313, 55.8359375, 180, --[[ped3]] -1450.845703125, 2677.4978027344, 55.8359375, 180},
    {--[[marker]] -1513.1837158203, 2554.2106933594, 55.788627624512, --[[ped1]] -1514.9058837891, 2557.31640625, 55.840278625488, 180, --[[ped2]] -1513.0848388672, 2556.9875488281, 55.840278625488, 180, --[[ped3]] -1511.744140625, 2557.1630859375, 55.840278625488, 180},
    {--[[marker]] -831.97045898438, 2722.2653808594, 45.758159637451, --[[ped1]] -830.74072265625, 2719.0983886719, 45.844631195068, 0, --[[ped2]] -832.13543701172, 2718.9919433594, 45.834945678711, 0, --[[ped3]] -834.03491210938, 2719.0698242188, 45.800483703613, 0},
    {--[[marker]] -225.04989624023, 2698.0764160156, 62.64200592041, --[[ped1]] -203.39576721191, 2694.8857421875, 62.6875, 0, --[[ped2]] -205.09735107422, 2695.0075683594, 62.6875, 0, --[[ped3]] -206.56649780273, 2694.9389648438, 62.6875, 0},
    {--[[marker]] 835.69427490234, 2518.4995117188, 29.730876922607, --[[ped1]] 832.12933349609, 2520.1442871094, 29.898504257202, 0, --[[ped2]] 833.60174560547, 2521.0900878906, 29.931987762451, 0, --[[ped3]] 834.95819091797, 2522.1767578125, 29.965461730957, 0},
    {--[[marker]] 691.31787109375, 1864.0288085938, 5.6639809608459, --[[ped1]] 690.17919921875, 1867.8330078125, 5.5600996017456, 180, --[[ped2]] 691.83441162109, 1867.8275146484, 5.582631111145, 180, --[[ped3]] 693.89019775391, 1867.4925537109, 5.5920810699463, 180},
}

local punkty_pociag = {
    {--[[marker]] -1944.1209716797, 133.69854736328, 27.120384216309, --[[ped1]]  -1941.4598388672, 136.39598083496, 26.273441314697 , 90, --[[ped2]] -1938.5423583984, 139.79704284668, 26.28125, 90, --[[ped3]] 1728.0515136719, -1948.1065673828, 14.1171875, 90},
    {--[[marker]] 808.0712890625, -1360.5031738281, -0.071559190750122, --[[ped1]]  809.11242675781, -1355.1604003906, -0.5078125, 90, --[[ped2]] 805.98284912109, -1352.666015625, -0.5078125, 90, --[[ped3]] 813.51782226563, -1355.7906494141, -0.5078125, 90},
    {--[[marker]] 2864.75, 1297.5522460938, 12.245383262634, --[[ped1]]  -1941.4598388672, 136.39598083496, 26.273441314697 , 90, --[[ped2]] 809.11242675781, -1355.1604003906, -0.5078125, 90, --[[ped3]] 1728.0515136719, -1948.1065673828, 14.1171875, 90},
    {--[[marker]] 1432.701171875, 2632.25, 12.245383262634, --[[ped1]]  -1941.4598388672, 136.39598083496, 26.273441314697 , 90, --[[ped2]] 809.11242675781, -1355.1604003906, -0.5078125, 90, --[[ped3]] 1728.0515136719, -1948.1065673828, 14.1171875, 90},
    {--[[marker]]  -149.85723876953, 1282.9340820313, 22.658863067627, --[[ped1]]  -1941.4598388672, 136.39598083496, 26.273441314697 , 90, --[[ped2]] 809.11242675781, -1355.1604003906, -0.5078125, 90, --[[ped3]] 1728.0515136719, -1948.1065673828, 14.1171875, 90},
}

local pedy = {}

function createPeds(slot)
    local x1,y1,z1,rz1 = punkty_bus[slot][4],punkty_bus[slot][5],punkty_bus[slot][6],punkty_bus[slot][7]
    local x2,y2,z2,rz2 = punkty_bus[slot][8],punkty_bus[slot][9],punkty_bus[slot][10],punkty_bus[slot][11]
    local x3,y3,z3,rz3 = punkty_bus[slot][12],punkty_bus[slot][13],punkty_bus[slot][14],punkty_bus[slot][15]
    pedy[1] = createPed(29, x1, y1, z1, rz1)
    pedy[2] = createPed(17, x2, y2, z2, rz2)
    pedy[3] = createPed(28, x3, y3, z3, rz3)
end

function createPeds2(slot)
    local x1,y1,z1,rz1 = punkty_pociag[slot][4],punkty_pociag[slot][5],punkty_pociag[slot][6],punkty_pociag[slot][7]
    local x2,y2,z2,rz2 = punkty_pociag[slot][8],punkty_pociag[slot][9],punkty_pociag[slot][10],punkty_pociag[slot][11]
    local x3,y3,z3,rz3 = punkty_pociag[slot][12],punkty_pociag[slot][13],punkty_pociag[slot][14],punkty_pociag[slot][15]
    pedy[1] = createPed(29, x1, y1, z1, rz1)
    pedy[2] = createPed(17, x2, y2, z2, rz2)
    pedy[3] = createPed(28, x3, y3, z3, rz3)
end

function destroyPeds()
    for i = 1,#pedy do
        if pedy[i] and isElement(pedy[i]) then
            destroyElement(pedy[i])
            pedy[i] = false
        end
    end
end

local punkt_bus = 1

local marker_bus = false
local blip_bus = false

local punkt_pociag = 1

local marker_pociag = false
local blip_pociag = false

local punkt = ""

function gui_main()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    dxDrawImage(screenW*0,screenH*0,screenW*1,screenH*1,"gui.png")
    dxDrawImage(screenW * 0.6161, screenH * 0.3602, screenW * 0.1083, screenH * 0.1917, "avek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    exports["buttons"]:createCustomText(potrzebny, screenW * 0.6417, screenH * 0.5639, screenW * 0.7000, screenH * 0.6, tocolor(255, 255, 255, 255), 69, "default", "center", "center", false, false, false, false, false)
    --ulgowy
    if isMouseIn(x, y, screenW * 0.1938, screenH * 0.0694) and getKeyState("mouse1") == true and trzymam2 ~= true then
        local sx,sy = getCursorPosition()
        x,y = (sx*screenW-(screenW * 0.1938/2)),(sy*screenH-(screenH * 0.0694/2))
        trzymam = true
    else
        if isMouseIn(screenW * 0.5693, screenH * 0.3602, screenW * 0.2052, screenH * 0.1907) and trzymam == true then
            git = true
        else
            git = false
        end
        trzymam = false
    end
    if isMouseIn(screenW * 0.5693, screenH * 0.3602, screenW * 0.2052, screenH * 0.1907) and git == true and getKeyState("mouse1") ~= true then
        odlozyl_ulgowy()
    end
    dxDrawImage(x, y, screenW * 0.1938, screenH * 0.0694, "ulgowy.png")
    --normalny
    if isMouseIn(x2, y2, screenW * 0.1938, screenH * 0.0694) and getKeyState("mouse1") == true and trzymam ~= true then
        local sx,sy = getCursorPosition()
        x2,y2 = (sx*screenW-(screenW * 0.1938/2)),(sy*screenH-(screenH * 0.0694/2))
        trzymam2 = true
    else
        if isMouseIn(screenW * 0.5693, screenH * 0.3602, screenW * 0.2052, screenH * 0.1907) and trzymam2 == true then
            git2 = true
        else
            git2 = false
        end
        trzymam2 = false
    end
    if isMouseIn(screenW * 0.5693, screenH * 0.3602, screenW * 0.2052, screenH * 0.1907) and git2 == true and getKeyState("mouse1") ~= true then
        odlozyl_normalny()
    end
    dxDrawImage(x2, y2, screenW * 0.1938, screenH * 0.0694, "normalny.png")
end

function odlozyl_normalny()
    if potrzebny ~= "normalny" then return end
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    setElementFrozen(veh, false)

    if punkt == "bus" then
        punkt_bus = punkt_bus+1
        destroyElement(marker_bus)
        marker_bus = false
        destroyElement(blip_bus)
        blip_bus = false
        destroyPeds()
        if not punkty_bus[punkt_bus] then
            local kasa = 75
            if getElementData(localPlayer, "user:premium") then
                kasa = kasa+math.percent(10,75)
            end
            triggerServerEvent("give:moneyANDpoints", resourceRoot, localPlayer, kasa, 75)
            exports["rpg_noti"]:createNotification("success", "Trasa zako?czona, otrzymujesz "..kasa.."$")
            triggerServerEvent("stopjob:bus", localPlayer, localPlayer)
        else
            local x,y,z = punkty_bus[punkt_bus][1], punkty_bus[punkt_bus][2], punkty_bus[punkt_bus][3]
            marker_bus = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
            blip_bus = createBlipAttachedTo(marker_bus, 41)
            createPeds(punkt_bus)
        end
    else
        punkt_pociag = punkt_pociag+1
        destroyElement(marker_pociag)
        marker_pociag = false
        destroyElement(blip_pociag)
        blip_pociag = false
        destroyPeds()
        if not punkty_pociag[punkt_pociag] then
            local kasa = 375
            if getElementData(localPlayer, "user:premium") then
                kasa = kasa+math.percent(10,375)
            end
            triggerServerEvent("give:moneyANDpoints", resourceRoot, localPlayer, kasa, 375)
            exports["rpg_noti"]:createNotification("success", "Trasa zako?czona, otrzymujesz "..kasa.."$")
            triggerServerEvent("stopjob:bus", localPlayer, localPlayer)
        else
            local x,y,z = punkty_pociag[punkt_pociag][1], punkty_pociag[punkt_pociag][2], punkty_pociag[punkt_pociag][3]
            marker_pociag = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
            blip_pociag = createBlipAttachedTo(marker_pociag, 41)
            createPeds2(punkt_pociag)
        end
    end

    removeEventHandler("onClientRender", root, gui_main)
    showCursor(false)
    x, y = screenW * 0.2625, screenH * 0.3926
    trzymam = false
    git = false
    x2, y2 = screenW * 0.2625, screenH * 0.4815
    trzymam2 = false
    git2 = false
end

function odlozyl_ulgowy()
    if potrzebny ~= "ulgowy" then return end
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    setElementFrozen(veh, false)

    if punkt == "bus" then
        punkt_bus = punkt_bus+1
        destroyElement(marker_bus)
        marker_bus = false
        destroyElement(blip_bus)
        blip_bus = false
        destroyPeds()
        if not punkty_bus[punkt_bus] then
            local kasa = 112
            if getElementData(localPlayer, "user:premium") then
                kasa = kasa+math.percent(10,112)
            end
            triggerServerEvent("give:moneyANDpoints", resourceRoot, localPlayer, kasa, 112)
            exports["rpg_noti"]:createNotification("success", "Trasa zako?czona, otrzymujesz "..kasa.."$")
            triggerServerEvent("stopjob:bus", localPlayer, localPlayer)
        else
            local x,y,z = punkty_bus[punkt_bus][1], punkty_bus[punkt_bus][2], punkty_bus[punkt_bus][3]
            marker_bus = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
            blip_bus = createBlipAttachedTo(marker_bus, 41)
            createPeds(punkt_bus)
        end
    else
        punkt_pociag = punkt_pociag+1
        destroyElement(marker_pociag)
        marker_pociag = false
        destroyElement(blip_pociag)
        blip_pociag = false
        destroyPeds()
        if not punkty_pociag[punkt_pociag] then
            local kasa = 375
            if getElementData(localPlayer, "user:premium") then
                kasa = kasa+math.percent(10,375)
            end
            triggerServerEvent("give:moneyANDpoints", resourceRoot, localPlayer, kasa, 375)
            exports["rpg_noti"]:createNotification("success", "Trasa zako?czona, otrzymujesz "..kasa.."$")
            triggerServerEvent("stopjob:bus", localPlayer, localPlayer)
        else
            local x,y,z = punkty_pociag[punkt_pociag][1], punkty_pociag[punkt_pociag][2], punkty_pociag[punkt_pociag][3]
            marker_pociag = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
            blip_pociag = createBlipAttachedTo(marker_pociag, 41)
            createPeds2(punkt_pociag)
        end
    end

    removeEventHandler("onClientRender", root, gui_main)
    showCursor(false)
    x, y = screenW * 0.2625, screenH * 0.3926
    trzymam = false
    git = false
    x2, y2 = screenW * 0.2625, screenH * 0.4815
    trzymam2 = false
    git2 = false
end

--

addEventHandler("onClientMarkerHit", resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker_bus then return end
    local veh = getPedOccupiedVehicle(hit)
    if not veh then return end
    if getElementSpeed(veh) > 40 then return end
    setElementFrozen(veh, true)
    local bilet = math.random(1,2)
    if bilet == 1 then
        potrzebny = "normalny"
    elseif bilet == 2 then
        potrzebny = "ulgowy"
    end
    addEventHandler("onClientRender", root, gui_main)
    showCursor(true)
    trzymam2 = false
    git2 = false
    trzymam2 = false
    git2 = false

    punkt = "bus"
end)

function getElementSpeed(veh,x)
    local h = getVehicleHandling(veh)
    local sx,sy,sz = getElementVelocity(veh)
    local rspeed = math.ceil(((sx^2+sy^2+sz^2)^(0.5))*165)
    return math.floor(rspeed)
end

addEventHandler("onClientMarkerHit", resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker_pociag then return end
    local veh = getPedOccupiedVehicle(hit)
    if not veh then return end
    if getElementSpeed(veh) > 80 then return end
    setElementFrozen(veh, true)
    local bilet = math.random(1,2)
    if bilet == 1 then
        potrzebny = "normalny"
    elseif bilet == 2 then
        potrzebny = "ulgowy"
    end
    addEventHandler("onClientRender", root, gui_main)
    showCursor(true)
    trzymam2 = false
    git2 = false
    trzymam2 = false
    git2 = false

    punkt = "poci?g"
end)

local kola = {
{-168.76811218262, 1073.2747802734, 0.33673763275146},
{-168.7673034668, 1066.4285888672, 0.33673763275146},
{-168.7673034668, 1065.4268798828, 0.33673763275146},
{-164.41868591309, 1065.4744873047, 0.33673763275146},
{-164.42189025879, 1066.5283203125, 0.33673763275146},
{-164.42213439941, 1073.3103027344, 0.33673763275146},
}

local punkt = false

local icons = {
{screenW * 0.4917, screenH * 0.3713},
{screenW * 0.4359, screenH * 0.3231},
{screenW * 0.4411, screenH * 0.5222},
{screenW * 0.5630, screenH * 0.3139},
{screenW * 0.4151, screenH * 0.4361},
{screenW * 0.5516, screenH * 0.4694},
{screenW * 0.5104, screenH * 0.5519},
{screenW * 0.4339, screenH * 0.6370},
{screenW * 0.5776, screenH * 0.6176},
}

local rnd = math.random(1,#icons)
local xI,xM = 0,8
local s_icons = false

function gui_e()
    dxDrawImage(screenW*0,screenH*0,screenW*1,screenH*1,"guielektryk.png")
    local x,y = icons[rnd][1],icons[rnd][2]
    dxDrawImage(x, y, 45, 45, "kropka.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

addEventHandler("onClientClick", root, function(btn, state)
    if btn == "left" and state == "down" and s_icons == true then
        local x,y = icons[rnd][1],icons[rnd][2]
        if isMouseIn(x, y, 45, 45) then
            rnd = math.random(1,#icons)
            xI = xI+1
            if xI == xM then
                removeEventHandler("onClientRender", root, gui_e)
                showCursor(false)
                s_icons = false
                xI = 0
                naprawil_elektryke()
            end
        end
    end
end)

function konieczamowienia()
    if zamowienie == 10 then
        stopJob()
        local kasa = 72
        if getElementData(localPlayer, "user:premium") then
            kasa = kasa+math.percent(10,72)
        end
        triggerServerEvent("give:moneyANDpoints", resourceRoot, localPlayer, kasa, 72)
        exports["rpg_noti"]:createNotification("success", "Zam?wienie zako?czone, otrzymujesz "..kasa.."$")
        zamowienie = 0
        triggerServerEvent("stopjob:bus", resourceRoot, localPlayer, false)
    else
        exports["rpg_noti"]:createNotification("success", "Stan zam?wienia: "..zamowienie.."/10")
    end
end

function naprawil_elektryke()
    destroyElement(e_marker)
    destroyElement(e_blip)
    e_marker = false
    e_blip = false
    punkt = false
    zamowienie = zamowienie+1
    konieczamowienia()
end

addEvent("startjob:bus", true)
addEventHandler("startjob:bus", resourceRoot, function(_,level)
    if getElementData(localPlayer, "user:job") ~= 1 then return end
    if tonumber(level) == 1 then
        m_marker = createMarker(-181.43214416504, 1062.9561767578, 0.33673763275146-1, "cylinder", 1.1, 255, 75, 0, 75)
        setElementDimension(m_marker, 66)
        zamowienie = 0
    elseif tonumber(level) == 2 then
        punkt_bus = 1
        local x,y,z = punkty_bus[punkt_bus][1], punkty_bus[punkt_bus][2], punkty_bus[punkt_bus][3]
        marker_bus = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
        blip_bus = createBlipAttachedTo(marker_bus, 41)
        createPeds(punkt_bus)
    elseif tonumber(level) == 3 then
        punkt_pociag = 1
        local x,y,z = punkty_pociag[punkt_pociag][1], punkty_pociag[punkt_pociag][2], punkty_pociag[punkt_pociag][3]
        marker_pociag = createMarker(x, y, z-1, "cylinder", 3, 0, 255, 0, 75)
        blip_pociag = createBlipAttachedTo(marker_pociag, 41)
        createPeds(punkt_pociag)
    end
end)

addEvent("auto:bus", true)
addEventHandler("auto:bus", root, function(pojazd)
    setElementAlpha(pojazd, 255)
    setElementCollisionsEnabled(pojazd, true)
end)

local showed = false

function gui()
    exports["buttons"]:createCustomWindow("Komputer", screenW * 0.4109, screenH * 0.4204, screenW * 0.1781, screenH * 0.1802, 69)
    exports["buttons"]:createCustomText("Komputer do diagnozy\nusterek w autokarach.", screenW * 0.4109, screenH * 0.4204, screenW * 0.1781+screenW * 0.4109, screenH * 0.1802+screenH * 0.4204, tocolor(255, 255, 255, 255), 0, f, "center", "center", false, true, false, false, false)
    exports["buttons"]:createCustomButton("Rozpocznij", screenW * 0.4161, screenH * 0.555, screenW * 0.0797, screenH * 0.0370, tocolor(255, 255, 255, 255), false)
    exports["buttons"]:createCustomButton("Anuluj", screenW * 0.5042, screenH * 0.555, screenW * 0.0797, screenH * 0.0370, tocolor(255, 255, 255, 255), false)
end

function randomRepair()
    local rnd = math.random(1,2)
    if rnd == 1 then
        return "ko?o"
    elseif rnd == 2 then
        return "elektryka"
    end
    return false
end

addEventHandler("onClientClick", root, function(btn, state)
    if btn == "left" and state == "down" then
        if isMouseIn(screenW * 0.5042, screenH * 0.555, screenW * 0.0797, screenH * 0.0370) and showed == true then
            showed = false
            showCursor(false)
            removeEventHandler("onClientRender", root, gui)
        elseif isMouseIn(screenW * 0.4161, screenH * 0.555, screenW * 0.0797, screenH * 0.0370) and showed == true and punkt ~= true then
            local random = randomRepair()
            if random == "ko?o" then
                w_marker = createMarker(-183.2339630127, 1063.8413085938, 0.33673763275146-1, "cylinder", 1.1, 0, 255, 0, 75)
                setElementDimension(w_marker, 66)
                w_blip = createBlipAttachedTo(w_marker, 41)
                punkt = true
            elseif random == "elektryka" then
                e_marker = createMarker(-166.5654296875, 1075.7213134766, 0.33673763275146-1, "cylinder", 1.1, 0, 255, 0, 75)
                setElementDimension(e_marker, 66)
                e_blip = createBlipAttachedTo(e_marker, 41)
                punkt = true
            end
            showed = false
            showCursor(false)
            removeEventHandler("onClientRender", root, gui)
        end
     end
end)

addEventHandler("onClientMarkerHit", resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source and getElementDimension(source) ~= getElementDimension(hit) then return end
    if source == m_marker then
        addEventHandler("onClientRender", root, gui)
        showed = true
        showCursor(true)
    elseif source == e_marker then
        addEventHandler("onClientRender", root, gui_e) 
        showCursor(true)
        s_icons = true
    elseif source == w_marker then
        triggerServerEvent("kolo:busy", localPlayer)
        local rnd = math.random(1,#kola)
        local x,y,z = kola[rnd][1], kola[rnd][2], kola[rnd][3]
        marker = createMarker(x, y, z-1, "cylinder", 1.1, 0, 255, 0, 75)
        setElementDimension(marker, 66)
        blip = createBlipAttachedTo(marker, 41)
        destroyElement(w_marker)
        w_marker = false
        destroyElement(w_blip)
        w_blip = false
    elseif source == marker then
        setElementFrozen(localPlayer, true)
        setPedAnimation(localPlayer, "CAMERA", "camstnd_to_camcrch", -1, false, false)
        setTimer(function()
            setElementFrozen(localPlayer, false)
            destroyElement(marker)
            destroyElement(blip)
            triggerServerEvent("kolo:busy", localPlayer, true)
            marker = false
            blip = false
            zamowienie = zamowienie+1
            konieczamowienia()
            punkt = false
            setPedAnimation(localPlayer, "CARRY", "liftup", 0.0, false, false, false, false )
        end, 3500, 1)
    end
end)

function stopJob()
    if getElementData(localPlayer, "user:job") ~= 1 then return end
    if w_marker and isElement(w_marker) then
        destroyElement(w_marker)
        w_marker = false
    end
    if w_blip and isElement(w_blip) then
        destroyElement(w_blip)
        w_blip = false
    end
    if m_marker and isElement(m_marker) then
        destroyElement(m_marker)
        m_marker = false
    end
    if e_marker and isElement(e_marker) then
        destroyElement(e_marker)
        e_marker = false
    end
    if e_blip and isElement(e_blip) then
        destroyElement(e_blip)
        e_blip = false
    end
    if marker and isElement(marker) then
        destroyElement(marker)
        marker = false
    end
    if blip and isElement(blip) then
        destroyElement(blip)
        blip = false
    end
    if marker_bus and isElement(marker_bus) then
        destroyElement(marker_bus)
        marker_bus = false
    end
    if blip_bus and isElement(blip_bus) then
        destroyElement(blip_bus)
        blip_bus = false
    end
    if marker_pociag and isElement(marker_pociag) then
        destroyElement(marker_pociag)
        marker_pociag = false
    end
    if blip_pociag and isElement(blip_pociag) then
        destroyElement(blip_pociag)
        blip_pociag = false
    end
    triggerServerEvent("kolo:busy", localPlayer, true)
    removeEventHandler("onClientRender", root, gui_main)
    removeEventHandler("onClientRender", root, gui_e)
    if isCursorShowing() then
        showCursor(false)
    end
    x, y = screenW * 0.2625, screenH * 0.3926
    trzymam = false
    git = false
    x2, y2 = screenW * 0.2625, screenH * 0.4815
    trzymam2 = false
    git2 = false
    destroyPeds()
end
addEvent("stopjob:bus", true)
addEventHandler("stopjob:bus", root, stopJob)



notepad S:


--[[
    autor: Asper & Payro
    for: Own World
    All rights reserved!
]]

local job_name = "Praca w zajezdni"
local job_level1_desc = "\nWymagania:\nBrak\n\nPraca na pierwszym poziomie polega na diagnozie\n oraz naprawie zniszczonych cz??ci w autobusach (Bus)."
local job_level2_desc = "\nWymagania:\nPrawo jazdy kategorii: C\n\nPraca na drugim poziomie polega na prowadzeniu autobus?w (Bus)\n po wyznaczonej trasie. Przy ka?dym przystanku czekaj? ludzie, kt?rym\n nale?y sprzeda? odpowiednie bilety."
local job_level3_desc = "\nWymagania:\nPrawo jazdy kategorii: -\n\nPraca na trzecim poziomie polega na prowadzeniu poci?gu (Freight)\n po wyznaczonej trasie. Przy ka?dym peronie\n nale?y si? zatrzyma? i dojecha? do ostatniego przystanku."
local job_uid = 1
local job_level1_prawko = true
local job_level2_prawko = "C"
local job_level3_prawko = true
local job_level1_points = 0
local job_level2_points = 4000
local job_level3_points = 18000
local job_data = "points:busy"

local starts = {
    {ped={-175.68849182129, 1082.9473876953, 19.871862411499, 180}, marker={-175.44454956055, 1081.5822753906, 19.871862411499}},
}

function load_fabryka_table()
    local q = exports.rpg_mysql:mysql_query("select * from rpg_accounts order by punkty_busy desc")
    local ranking_table = {}

    for i = 1,5 do
        table.insert(ranking_table, q[i]["username"]..": "..q[i]["punkty_busy"].." punkt?w")
    end

    return ranking_table
end

addEventHandler("onResourceStart", resourceRoot, function ()
    for i,v in ipairs(starts) do
        local x1,y1,z1, rz = unpack(v.ped)
        local ped = createPed(165, x1, y1, z1, rz)
        setElementData(ped, "name", "Pracodawca")
        setElementFrozen(ped, true)
        setElementDimension(ped, 72)

        local x2,y2,z2 = unpack(v.marker)
        local marker = createMarker(x2, y2, z2-1, "cylinder", 1.1, 255, 255, 255, 100)

        addEventHandler("onMarkerHit", marker, markerHit)
        addEventHandler("onMarkerLeave", marker, markerLeave)
        setElementDimension(marker, 72)
    end
end)

function markerHit(hit, dim)
    if getElementType(hit) ~= "player" then return end
    if isPedInVehicle(hit) then return end
    triggerClientEvent(hit, "createJobsWindow", hit, {job_name, job_uid,  job_level1_desc, job_level2_desc, job_level3_desc, job_level1_points, job_level2_points, job_level3_points, job_level1_prawko, job_level2_prawko, job_level3_prawko, job_data})
end

function markerLeave(hit, dim)
    if getElementType(hit) ~= "player" then return end
    if isPedInVehicle(hit) then return end
    triggerClientEvent(hit, "destroyJobsWindow", hit)
end

local bus = {}
local kolo = {}

local busek = {}
local pociag = {}

addEvent("kolo:busy", true)
addEventHandler("kolo:busy", root, function(x)
    if not kolo[source] and not x then
        kolo[source] = createObject(1098,0,0,0)
          setObjectScale(kolo[source], 0.7)
          exports["bone_attach"]:attachElementToBone(kolo[source], source, 11, 0.1,-0.1,0)
          setPedWalkingStyle(source, 66)
    else
        if not kolo[source] then return end
        destroyElement(kolo[source])
        kolo[source] = false
        setPedWalkingStyle(source, 0)
    end
end)

local random_respawn = {
{-130.12004089355, 1076.8944091797, 19.873949050903},
{-140.20402526855, 1076.8944091797, 19.873949050903},
{-150.44155883789, 1076.8944091797, 19.873949050903},
}

addEventHandler("onPlayerStartJob", root, function(_,level)
    if getElementData(source, "user:job") ~= job_uid then return end
    if level == 1 then
        setElementFrozen(source, true)
        fadeCamera(source, false)
        local player = source
        setTimer(function()
            if player and isElement(player) then
                setElementFrozen(player, false)
                setElementPosition(player, -182.91058349609, 1073.9747314453, 0.4162010550499)
                setElementDimension(player, 66)
                fadeCamera(player, true)
                bus[player] = createVehicle(431, -166.5595703125, 1069.328125, 1.2720873355865, 0, 0, 0)
                setVehicleLocked(bus[player], true)
                setElementDimension(bus[player], 66)
                setElementAlpha(bus[player], 0)
                setElementCollisionsEnabled(bus[player], false)
                triggerClientEvent(player, "auto:bus", player, bus[player])
                setElementFrozen(bus[player], true)
            end
        end, 2500, 1)
    elseif level == 2 then
        local result = exports.rpg_mysql:mysql_query("SELECT * FROM rpg_prawka WHERE serial=? AND aktywnydo>NOW()", getPlayerSerial(source))
        if #result > 0 then
            outputChatBox("Posiadasz zabrane prawo jazdy od "..result[1].aktywnyod.." do "..result[1].aktywnydo.." zabrane przez "..result[1].admin.." z powodu "..result[1].powod, source, 255, 0, 0)
            return
        else
            exports.rpg_mysql:mysql_query("DELETE FROM rpg_prawka WHERE serial=?", getPlayerSerial(source))
        end
        setElementFrozen(source, true)
        fadeCamera(source, false)
        local player = source
        setTimer(function()
            if player and isElement(player) then
                setElementFrozen(player, false)
                setElementDimension(player, 0)
                fadeCamera(player, true)
                local rnd = math.random(1,#random_respawn)
                local x,y,z = random_respawn[rnd][1], random_respawn[rnd][2], random_respawn[rnd][3]
                busek[player] = createVehicle(431, x, y, z, 0, 0, 360)
                setElementData(busek[player], "owner", player)
                triggerClientEvent(root, "ghost:vehicle", root, busek[player])
                setVehicleColor(busek[player], 255, 75, 0, 255, 75, 0)
                warpPedIntoVehicle(player, busek[player])
                setVehicleEngineState(busek[player], false)
                setElementData(busek[player], "veh:job", true)
            end
        end, 2500, 1)
    elseif level == 3 then
        setElementFrozen(source, true)
        fadeCamera(source, false)
        local player = source
        setTimer(function()
            if player and isElement(player) then
                setElementFrozen(player, false)
                setElementDimension(player, 0)
                fadeCamera(player, true)
                local x,y,z = -149.36463928223, 1283.0126953125, 22.496114730835, 96.718994140625
                pociag[player] = createVehicle(538, x, y, z, 0, 0, 360)
                setElementData(pociag[player], "owner", player)
                setVehicleColor(pociag[player], 255, 75, 0, 255, 75, 0)
                warpPedIntoVehicle(player, pociag[player])
                setVehicleEngineState(pociag[player], false)
                setElementData(pociag[player], "veh:job", true)
            end
        end, 2500, 1)
    end
    triggerClientEvent(source, "startjob:bus", resourceRoot, _, level)
end)

addEventHandler("onVehicleStartEnter", resourceRoot, function(player, seat)
    if seat ~= 0 then return end
    local owner = getElementData(source, "owner")
    if owner and owner ~= player then
        cancelEvent()
    end
end)

function stopJob(player,window)
    if bus[player] and isElement(bus[player]) then
        destroyElement(bus[player])
        bus[player] = false
    end
    if busek[player] and isElement(busek[player]) then
        destroyElement(busek[player])
        busek[player] = false
    end
    if pociag[player] and isElement(pociag[player]) then
        destroyElement(pociag[player])
        pociag[player] = false
    end
    triggerClientEvent(player, "stopjob:bus", player)
    setElementData(player, "user:job", false)
    if not window then
        setTimer(function()
            if player and isElement(player) then
                exports["rpg_noti"]:createNotification(player, "error", "Praca zosta?a zako?czona")
                if getElementDimension(player) ~= 72 then
                    fadeCamera(player, false)
                    setElementFrozen(player, true)
                    setTimer(function()
                        setElementPosition(player, -175.27838134766, 1076.9260253906, 19.871862411499)
                        setElementInterior(player, 0)
                        setElementDimension(player, 72)
                    end, 1000, 1)
                    setTimer(function()
                        fadeCamera(player, true)
                        setElementFrozen(player, false)
                    end, 2000, 1)
                end
            end
        end, 150, 1)
    end
end
addEvent("stopjob:bus", true)
addEventHandler("stopjob:bus", root, stopJob)

addEventHandler("onPlayerResign", root, function(player,window)
    if getElementData(player, "user:job") ~= job_uid then return end
    stopJob(player, window)
end)

addEventHandler("onPlayerWasted", root, function()
    if getElementData(source, "user:job") ~= job_uid then return end
    stopJob(source,false)
end)

addEventHandler("onPlayerQuit", root, function()
    stopJob(source)
end)

addEventHandler("onVehicleExit", resourceRoot, function(player)
    if busek[player] and source == busek[player] or pociag[player] and source == pociag[player] then
        stopJob(player)
    end
end)

addEventHandler("onVehicleStartEnter", resourceRoot, function(player)
    cancelEvent()
end)

addEventHandler("onPlayerQuit", root, function()
    local player = source
    if bus[player] and isElement(bus[player]) then
        destroyElement(bus[player])
        bus[player] = false
    end
    if busek[player] and isElement(busek[player]) then
        destroyElement(busek[player])
        busek[player] = false
    end
    if pociag[player] and isElement(pociag[player]) then
        destroyElement(pociag[player])
        pociag[player] = false
    end
end)

addEvent("give:moneyANDpoints", true)
addEventHandler("give:moneyANDpoints", resourceRoot, function(player, money, points)
    local uid = getElementData(player, "user:uid")
    local q = exports.rpg_mysql:mysql_query("update rpg_accounts set punkty_busy=punkty_busy+?, jobmoney=jobmoney+? where uid=?", points, money, uid)
end)


Komentarz Barcioo dodany 2018-07-25, 18:14Dodaje tag [.lua] [./lua]
Ostatnio zmieniony przez Barcioo 2018-07-25, 18:13, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 17:15


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

db3 daj

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 17:17


Awruk2003







Wiek: 36
Na forum: 3631 dni
Posty: 7
Nick w MP: Suchy

Piwa: 13

Respekt: 50

nie rozumiem? jakie db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 18:24


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

/debugscript 3 i wtedy kliknij dany poziom w pracy i podaj b??d jaki wyskoczy z db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 18:45


Awruk2003







Wiek: 36
Na forum: 3631 dni
Posty: 7
Nick w MP: Suchy

Piwa: 13

Respekt: 50

warning [serwer]/rpg_jobs/c.lua:115: Bad Argument getElemntdata [Expextec string at argument 2 got nil]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 18:50


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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

podaj CA?Y b??d db3 - wklej go z konsoli z serwera albo przepisz

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 18:55


Awruk2003







Wiek: 36
Na forum: 3631 dni
Posty: 7
Nick w MP: Suchy

Piwa: 13

Respekt: 50

WARNING: [serwer]/rpg_jobs\c.lua:115 Bad argument @ 'getElementData' [Expected string at argument 2,got nil]

ERROR: [serwer]\rpg_jobs\c.lua: attempt to compare boolean with number

[ Dodano: 2018-07-25, 18:56 ]
tylko to cos takiego :/

Postaw piwo autorowi tego posta
 

 
Tagi: bug :: praca :: dorywczna
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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