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

Wysłany: 2015-05-24, 15:06


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4386 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

local districtsBus = {
    {1803.40, -1890.18, 12.92},
    {1822.92, -1836.23, 12.93},
    {1823.85, -1729.07, 12.90},
    {1823.24, -1613.84, 12.90},
    {1850.34, -1474.88, 12.90},
    {1851.56, -1374.52, 12.91},
    {1852.04, -1265.57, 12.91},
    {1852.33, -1201.12, 21.63},
    {1632.63, -1159.41, 23.41},
    {1557.64, -1158.76, 23.42},
    {1465.43, -1158.48, 23.25},
    {1341.92, -1144.88, 23.18},
    {1342.31, -1170.09, 23.21},
    {1344.71, -1329.55, 12.91},
    {1322.94, -1499.40, 12.89},
    {1300.14, -1606.03, 12.90},
    {1300.73, -1739.03, 12.90},
    {1316.89, -1855.01, 12.90},
    {1343.80, -1861.75, 12.90},
    {1409.51, -1874.71, 12.90},
    {1477.18, -1874.22, 12.90},
    {1531.29, -1874.54, 12.91},
    {1575.12, -1874.79, 12.90},
    {1616.38, -1875.04, 12.90},
    {1643.36, -1875.20, 12.90},
    {1707.55, -1814.39, 12.88},
    {1734.30, -1819.29, 12.89},
    {1766.82, -1827.63, 12.90},
    {1799.87, -1853.22, 12.93},
    {1745.09, -1852.72, 12.93},


}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh", localPlayer)

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)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 1, 1)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

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

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zako?czy?e? prac?")
        end
    end
end)


Jak zrobi? aby pokazywa? si? blip na mapie pod F11 gdy wezm? prace prace i jecha? do wyznaczonego punktu ??

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 15:22


Loop

Inspektor






Wiek: 28
Na forum: 4431 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

Sprawdz


local districtsBus = {
    {1803.40, -1890.18, 12.92},
    {1822.92, -1836.23, 12.93},
    {1823.85, -1729.07, 12.90},
    {1823.24, -1613.84, 12.90},
    {1850.34, -1474.88, 12.90},
    {1851.56, -1374.52, 12.91},
    {1852.04, -1265.57, 12.91},
    {1852.33, -1201.12, 21.63},
    {1632.63, -1159.41, 23.41},
    {1557.64, -1158.76, 23.42},
    {1465.43, -1158.48, 23.25},
    {1341.92, -1144.88, 23.18},
    {1342.31, -1170.09, 23.21},
    {1344.71, -1329.55, 12.91},
    {1322.94, -1499.40, 12.89},
    {1300.14, -1606.03, 12.90},
    {1300.73, -1739.03, 12.90},
    {1316.89, -1855.01, 12.90},
    {1343.80, -1861.75, 12.90},
    {1409.51, -1874.71, 12.90},
    {1477.18, -1874.22, 12.90},
    {1531.29, -1874.54, 12.91},
    {1575.12, -1874.79, 12.90},
    {1616.38, -1875.04, 12.90},
    {1643.36, -1875.20, 12.90},
    {1707.55, -1814.39, 12.88},
    {1734.30, -1819.29, 12.89},
    {1766.82, -1827.63, 12.90},
    {1799.87, -1853.22, 12.93},
    {1745.09, -1852.72, 12.93},


}
local jobBlip
local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
        if jobBlip and isElement(jobBlip) then
        destroyElement(jobBlip)
        jobBlip = nil
        end

triggerServerEvent("destroyVeh", localPlayer)

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)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 1, 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 = createBlipAttachedTo(jobMarker, 41)
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

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

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zako?czy?e? prac?")
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Tagi: praca
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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