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

Wysłany: 2021-02-04, 23:46


Patryk545







Wiek: 26
Na forum: 2365 dni
Posty: 36
Nick w MP: Patryk545

Piwa: 1

Respekt: 50

Witam chcia?bym aby kto? pom?g? z tym ?eby pieni?dze sz?y do bankomatu a nie tak jakby na konto gracza (portfela). Chcia?bym jeszcze wiedzie? jak doda? wymagania do tej pracy. Kod podaj? ni?ej.
c.lua

--[[
Praca busa

]]--

sx,sy = guiGetScreenSize()
screenW, screenH = guiGetScreenSize()
px, py = (screenW/1366),(screenH/768)

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


local code = "StreetView"
local districtsBus = {
{-1980.01,102.42,27.21},
{-1990.61,143.75,27.06},
{-2000.20,193.23,27.06},
{-1999.88,275.62,32.47},
{-2000.75,399.76,34.54},
{-2001.22,502.10,34.53},
{-2002.00,616.51,34.52},
{-2000.80,741.70,44.65},
{-2001.62,805.51,45.01},
{-2063.04,810.21,62.82},
{-2145.20,809.54,68.98},
{-2233.90,809.84,48.82},
{-2270.64,736.77,48.82},
{-2269.46,584.38,35.52},
{-2232.24,561.70,34.53},
{-2227.88,506.82,34.55},
{-2230.85,452.69,34.52},
{-2274.16,402.25,34.24},
{-2256.68,349.16,32.47},
{-2217.25,318.75,34.70},
{-2150.78,316.12,34.68},
{-2148.42,196.08,34.69},
{-2154.87,115.83,34.70},
{-2078.75,108.29,31.95},
{-2020.10,106.85,27.20},
{-1992.52, 101.07, 27.54},
}

local districtsBus2 = {
        {-2004.80, 108.46, 27.75},
        {-2043.68, 110.98, 28.87},
        {-2120.67, 112.17, 35.42},
        {-2161.23, 101.35, 35.42},
        {-2168.48, 41.82, 35.41},
        {-2169.58, -47.56, 35.42},
        {-2169.77, -139.70, 35.42},
        {-2211.85, -188.26, 35.47},
        {-2258.61, -200.26, 35.42},
        {-2260.54, -284.06, 46.21},
        {-2260.09, -365.27, 51.11},
        {-2209.82, -444.58, 50.96},
        {-2153.84, -501.28, 41.18},
        {-2074.92, -572.19, 30.58},
        {-1987.00, -583.41, 26.18},
        {-1907.55, -584.66, 24.69},
        {-1884.17, -564.00, 24.68},
        {-1884.49, -501.86, 25.42},
        {-1884.01, -407.33, 37.90},
        {-1895.05, -273.00, 38.49},
        {-1894.20, -140.89, 38.49},
        {-1889.84, -39.26, 38.47},
        {-1883.28, 57.70, 38.49},
        {-1869.46, 146.26, 38.49},
        {-1846.32, 244.25, 31.83},
        {-1820.50, 328.47, 18.74},
        {-1811.42, 376.64, 17.25},
        {-1850.83, 416.11, 17.25},
        {-1884.07, 381.22, 20.76},
        {-1933.87, 346.56, 32.48},
        {-1995.13, 348.49, 35.35},
        {-2007.59, 308.16, 35.23},
        {-2008.24, 240.16, 29.32},
        {-2009.20, 149.09, 27.79},
        {-2009.37, 107.93, 27.89},
        {-1993.08, 102.38, 27.90},
}


