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

Wysłany: 2018-02-25, 15:12


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

Witam, chcia?bym zmieni? w tej pracy to, ?e gdy wysi?d? z pojazdu podczas pracy to zostan? przeteleportowany na dane kordy oraz gdy ju? przejad? przez ostatni punkt, aby mnie teleportowa?o w dane kordy (ja juz sobie ustale w jakie). Co musz? dopisa? oraz gdzie lub prosz? to ju? dopisa?. Z g?ry dzi?kuje daje piwa za pomoc :)

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
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


addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    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)

--[[
Praca busa

]]--
local code = "StreetView"
local districtsBus = {
{-1986.92, 935.31, 45.30},
{-2002.48, 924.51, 45.30},
{-2008.31, 887.55, 45.30},
{-2008.17, 834.59, 45.30},
{-2007.89, 759.92, 45.30},
{-1984.33, 728.10, 45.30},
{-1913.74, 727.53, 45.30},
{-1895.93, 758.23, 45.30-0.2},
{-1895.81, 814.11, 35.51-0.4},
{-1895.44, 867.77, 35.02},
{-1895.12, 909.97, 35.02},
{-1868.51, 920.64, 35.02},
{-1814.47, 920.15, 24.74},
{-1790.50, 957.41, 24.73},
{-1790.08, 1042.79, 31.16-1},
{-1790.48, 1092.34, 45.30},
{-1747.34, 1100.14, 45.29},
{-1710.80, 1122.96, 44.09-0.8},
{-1710.91, 1170.81, 25.47-0.5},
{-1738.79, 1191.10, 24.98},
{-1806.16, 1190.50, 24.97},
{-1864.76, 1181.62, 44.22-0.8},
{-1941.06, 1181.27, 45.30},
{-1968.86, 1134.57, 50.21-0.4},
{-1969.36, 1079.88, 55.57},
{-1929.44, 1051.48, 50.92-0.3},
{-1888.07, 1040.56, 45.18-0.3},
{-1898.95, 973.68, 35.02},
{-1911.91, 934.74, 35.03-0.2},
{-1957.99, 934.49, 43.10-0.4},
{-1979.58, 941.75, 45.45-0.2},
{-1980.02, 955.66, 45.45-0.1},
}

local districtsBus2 = {
{-1940.01,921.71,39.24},
{-1918.25,921.77,35.30},
{-1873.55,920.85,34.40},
{-1830.21,921.74,27.66},
{-1792.37,920.30,24.13},
{-1750.56,919.85,24.13},
{-1703.84,919.37,24.12},
{-1608.36,920.03,6.91},
{-1571.94,919.95,6.45},
{-1557.97,897.63,6.41},
{-1561.05,847.03,6.41},
{-1560.72,792.25,6.41},
{-1561.59,706.85,6.42},
{-1561.71,636.45,6.42},
{-1561.69,548.99,6.41},
{-1581.02,476.50,6.41},
{-1640.80,416.68,6.40},
{-1688.51,369.31,6.41},
{-1736.65,321.10,6.41},
{-1761.54,324.92,6.72},
{-1799.57,363.97,16.42},
{-1841.32,405.57,16.39},
{-1866.00,414.77,16.40},
{-1883.92,385.32,19.00},
{-1888.02,359.35,23.60},
{-1923.19,345.56,30.49},
{-1972.00,348.54,33.71},
{-2000.67,367.25,34.40},
{-2000.15,408.43,34.39},
{-2000.26,455.13,34.39},
{-2000.71,510.18,34.39},
{-2001.49,561.81,34.39},
{-2001.77,641.63,38.29},
{-2002.10,717.69,44.72},
{-2002.42,773.01,44.68},
{-2002.10,841.61,44.67},
{-2001.19,897.08,44.67},
{-1985.10,922.65,44.65},
{-1981.08,949.85,44.82},
}


