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: 25
Na forum: 2225 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()
screenWscreenH guiGetScreenSize()
pxpy = (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.52101.0727.54},
}

local districtsBus2 = {
        {-2004.80108.4627.75},
        {-2043.68110.9828.87},
        {-2120.67112.1735.42},
        {-2161.23101.3535.42},
        {-2168.4841.8235.41},
        {-2169.58, -47.5635.42},
        {-2169.77, -139.7035.42},
        {-2211.85, -188.2635.47},
        {-2258.61, -200.2635.42},
        {-2260.54, -284.0646.21},
        {-2260.09, -365.2751.11},
        {-2209.82, -444.5850.96},
        {-2153.84, -501.2841.18},
        {-2074.92, -572.1930.58},
        {-1987.00, -583.4126.18},
        {-1907.55, -584.6624.69},
        {-1884.17, -564.0024.68},
        {-1884.49, -501.8625.42},
        {-1884.01, -407.3337.90},
        {-1895.05, -273.0038.49},
        {-1894.20, -140.8938.49},
        {-1889.84, -39.2638.47},
        {-1883.2857.7038.49},
        {-1869.46146.2638.49},
        {-1846.32244.2531.83},
        {-1820.50328.4718.74},
        {-1811.42376.6417.25},
        {-1850.83416.1117.25},
        {-1884.07381.2220.76},
        {-1933.87346.5632.48},
        {-1995.13348.4935.35},
        {-2007.59308.1635.23},
        {-2008.24240.1629.32},
        {-2009.20149.0927.79},
        {-2009.37107.9327.89},
        {-1993.08102.3827.90},
}


local districtsBus3 = {
        {-2004.80108.4627.75},
        {-2043.68110.9828.87},
        {-2120.67112.1735.42},
        {-2161.23101.3535.42},
        {-2168.4841.8235.41},
        {-2169.58, -47.5635.42},
        {-2169.77, -139.7035.42},
        {-2211.85, -188.2635.47},
        {-2258.61, -200.2635.42},
        {-2260.54, -284.0646.21},
        {-2260.09, -365.2751.11},
        {-2209.82, -444.5850.96},
        {-2153.84, -501.2841.18},
        {-2074.92, -572.1930.58},
        {-1987.00, -583.4126.18},
        {-1907.55, -584.6624.69},
        {-1884.17, -564.0024.68},
        {-1884.49, -501.8625.42},
        {-1884.01, -407.3337.90},
        {-1895.05, -273.0038.49},
        {-1894.20, -140.8938.49},
        {-1889.84, -39.2638.47},
        {-1883.2857.7038.49},
        {-1869.46146.2638.49},
        {-1846.32244.2531.83},
        {-1820.50328.4718.74},
        {-1811.42376.6417.25},
        {-1850.83416.1117.25},
        {-1884.07381.2220.76},
        {-1933.87346.5632.48},
        {-1995.13348.4935.35},
        {-2007.59308.1635.23},
        {-2008.24240.1629.32},
        {-2009.20149.0927.79},
        {-2009.37107.9327.89},
        {-1993.08102.3827.90},
        {-1983.46105.4027.91},
        {-1998.50109.7927.89},
        {-2010.3590.6827.76},
}


local m1 createMarker(-1961.7098.4627.69-1"cylinder"1.50,144,255,75)
local gui false

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

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

addEventHandler("onClientClick"root, function(btnstate)
if btn == "left" and state == "down" then
   if gui == true then
        if mysz(813*px528*py158*px30*pythen
        removeEventHandler("onClientRender"rootgui_transportt)
        showCursor(false)
        gui false
        triggerServerEvent("startJobSV"localPlayerlocalPlayer)
        elseif mysz(964*px202*py16*px19*pythen
        removeEventHandler("onClientRender"rootgui_transportt)
        showCursor(false)
        gui false
        end
    end
    end
end)


function gui_transportt()
    exports["buttons"]:createCustomWindow("Praca Dorywcza - StreetView"353*px202*py629*px374*pytocolor(255255255255), false) 
    dxDrawText("X"962*px210*py982*px221*pytocolor(255,255,255225), 1*px"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawRectangle(368*px240*py157*px318*pytocolor(00055), false)
    dxDrawText("Wymagania\n\n\n- Prawo jazdy kat. B"368*px240*py525*px558*pytocolor(255255255255), 1*px"default""center""center"falsefalsefalsefalsefalse)
    

    exports["buttons"]:createCustomButton("Rozpocznij prac?&#8482;"813*px528*py158*px30*py)

    if mysz(964*px210*py16*px19*pythen
    dxDrawText("X"962*px210*py982*px221*pytocolor(255,255,25522), 1*px"default-bold""center""center"falsefalsefalsefalsefalse)
    else
    dxDrawText("X"962*px210*py982*px221*pytocolor(255,255,255225), 1*px"default-bold""center""center"falsefalsefalsefalsefalse)
    end

    dxDrawRectangle(813*px230*py159*px287*pytocolor(00055), false)
    dxDrawText("Informacje\n\n\nPraca polega na\nbadaniu mapy pojazdem\ndo tego przeznaczonym"813*px231*py972*px517*pytocolor(255255255255), 1*px"default""center""center"falsefalsefalsefalsefalse)
end



local jobTarget
local jobMarker
local jobVehicle
local maxTarget #districtsBus
function odleglosc()
    local x,y,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(jobMarkerthen
        destroyElement(jobMarker)
        jobMarker nil
    end
    if jobBlip and isElement(jobBlipthen
        destroyElement(jobBlip)
        jobBlip nil
    end
    if jobTarget and isElement(jobTargetthen
        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(elmd)
    local xd=getElementData(el,"sv")
    if el ~= localPlayer or not md then return end
    if jobTarget maxTarget and getPedOccupiedVehicle(elthen return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(elthen 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"elkasa)
        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(jobMarkerthen
        destroyElement(jobMarker)
        jobMarker nil
    end
    if jobBlip and isElement(jobBlipthen
        destroyElement(jobBlip)
        jobBlip nil
    end


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

    addEventHandler("onClientMarkerHit"jobMarkerbusDriver)
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(plrseat)
    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 screenWscreenH 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,)
createBlip(-1961.7098.4627.6946,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(elthen 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,getElementPosition(el)
    local bus createVehicle(400, -1963.41106.0127.330.00.090.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,elfalse)
    triggerClientEvent(el"STARTJobBus"resourceRootbus)

    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[clientthen
          if isElement(vehs[client]) then destroyElement(vehs[client]) end
     end
end)

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

addEvent("onPlayerQuit"true)
addEventHandler "onPlayerQuit"getRootElement(), function()
     if vehs[sourcethen
          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: 4429 dni
Posty: 3410

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 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