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

Wysłany: 2017-12-02, 21:37


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Witam tak jak w temacie jakiej u?y? funkcji by po wyj?ciu z auta pracy dorywczej tp'a?o go wybrane miejsce xyz

kod po stronie kienta

local jobTarget
local jobMarker
local jobVehicle
local maxTarget #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarkerthen
        destroyElement(jobMarker)
    destroyElement(blip)
    setElementPosition("STOPJobBus", -2404.24, -2189.6833.29)
    outputChatBox("Przerwano prace. Wracasz tam gdzie zaczyna sie praca autobusow.!")
        jobMarker 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)

end
addEventHandler "onClientPlayerWasted"getLocalPlayer(),finishJob)
addEvent("finishJob",true)
addEventHandler("finishJob",root,function(plr)
if plr ~= localPlayer then return end
finishJob()
end)


function busDriver(elmd)
    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)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        if not getElementData(localPlayer"player:premium"then
        triggerServerEvent("givePlayerMoneySTREET"localPlayer120)
        outputChatBox("Dojazdzasz do przystanku i otrzymujesz 12 PLN.")
        end
        if getElementData(localPlayer"player:premium"then
            outputChatBox("Premium: Dojazdzasz do przystanku i otrzymujesz 14 PLN.")
            triggerServerEvent("givePlayerMoneySTREET",localPlayer140)
        end
    end
end

function showMarker() 
if jobMarker and isElement(jobMarkerthen 
destroyElement(jobMarkerdestroyElement(blip)
jobMarker nil 
end 

jobTarget jobTarget 1 
jobMarker createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint"400255) 

if districtsBus[jobTarget+1then 
ile districtsBus[jobTarget+1setMarkerTarget(jobMarkerile[1], ile[2], ile[3]) 
    blip createBlipAttachedTo(jobMarker41)
    end
    
    addEventHandler("onClientMarkerHit"jobMarkerbusDriver)
end

addEvent("STARTJobBus"true)
addEventHandler("STARTJobBus"resourceRoot, function(veh)
    outputChatBox("* Rozpocze?e?/a? prace.")
    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()
            outputChatBox("Zako?czy?e? prac?")
        end
    end
end)

addEventHandler("onPlayerCommand"getRootElement(), function(string)
if string == "hwdp" then
cancelEvent()
end
end)


local sx,sy=guiGetScreenSize()

local data={
    value=nil,
    showed=false,
    text=nil,
}

local randomText={
    "",

}

function renderInformation()
    local sin=math.sin(getTickCount()/500)*0.01
    --dxDrawRectangle(sx*288/1024sy*512/768sx*471/1024sy*101/768tocolor(0102178255), false)
    dxDrawImage(sx*298/1024sy*512/768sx*471/1024sy*171/768"img/corona.png"sin00whitefalse)
    --dxDrawText("Otrzyma?e?(a?) dodatkow? reputacj?..."sx*(393+1)/1024sy*(513+1)/768sx*(759+1)/1024sy*(549+1)/768tocolor(000255), 1.11"default-bold""center""center"falsetrue)
    --dxDrawText("Otrzyma?e?(a?) dodatkow? reputacj?..."sx*393/1024sy*(513)/768sx*759/1024sy*549/768white1.11"default-bold""center""center"falsetrue)
    --dxDrawText(data.text.." ("..data.value.." REP)"sx*(393+1)/1024sy*(549+1)/768sx*(759+1)/1024sy*(603+1)/768tocolor(000255), 1.00"clear""center""center"falsetrue)
    dxDrawText(data.text..""..data.value.." YOSpoints"sx*510/1024sy*549/768sx*759/1024sy*680/768black1.50"pricedown""center""center"falsetrue)
end

addEvent("reputation:show"true)
addEventHandler("reputation:show"resourceRoot, function(rnd)
    data.value=rnd[2]
    data.text=randomText[math.random(#randomText)]
    addEventHandler("onClientRender"rootrenderInformation)
    setTimer(function()
        removeEventHandler("onClientRender"rootrenderInformation)
        data.value=nil
        data.text=nil
    end60001)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-02, 22:19


.RiV







Wiek: 25
Na forum: 3587 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Wklejasz ten kod do funkcji finishJob.

Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-02, 22:20


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

".WhiteBlue" napisał/a:


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Wklejasz ten kod do funkcji finishJob.


Dzi?ki za odpowied?. Poradzi?em sobie

wystarczy?o doda? :D


addEventHandler("onClientVehicleExit"resourceRoot, function(plrseat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
        setElementPosition(localPlayer, -2404.24, -2189.6833.29)
        outputChatBox("Przerwano prace. Wracasz tam gdzie zaczyna sie praca autobusow!")
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Tagi: wyjściu :: auta
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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