local districtsBus3 = {
{-1986.15,935.47,44.64},
{-1997.22,932.23,44.66},
{-2000.65,955.81,44.68},
{-2001.36,988.82,48.08},
{-2001.50,1031.64,55.07},
{-2001.57,1055.50,54.94},
{-2032.11,1079.15,54.95},
{-2069.78,1079.17,54.95},
{-2113.51,1079.33,54.96},
{-2162.22,1079.51,54.96},
{-2214.05,1079.71,54.96},
{-2268.87,1079.91,54.96},
{-2319.33,1082.72,54.94},
{-2397.18,1110.72,54.98},
{-2464.99,1116.94,54.95},
{-2539.95,1122.37,54.95},
{-2575.11,1120.57,54.93},
{-2589.79,1099.46,55.24},
{-2601.55,1074.21,61.19},
{-2608.33,1036.87,71.72},
{-2608.11,987.01,77.51},
{-2609.43,922.16,64.47},
{-2587.75,905.96,64.22},
{-2548.83,906.18,64.21},
{-2506.96,906.20,64.18},
{-2476.46,906.21,62.51},
{-2451.35,906.22,57.79},
{-2425.51,906.24,47.10},
{-2404.96,906.25,44.74},
{-2391.33,893.09,44.68},
{-2390.82,864.99,42.51},
{-2390.36,833.14,36.80},
{-2351.73,806.69,39.53},
{-2324.60,806.38,43.92},
{-2284.98,806.60,48.61},
{-2252.95,807.01,48.68},
{-2199.87,807.01,51.52},
{-2166.29,806.86,64.97},
{-2138.05,806.75,68.82},
{-2105.43,806.64,68.79},
{-2081.72,806.55,68.79},
{-2049.71,806.44,57.16},
{-2027.29,806.42,48.08},
{-2002.61,836.54,44.68},
{-2001.70,868.51,44.66},
{-2001.02,896.36,44.68},
{-1987.78,915.32,44.68},
{-1980.89,952.91,44.79},
}







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?e? 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)
    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)
        addEventHandler("onClientRender",root,render3)
        setTimer(renderstop3,2000,1)
        --outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        kasa = math.random(75,150)
        showMarker()
        playSoundFrontEnd(12)
        if getElementData(el,"player:premium") then
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 100 PLN.")
        triggerServerEvent("givePlayerMoney", el, kasa, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        else
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 75 PLN.")
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        triggerServerEvent("givePlayerMoney", el, kasa*1.3, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        end
    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)
    --outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
    --outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
    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)
            --outputChatBox("Zako?czy?e? prac?")
        end
    end
end)





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

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



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

local screenW, screenH = guiGetScreenSize()
function render1()
dxDrawText("Rozpocz??e? prac? StreetView,\n je?dzij po punktach i uzupe?niaj mape. \n Wylosowano mape nr: "..trasa, screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render2()
dxDrawText("Odjecha?e? zbyt daleko od punktu.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render3()
dxDrawText("Zako?czy?e? prac? StreetView.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render4()
dxDrawText("Za dojechanie do punktu otrzymujesz: "..kasa.."PLN", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
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


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Mallboro
Wysłany: 2018-02-25, 18:27


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

"Ziomal97" napisał/a:

Witam, chcia?bym zmieni? w tej pracy to, ?e gdy wysi?d? z pojazdu podczas pracy to zostan? przeteleportowany na dane kordy


addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, x, y, z)
end)


"Ziomal97" napisał/a:

oraz gdy ju? przejad? przez ostatni punkt, aby mnie teleportowa?o w dane kordy


Musisz zrobi? funkcj?, kt?ra sprawdzi ostatni punkt po czym wyst?pi funkcja powy?ej na teleportacj?,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomal97
Wysłany: 2018-02-25, 19:07


CjPomarancza

:-)






Wiek: 17
Na forum: 3325 dni
Posty: 90

Piwa: 12

Respekt: 60

Cytat:


Musisz zrobi? funkcj?, kt?ra sprawdzi ostatni punkt po czym wyst?pi funkcja powy?ej na teleportacj?,


Taka ma?a porada - by pobra? pozycj? u?ywasz
Więcej informacji znajdziesz w Wikipedii MTA:

getElementPosition
. Taki ma?y przyk?ad:

addEventHandler("onClientMarkerHit", root, function(he, md) 
if not getElementType(he) == 'vehicle' then 
return 
end
local gracz = getVehicleController(he)
if getElementPosition(marker) == x, y, z then 
destroyElement(he)
setElementPosition(gracz, x, y, z)
end
end)


Maga nie chce odbanowa? to si? za lua wzi??e?, czy podr?bka? :-D

Podpis
Pomogłem? Doceń mnie i postaw :piwo: :)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-25, 19:50


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