local districtsBus3 = {
        {-2004.80, 108.46, 27.75},
        {-2043.68, 110.98, 28.87},
        {-2120.67, 112.17, 35.42},
        {-2161.23, 101.35, 35.42},
        {-2168.48, 41.82, 35.41},
        {-2169.58, -47.56, 35.42},
        {-2169.77, -139.70, 35.42},
        {-2211.85, -188.26, 35.47},
        {-2258.61, -200.26, 35.42},
        {-2260.54, -284.06, 46.21},
        {-2260.09, -365.27, 51.11},
        {-2209.82, -444.58, 50.96},
        {-2153.84, -501.28, 41.18},
        {-2074.92, -572.19, 30.58},
        {-1987.00, -583.41, 26.18},
        {-1907.55, -584.66, 24.69},
        {-1884.17, -564.00, 24.68},
        {-1884.49, -501.86, 25.42},
        {-1884.01, -407.33, 37.90},
        {-1895.05, -273.00, 38.49},
        {-1894.20, -140.89, 38.49},
        {-1889.84, -39.26, 38.47},
        {-1883.28, 57.70, 38.49},
        {-1869.46, 146.26, 38.49},
        {-1846.32, 244.25, 31.83},
        {-1820.50, 328.47, 18.74},
        {-1811.42, 376.64, 17.25},
        {-1850.83, 416.11, 17.25},
        {-1884.07, 381.22, 20.76},
        {-1933.87, 346.56, 32.48},
        {-1995.13, 348.49, 35.35},
        {-2007.59, 308.16, 35.23},
        {-2008.24, 240.16, 29.32},
        {-2009.20, 149.09, 27.79},
        {-2009.37, 107.93, 27.89},
        {-1993.08, 102.38, 27.90},
        {-1983.46, 105.40, 27.91},
        {-1998.50, 109.79, 27.89},
        {-2010.35, 90.68, 27.76},
}


local m1 = createMarker(-1961.70, 98.46, 27.69-1, "cylinder", 1.5, 0,144,255,75)
local gui = false

addEventHandler("onClientMarkerHit", m1, function(el,md)
if el ~= localPlayer then return end
addEventHandler("onClientRender", root, gui_transportt)
showCursor(true)
gui = true
end)

addEventHandler("onClientMarkerLeave", m1, function(el,md)
if el ~= localPlayer then return end
removeEventHandler("onClientRender", root, gui_transportt)
showCursor(false)
gui = false
end)

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
   if gui == true then
        if mysz(813*px, 528*py, 158*px, 30*py) then
        removeEventHandler("onClientRender", root, gui_transportt)
        showCursor(false)
        gui = false
        triggerServerEvent("startJobSV", localPlayer, localPlayer)
        elseif mysz(964*px, 202*py, 16*px, 19*py) then
        removeEventHandler("onClientRender", root, gui_transportt)
        showCursor(false)
        gui = false
        end
    end
    end
end)


function gui_transportt()
    exports["buttons"]:createCustomWindow("Praca Dorywcza - StreetView", 353*px, 202*py, 629*px, 374*py, tocolor(255, 255, 255, 255), false) 
    dxDrawText("X", 962*px, 210*py, 982*px, 221*py, tocolor(255,255,255, 225), 1*px, "default-bold", "center", "center", false, false, false, false, false)
    dxDrawRectangle(368*px, 240*py, 157*px, 318*py, tocolor(0, 0, 0, 55), false)
    dxDrawText("Wymagania\n\n\n- Prawo jazdy kat. B", 368*px, 240*py, 525*px, 558*py, tocolor(255, 255, 255, 255), 1*px, "default", "center", "center", false, false, false, false, false)
    

    exports["buttons"]:createCustomButton("Rozpocznij prac?&#8482;", 813*px, 528*py, 158*px, 30*py)

    if mysz(964*px, 210*py, 16*px, 19*py) then
    dxDrawText("X", 962*px, 210*py, 982*px, 221*py, tocolor(255,255,255, 22), 1*px, "default-bold", "center", "center", false, false, false, false, false)
    else
    dxDrawText("X", 962*px, 210*py, 982*px, 221*py, tocolor(255,255,255, 225), 1*px, "default-bold", "center", "center", false, false, false, false, false)
    end

    dxDrawRectangle(813*px, 230*py, 159*px, 287*py, tocolor(0, 0, 0, 55), false)
    dxDrawText("Informacje\n\n\nPraca polega na\nbadaniu mapy pojazdem\ndo tego przeznaczonym", 813*px, 231*py, 972*px, 517*py, tocolor(255, 255, 255, 255), 1*px, "default", "center", "center", false, false, false, false, false)
end



local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus
function odleglosc()
    local x,y,z = getElementPosition(localPlayer)
    local mx,my,mz = getElementPosition(jobMarker)
    local distance = getDistanceBetweenPoints3D(x,y,z,mx,my,mz)
    if distance > 600 then
        addEventHandler("onClientRender",root,render2)
        setTimer(renderstop2,2000,1)
        --outputChatBox("Odjecha?&#8218;e?&#8250; za daleko od punktu.")
        finishJob()
    end
end
function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    if jobBlip and isElement(jobBlip) then
        destroyElement(jobBlip)
        jobBlip = nil
    end
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0

    end
