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

Wysłany: 2019-08-01, 21:06


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? chcia?bym, zrobi? co? takiego, ?e aby zaliczy?o nam marker musimy wjecha? pojazdem o danym id np infernusem. Pr?bowa?em z funkcj?
getVehicleModel
lecz nic.
kod c_side.
--[[
Praca busa

]]--
local code = "MoveTrans"
local districtsTir = {
            {-2490.23, 1387.22, 7.19},
            {-2441.33, 1367.34, 7.19},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsTir
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 > 9000000 then
            triggerEvent('onClientAddNotification', localPlayer, 'Odjecha?e? zadaleko od punktu.', 'error')
        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 TirDriver(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
    local id = getElementModel ( el ) 
    if not  id == 403 then  -- if theVehicle is either Shamal or AT-400
        outputChatBox ( "TO NIE TIR DO ***!" ) return end
    if jobTarget == #districtsTir then
        triggerServerEvent("daj:punkty:sv", localPlayer, localPlayer)
        finishJob()
        playSoundFrontEnd(5)
            triggerEvent('onClientAddNotification', localPlayer, 'Pomy?lnie zako?czono prac?.', 'info')
    else
        local kasa = math.random(20000,25500)
        local premka = math.random(20000*1.5,25500*1.5)
        showMarker()
        playSoundFrontEnd(12)
        if getElementData(localPlayer, "player:premium") then
        triggerServerEvent("givePlayerMoney", localPlayer, premka)
        triggerEvent('onClientAddNotification', localPlayer, 'Za Dostawe Towaru otrzymujesz wynagrodzenie w postaci: #00c005'..premka..' $#FFFFFF', 'success')
        setElementData(el,"player:reputation", getElementData(el,"player:reputation")+math.random(0,2))
        else
        triggerServerEvent("givePlayerMoney", localPlayer, kasa)
        triggerEvent('onClientAddNotification', localPlayer, 'Za Dostawe Towaru otrzymujesz wynagrodzenie w postaci: #00c005'..kasa..' $#FFFFFF', 'success')
        setElementData(el,"player:reputation", getElementData(el,"player:reputation")+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(districtsTir[jobTarget][1], districtsTir[jobTarget][2], districtsTir[jobTarget][3]-1, "corona", 4, 0, 122, 255,200)
    jobBlip = createBlip(districtsTir[jobTarget][1], districtsTir[jobTarget][2], districtsTir[jobTarget][3], 41)
    if districtsTir[jobTarget+1] then
        ile = districtsTir[jobTarget+1]
        ile2 = ile[1]
        ile3 = ile[2]
        ile4 = ile[3]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end

    addEventHandler("onClientMarkerHit", jobMarker, TirDriver)
end

addEvent("STARTJobTir", true)
addEventHandler("STARTJobTir", resourceRoot, function(veh)
    triggerEvent( "onClientAddNotification", localPlayer, "Pomy?lnie przyjoles/as zlecenie !", "success" )
    jobVehicle = veh
    jobTarget = 0
    showMarker()
    addEventHandler("onClientRender",root,odleglosc)
end)

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



Za pomoc daje :piwo:

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-01, 21:52


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Element, kt?ry pojawia si? w markerze to gracz. Musisz pobra? pojazd tego gracza.

local id = getElementModel(getPedOccupiedVehicle(el))


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-08-01, 22:09


Adaskokieblasko







Wiek: 23
Na forum: 3095 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

"Wilq" napisał/a:

Element, kt?ry pojawia si? w markerze to gracz. Musisz pobra? pojazd tego gracza.

local id = getElementModel(getPedOccupiedVehicle(el))

I doda? warunek
 if id == <id_pojazdu> then 
<kod>
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-08-01, 23:35


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Dziekuje !

Postaw piwo autorowi tego posta
 

 
Tagi: wjazda :: marker :: pojazdu
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