"Ciastuu?" napisał/a:

"Ziomal97" napisał/a:

Witam, chcia?bym zmieni? w tej pracy to, ?e gdy wysi?d? z pojazdu podczas pracy to zostan? przeteleportowany na dane kordy


addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, x, y, z)
end)


"Ziomal97" napisał/a:

oraz gdy ju? przejad? przez ostatni punkt, aby mnie teleportowa?o w dane kordy


Musisz zrobi? funkcj?, kt?ra sprawdzi ostatni punkt po czym wyst?pi funkcja powy?ej na teleportacj?,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Prawie dzia?a, gdy wysiadam 1 raz z autobusu to normalnie dzia?a, a nast?pnym razem buguje si? ca?y serwer i nie mo?na wej?? ani wyj?? z ?adnego pojazdu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-25, 20:01


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

"Ziomal97" napisał/a:

"Ciastuu?" napisał/a:

"Ziomal97" napisał/a:

Witam, chcia?bym zmieni? w tej pracy to, ?e gdy wysi?d? z pojazdu podczas pracy to zostan? przeteleportowany na dane kordy


addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, x, y, z)
end)


"Ziomal97" napisał/a:

oraz gdy ju? przejad? przez ostatni punkt, aby mnie teleportowa?o w dane kordy


Musisz zrobi? funkcj?, kt?ra sprawdzi ostatni punkt po czym wyst?pi funkcja powy?ej na teleportacj?,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Prawie dzia?a, gdy wysiadam 1 raz z autobusu to normalnie dzia?a, a nast?pnym razem buguje si? ca?y serwer i nie mo?na wej?? ani wyj?? z ?adnego pojazdu.


Nie ogl?da?em Twojego kodu, ale teraz dogl?daj?c to ju? masz spe?niaj?c? funkcj? za wysiadanie z pojazdu...

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            addEventHandler("onClientRender",root,render3)
            setTimer(renderstop3,2000,1)
            --outputChatBox("Zako?czy?e? prac?")
        end
    end
end)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomal97
Wysłany: 2018-02-25, 20:38


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

"Ciastuu?" napisał/a:

"Ziomal97" napisał/a:

"Ciastuu?" napisał/a:

"Ziomal97" napisał/a:

Witam, chcia?bym zmieni? w tej pracy to, ?e gdy wysi?d? z pojazdu podczas pracy to zostan? przeteleportowany na dane kordy


addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, x, y, z)
end)


"Ziomal97" napisał/a:

oraz gdy ju? przejad? przez ostatni punkt, aby mnie teleportowa?o w dane kordy


Musisz zrobi? funkcj?, kt?ra sprawdzi ostatni punkt po czym wyst?pi funkcja powy?ej na teleportacj?,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Prawie dzia?a, gdy wysiadam 1 raz z autobusu to normalnie dzia?a, a nast?pnym razem buguje si? ca?y serwer i nie mo?na wej?? ani wyj?? z ?adnego pojazdu.


Nie ogl?da?em Twojego kodu, ale teraz dogl?daj?c to ju? masz spe?niaj?c? funkcj? za wysiadanie z pojazdu...

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            addEventHandler("onClientRender",root,render3)
            setTimer(renderstop3,2000,1)
            --outputChatBox("Zako?czy?e? prac?")
        end
    end
end)

To jest ten kod dopisalem tutaj i nie dziala, napisz to po swojemu. Daje kolejne piwka :)
createBlip(-1754.13,962.74,24.88,46,2,255,0,0,255,0,100)