if getElementData(localPlayer,"player:job") == code then
setElementData(localPlayer,"player:job",false)
end
triggerServerEvent("destroyVeh", localPlayer)
removeEventHandler("onClientRender",root,odleglosc)
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(),finishJob)
addEvent("finishJob",true)
addEventHandler("finishJob",root,function(plr)
if plr ~= localPlayer then return end
finishJob()
end)


function busDriver(el, md)
    local xd=getElementData(el,"sv")
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end

    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        setTimer(renderstop3,2000,1)
        
    else
        kasa = math.random(45000,55000)
        showMarker()
        playSoundFrontEnd(12)
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        triggerServerEvent("givePlayerMoney", el, kasa)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,2))
        setElementData(el,"player:sv", xd+1)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    if jobBlip and isElement(jobBlip) then
        destroyElement(jobBlip)
        jobBlip = nil
    end


    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)
    jobBlip = createBlip(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], 41)
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        ile2 = ile[1]
        ile3 = ile[2]
        ile4 = ile[3]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end

    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    trasa = math.random(1,3)
    if trasa==1 then
        districtsBus = districtsBus
    elseif trasa==2 then
        districtsBus = districtsBus2
    elseif trasa==3 then
        districtsBus = districtsBus3
    end
    maxTarget = #districtsBus
    addEventHandler("onClientRender",root,render1)
    setTimer(renderstop1,4000,1)
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "player:job") then
        setElementData(localPlayer, "player:job", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            addEventHandler("onClientRender",root,render3)
            setTimer(renderstop3,2000,1)
        end
    end
end)





----------------- EVENT HANDLER --------------

--addEventHandler("onClientRender",root,render1)
--setTimer(renderstop1,2000,1)



----------------- INFORMACJE DX --------------

local screenW, screenH = guiGetScreenSize()
function render1()
end

function render2()
end

function render3()
end

function render4()
end


----------------- KONIEC RENDERU! -----------

function renderstop1()
removeEventHandler("onClientRender",root,render1)
end

function renderstop2()
removeEventHandler("onClientRender",root,render2)
end

function renderstop3()
removeEventHandler("onClientRender",root,render3)
end

function renderstop4()
removeEventHandler("onClientRender",root,render4)
end


s.lua

local zone = createColSphere(-1963.61,106.22,27.69,1 )
createBlip(-1961.70, 98.46, 27.69, 46,2,0,0,0,0,0,275)
vehs = {}
local code = "StreetView"
veh_obj = {}

function removePreviousVehicles(plr)
    for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
        local sby = getElementData(v, "zrespilGracz")
        if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
            destroyElement(v)
        end
    end
end

addEvent("startJobSV", true)
addEventHandler("startJobSV", root, function(el)
    if getElementData(el, "vehicle_job_owner2") then
        return
    end
    if exports["pystories-ustawienia-praca"]:getVehicleLicense(el, "B") then 
    return 
    end 
    if getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("&#10008;#ffffff Parking zaj?ty czekaj a? wyjedzie!", el, 255, 0, 0, true) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1963.41, 106.01, 27.33, 0.0, 0.0, 90.4)
    local xd = getElementData(el,"sv") or 0
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100)
    setElementData(bus, "vehicle:mileage", math.random(500,8000))
    setVehicleHandling(bus, "maxVelocity", 80.0)
    setElementData(el,"player:job",code)
   setTimer(warpPedIntoVehicle,200,1,el,bus)
    toggleControl(el,"enter_exit",false)
     setTimer(toggleControl,2000,1,el, "enter_exit",true)
    setTimer(setElementFrozen,2000,1,el, false)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

    vehs[el] = bus
    veh_obj[bus] = createObject(3031,0,0,0)
    attachElements(veh_obj[bus],bus,0.3,-0.9,1.6,0,0,90)
 end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
    local pojazd = getPedOccupiedVehicle(client)
    if pojazd then
        destroyElement(pojazd)
    end
end)

addEventHandler("onPlayerVehicleExit",resourceRoot,function()
destroyElement(source)
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
     if vehs[client] then
          if isElement(vehs[client]) then destroyElement(vehs[client]) end
     end
end)

addEventHandler("onElementDestroy",resourceRoot,function()
  if getElementType(source) == "vehicle" then
    if veh_obj[source] then destroyElement(veh_obj[source]); veh_obj[source] = nil end
  end
end)

addEvent("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-05, 08:15


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Postaw piwo autorowi tego posta
 

 
Tagi: zarobki :: pracy :: bankomatu.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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