local m1 = createMarker(-1754.13,962.74,24.88-1, "cylinder", 1.5, 35, 142, 35,100)
local t = createElement('text')
setElementPosition(t,-1754.13,962.74,24.88)
setElementData(t,"name","PRACA: Kierowca PKS\nZAROBEK:\nGRACZ od 100PLN do 175 \n PREMIUM zarabia x1.3")
local vehs = {}

local code = "Autobusy"
        local zone = createColSphere( -1751.31,951.90,25.89, 6 )
addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner") then
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("[#00ff00INFORMACJA#ffffff]Kto? ju? zajmuje to miejsce, poczekaj a? odjedzie.",el,255,255,255,true) return end
    local x,y,z = getElementPosition(el)
    local autbus = createVehicle(437, -1751.31,951.90,25.89, 0.00, 0, 270 )
    setElementFrozen(el,true)
    setElementData(autbus,"vehicle:desc","Praca dorywcza\n Kierowca autobusu")
    setElementData(autbus, "vehicle_job_owner", el)
    setElementData(autbus, "vehicle:fuel", 100000)
    setElementData(autbus, "vehicle:mileage", math.random(1000,1233))
    setVehicleHandling(autbus, "maxVelocity", 80.0)
    setElementData(el,"player:job",code)
    --warpPedIntoVehicle( el, autobus)
    setTimer(warpPedIntoVehicle,200,1,el,autbus)
    setTimer(setElementFrozen,1000,1,el, false)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, autbus)

    vehs[el] = autbus
end)


addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) 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: 2018-02-25, 20:54


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Masz ten kod z tematu i tam Sobie zmie? gdzie ma teleportowa? po usuni?ciu pojazdu...
Doda?em Ci ju? to co powinno si? znajdywa? tylko przypominam, uzupe?nij to pozycj?

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
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


addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    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)
setElementPosition ( source, x, y, z )
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)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomal97
Wysłany: 2018-02-25, 21:05


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

"Ciastuu?" napisał/a:

Masz ten kod z tematu i tam Sobie zmie? gdzie ma teleportowa? po usuni?ciu pojazdu...
Doda?em Ci ju? to co powinno si? znajdywa? tylko przypominam, uzupe?nij to pozycj?

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
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


addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    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)
setElementPosition ( source, x, y, z )
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)

Dopisz mi to do tego kodu tutaj kordy na kt?rych ma sie ma respic postac po wysiadnieciu z autobousu i przy ostatnim pukncie to 2507.08,2265.14,10.82
createBlip(-1754.13,962.74,24.88,46,2,255,0,0,255,0,100)

local m1 = createMarker(-1754.13,962.74,24.88-1, "cylinder", 1.5, 35, 142, 35,100)
local t = createElement('text')
setElementPosition(t,-1754.13,962.74,24.88)
setElementData(t,"name","PRACA: Kierowca PKS\nZAROBEK:\nGRACZ od 100PLN do 175 \n PREMIUM zarabia x1.3")
local vehs = {}

local code = "Autobusy"
        local zone = createColSphere( -1751.31,951.90,25.89, 6 )
addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner") then
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("[#00ff00INFORMACJA#ffffff]Kto? ju? zajmuje to miejsce, poczekaj a? odjedzie.",el,255,255,255,true) return end
    local x,y,z = getElementPosition(el)
    local autbus = createVehicle(437, -1751.31,951.90,25.89, 0.00, 0, 270 )
    setElementFrozen(el,true)
    setElementData(autbus,"vehicle:desc","Praca dorywcza\n Kierowca autobusu")
    setElementData(autbus, "vehicle_job_owner", el)
    setElementData(autbus, "vehicle:fuel", 100000)
    setElementData(autbus, "vehicle:mileage", math.random(1000,1233))
    setVehicleHandling(autbus, "maxVelocity", 80.0)
    setElementData(el,"player:job",code)
    --warpPedIntoVehicle( el, autobus)
    setTimer(warpPedIntoVehicle,200,1,el,autbus)
    setTimer(setElementFrozen,1000,1,el, false)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, autbus)

    vehs[el] = autbus
end)


addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) 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: 2018-02-25, 21:12


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

W podanym przez Ciebie kodzie usun??e? t? funkcj?. U?yj teraz tego co Ci poda?em, aby wszystko by?o zgodne...

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
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


addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    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)
setElementPosition ( source, 2507.08, 2265.14, 10.82  )
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)


A, tu kod od tego jak zaliczy si? ostatni punkt... W razie b??d?w pisz bo nie wiem, czy to podzia?a gdy? pisze to z g?owy nie testuj?c na serwerze lokalnym...

--[[
Praca busa

]]--
local code = "StreetView"
local districtsBus = {
{-1986.92, 935.31, 45.30},
{-2002.48, 924.51, 45.30},
{-2008.31, 887.55, 45.30},
{-2008.17, 834.59, 45.30},
{-2007.89, 759.92, 45.30},
{-1984.33, 728.10, 45.30},
{-1913.74, 727.53, 45.30},
{-1895.93, 758.23, 45.30-0.2},
{-1895.81, 814.11, 35.51-0.4},
{-1895.44, 867.77, 35.02},
{-1895.12, 909.97, 35.02},
{-1868.51, 920.64, 35.02},
{-1814.47, 920.15, 24.74},
{-1790.50, 957.41, 24.73},
{-1790.08, 1042.79, 31.16-1},
{-1790.48, 1092.34, 45.30},
{-1747.34, 1100.14, 45.29},
{-1710.80, 1122.96, 44.09-0.8},
{-1710.91, 1170.81, 25.47-0.5},
{-1738.79, 1191.10, 24.98},
{-1806.16, 1190.50, 24.97},
{-1864.76, 1181.62, 44.22-0.8},
{-1941.06, 1181.27, 45.30},
{-1968.86, 1134.57, 50.21-0.4},
{-1969.36, 1079.88, 55.57},
{-1929.44, 1051.48, 50.92-0.3},
{-1888.07, 1040.56, 45.18-0.3},
{-1898.95, 973.68, 35.02},
{-1911.91, 934.74, 35.03-0.2},
{-1957.99, 934.49, 43.10-0.4},
{-1979.58, 941.75, 45.45-0.2},
{-1980.02, 955.66, 45.45-0.1},
}

local districtsBus2 = {
{-1940.01,921.71,39.24},
{-1918.25,921.77,35.30},
{-1873.55,920.85,34.40},
{-1830.21,921.74,27.66},
{-1792.37,920.30,24.13},
{-1750.56,919.85,24.13},
{-1703.84,919.37,24.12},
{-1608.36,920.03,6.91},
{-1571.94,919.95,6.45},
{-1557.97,897.63,6.41},
{-1561.05,847.03,6.41},
{-1560.72,792.25,6.41},
{-1561.59,706.85,6.42},
{-1561.71,636.45,6.42},
{-1561.69,548.99,6.41},
{-1581.02,476.50,6.41},
{-1640.80,416.68,6.40},
{-1688.51,369.31,6.41},
{-1736.65,321.10,6.41},
{-1761.54,324.92,6.72},
{-1799.57,363.97,16.42},
{-1841.32,405.57,16.39},
{-1866.00,414.77,16.40},
{-1883.92,385.32,19.00},
{-1888.02,359.35,23.60},
{-1923.19,345.56,30.49},
{-1972.00,348.54,33.71},
{-2000.67,367.25,34.40},
{-2000.15,408.43,34.39},
{-2000.26,455.13,34.39},
{-2000.71,510.18,34.39},
{-2001.49,561.81,34.39},
{-2001.77,641.63,38.29},
{-2002.10,717.69,44.72},
{-2002.42,773.01,44.68},
{-2002.10,841.61,44.67},
{-2001.19,897.08,44.67},
{-1985.10,922.65,44.65},
{-1981.08,949.85,44.82},
}


local districtsBus3 = {
{-1986.15,935.47,44.64},
{-1997.22,932.23,44.66},
{-2000.65,955.81,44.68},
{-2001.36,988.82,48.08},
{-2001.50,1031.64,55.07},
{-2001.57,1055.50,54.94},
{-2032.11,1079.15,54.95},
{-2069.78,1079.17,54.95},
{-2113.51,1079.33,54.96},
{-2162.22,1079.51,54.96},
{-2214.05,1079.71,54.96},
{-2268.87,1079.91,54.96},
{-2319.33,1082.72,54.94},
{-2397.18,1110.72,54.98},
{-2464.99,1116.94,54.95},
{-2539.95,1122.37,54.95},
{-2575.11,1120.57,54.93},
{-2589.79,1099.46,55.24},
{-2601.55,1074.21,61.19},
{-2608.33,1036.87,71.72},
{-2608.11,987.01,77.51},
{-2609.43,922.16,64.47},
{-2587.75,905.96,64.22},
{-2548.83,906.18,64.21},
{-2506.96,906.20,64.18},
{-2476.46,906.21,62.51},
{-2451.35,906.22,57.79},
{-2425.51,906.24,47.10},
{-2404.96,906.25,44.74},
{-2391.33,893.09,44.68},
{-2390.82,864.99,42.51},
{-2390.36,833.14,36.80},
{-2351.73,806.69,39.53},
{-2324.60,806.38,43.92},
{-2284.98,806.60,48.61},
{-2252.95,807.01,48.68},
{-2199.87,807.01,51.52},
{-2166.29,806.86,64.97},
{-2138.05,806.75,68.82},
{-2105.43,806.64,68.79},
{-2081.72,806.55,68.79},
{-2049.71,806.44,57.16},
{-2027.29,806.42,48.08},
{-2002.61,836.54,44.68},
{-2001.70,868.51,44.66},
{-2001.02,896.36,44.68},
{-1987.78,915.32,44.68},
{-1980.89,952.91,44.79},
}







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?e? 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)
    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)
        addEventHandler("onClientRender",root,render3)
        setTimer(renderstop3,2000,1)
        outputChatBox("* Zako?czy?e?/a? prac?.")
        setElementPosition ( plr, 2507.08, 2265.14, 10.82  )
    else
        kasa = math.random(75,150)
        showMarker()
        playSoundFrontEnd(12)
        if getElementData(el,"player:premium") then
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 100 PLN.")
        triggerServerEvent("givePlayerMoney", el, kasa, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        else
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 75 PLN.")
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        triggerServerEvent("givePlayerMoney", el, kasa*1.3, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        end
    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)
    --outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
    --outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
    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)
            outputChatBox("Zako?czy?e? prac?")
            setElementPosition ( plr, 2507.08, 2265.14, 10.82  )
        end
    end
end)





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

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



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

local screenW, screenH = guiGetScreenSize()
function render1()
dxDrawText("Rozpocz??e? prac? StreetView,\n je?dzij po punktach i uzupe?niaj mape. \n Wylosowano mape nr: "..trasa, screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render2()
dxDrawText("Odjecha?e? zbyt daleko od punktu.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render3()
dxDrawText("Zako?czy?e? prac? StreetView.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render4()
dxDrawText("Za dojechanie do punktu otrzymujesz: "..kasa.."PLN", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
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


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomal97
Wysłany: 2018-02-25, 21:45


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

"Ciastuu?" napisał/a:

W podanym przez Ciebie kodzie usun??e? t? funkcj?. U?yj teraz tego co Ci poda?em, aby wszystko by?o zgodne...

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
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


addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    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)
setElementPosition ( source, 2507.08, 2265.14, 10.82  )
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)


A, tu kod od tego jak zaliczy si? ostatni punkt... W razie b??d?w pisz bo nie wiem, czy to podzia?a gdy? pisze to z g?owy nie testuj?c na serwerze lokalnym...

--[[
Praca busa

]]--
local code = "StreetView"
local districtsBus = {
{-1986.92, 935.31, 45.30},
{-2002.48, 924.51, 45.30},
{-2008.31, 887.55, 45.30},
{-2008.17, 834.59, 45.30},
{-2007.89, 759.92, 45.30},
{-1984.33, 728.10, 45.30},
{-1913.74, 727.53, 45.30},
{-1895.93, 758.23, 45.30-0.2},
{-1895.81, 814.11, 35.51-0.4},
{-1895.44, 867.77, 35.02},
{-1895.12, 909.97, 35.02},
{-1868.51, 920.64, 35.02},
{-1814.47, 920.15, 24.74},
{-1790.50, 957.41, 24.73},
{-1790.08, 1042.79, 31.16-1},
{-1790.48, 1092.34, 45.30},
{-1747.34, 1100.14, 45.29},
{-1710.80, 1122.96, 44.09-0.8},
{-1710.91, 1170.81, 25.47-0.5},
{-1738.79, 1191.10, 24.98},
{-1806.16, 1190.50, 24.97},
{-1864.76, 1181.62, 44.22-0.8},
{-1941.06, 1181.27, 45.30},
{-1968.86, 1134.57, 50.21-0.4},
{-1969.36, 1079.88, 55.57},
{-1929.44, 1051.48, 50.92-0.3},
{-1888.07, 1040.56, 45.18-0.3},
{-1898.95, 973.68, 35.02},
{-1911.91, 934.74, 35.03-0.2},
{-1957.99, 934.49, 43.10-0.4},
{-1979.58, 941.75, 45.45-0.2},
{-1980.02, 955.66, 45.45-0.1},
}

local districtsBus2 = {
{-1940.01,921.71,39.24},
{-1918.25,921.77,35.30},
{-1873.55,920.85,34.40},
{-1830.21,921.74,27.66},
{-1792.37,920.30,24.13},
{-1750.56,919.85,24.13},
{-1703.84,919.37,24.12},
{-1608.36,920.03,6.91},
{-1571.94,919.95,6.45},
{-1557.97,897.63,6.41},
{-1561.05,847.03,6.41},
{-1560.72,792.25,6.41},
{-1561.59,706.85,6.42},
{-1561.71,636.45,6.42},
{-1561.69,548.99,6.41},
{-1581.02,476.50,6.41},
{-1640.80,416.68,6.40},
{-1688.51,369.31,6.41},
{-1736.65,321.10,6.41},
{-1761.54,324.92,6.72},
{-1799.57,363.97,16.42},
{-1841.32,405.57,16.39},
{-1866.00,414.77,16.40},
{-1883.92,385.32,19.00},
{-1888.02,359.35,23.60},
{-1923.19,345.56,30.49},
{-1972.00,348.54,33.71},
{-2000.67,367.25,34.40},
{-2000.15,408.43,34.39},
{-2000.26,455.13,34.39},
{-2000.71,510.18,34.39},
{-2001.49,561.81,34.39},
{-2001.77,641.63,38.29},
{-2002.10,717.69,44.72},
{-2002.42,773.01,44.68},
{-2002.10,841.61,44.67},
{-2001.19,897.08,44.67},
{-1985.10,922.65,44.65},
{-1981.08,949.85,44.82},
}


local districtsBus3 = {
{-1986.15,935.47,44.64},
{-1997.22,932.23,44.66},
{-2000.65,955.81,44.68},
{-2001.36,988.82,48.08},
{-2001.50,1031.64,55.07},
{-2001.57,1055.50,54.94},
{-2032.11,1079.15,54.95},
{-2069.78,1079.17,54.95},
{-2113.51,1079.33,54.96},
{-2162.22,1079.51,54.96},
{-2214.05,1079.71,54.96},
{-2268.87,1079.91,54.96},
{-2319.33,1082.72,54.94},
{-2397.18,1110.72,54.98},
{-2464.99,1116.94,54.95},
{-2539.95,1122.37,54.95},
{-2575.11,1120.57,54.93},
{-2589.79,1099.46,55.24},
{-2601.55,1074.21,61.19},
{-2608.33,1036.87,71.72},
{-2608.11,987.01,77.51},
{-2609.43,922.16,64.47},
{-2587.75,905.96,64.22},
{-2548.83,906.18,64.21},
{-2506.96,906.20,64.18},
{-2476.46,906.21,62.51},
{-2451.35,906.22,57.79},
{-2425.51,906.24,47.10},
{-2404.96,906.25,44.74},
{-2391.33,893.09,44.68},
{-2390.82,864.99,42.51},
{-2390.36,833.14,36.80},
{-2351.73,806.69,39.53},
{-2324.60,806.38,43.92},
{-2284.98,806.60,48.61},
{-2252.95,807.01,48.68},
{-2199.87,807.01,51.52},
{-2166.29,806.86,64.97},
{-2138.05,806.75,68.82},
{-2105.43,806.64,68.79},
{-2081.72,806.55,68.79},
{-2049.71,806.44,57.16},
{-2027.29,806.42,48.08},
{-2002.61,836.54,44.68},
{-2001.70,868.51,44.66},
{-2001.02,896.36,44.68},
{-1987.78,915.32,44.68},
{-1980.89,952.91,44.79},
}







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?e? 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)
    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)
        addEventHandler("onClientRender",root,render3)
        setTimer(renderstop3,2000,1)
        outputChatBox("* Zako?czy?e?/a? prac?.")
        setElementPosition ( plr, 2507.08, 2265.14, 10.82  )
    else
        kasa = math.random(75,150)
        showMarker()
        playSoundFrontEnd(12)
        if getElementData(el,"player:premium") then
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 100 PLN.")
        triggerServerEvent("givePlayerMoney", el, kasa, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        else
        --outputChatBox("* Zidentyfikowa?e?(a?) punkt i otrzymujesz 75 PLN.")
        addEventHandler("onClientRender",root,render4)
        setTimer(renderstop4,1000,1)
        triggerServerEvent("givePlayerMoney", el, kasa*1.3, 0)
        setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
        end
    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)
    --outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
    --outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
    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)
            outputChatBox("Zako?czy?e? prac?")
            setElementPosition ( plr, 2507.08, 2265.14, 10.82  )
        end
    end
end)





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

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



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

local screenW, screenH = guiGetScreenSize()
function render1()
dxDrawText("Rozpocz??e? prac? StreetView,\n je?dzij po punktach i uzupe?niaj mape. \n Wylosowano mape nr: "..trasa, screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render2()
dxDrawText("Odjecha?e? zbyt daleko od punktu.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render3()
dxDrawText("Zako?czy?e? prac? StreetView.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end

function render4()
dxDrawText("Za dojechanie do punktu otrzymujesz: "..kasa.."PLN", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
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

Jak to dopisze to mi dziala, ale tylko raz po 1 razie wytepa a potem nie moge wyjsc z autobusu, ani z innego pojazdu po reconnecie dziala, ale tak samo.
addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, -1750.02,961.93,24.88)
end)
createBlip(-1754.13,962.74,24.88,46,2,255,0,0,255,0,100)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-25, 21:48


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Tego ju? nie u?ywaj...

addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, -1750.02,961.93,24.88)
end)
createBlip(-1754.13,962.74,24.88,46,2,255,0,0,255,0,100)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomal97
Wysłany: 2018-02-25, 21:48


Ziomal97







Wiek: 29
Na forum: 3171 dni
Posty: 6
Nick w MP: Ziomal97

Piwa: 2

Respekt: 50

"Ciastuu?" napisał/a:

Tego ju? nie u?ywaj...

addEventHandler("onVehicleExit", resourceRoot, function(a, b) 
        if b ~= 0 then return end 
        destroyElement(source) 
        toggleControl ( a, "enter_exit", false )
            setElementPosition(a, -1750.02,961.93,24.88)
end)
createBlip(-1754.13,962.74,24.88,46,2,255,0,0,255,0,100)

To ktory mam uzyc

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ziomeczkowy.
Tagi: pystories-praca-sv
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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