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: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

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(jobMarker) then
        destroyElement(jobMarker)
    destroyElement(blip)
    setElementPosition("STOPJobBus", -2404.24, -2189.68, 33.29)
    outputChatBox("Przerwano prace. Wracasz tam gdzie zaczyna sie praca autobusow.!")
        jobMarker = 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)

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)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        if not getElementData(localPlayer, "player:premium") then
        triggerServerEvent("givePlayerMoneySTREET", localPlayer, 12, 0)
        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",localPlayer, 14, 0)
        end
    end
end

function showMarker() 
if jobMarker and isElement(jobMarker) then 
destroyElement(jobMarker) 
destroyElement(blip)
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]) 
    blip = createBlipAttachedTo(jobMarker, 41)
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
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(plr, seat)
    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/1024, sy*512/768, sx*471/1024, sy*101/768, tocolor(0, 102, 178, 255), false)
    dxDrawImage(sx*298/1024, sy*512/768, sx*471/1024, sy*171/768, "img/corona.png", sin, 0, 0, white, false)
    --dxDrawText("Otrzyma?e?(a?) dodatkow? reputacj?...", sx*(393+1)/1024, sy*(513+1)/768, sx*(759+1)/1024, sy*(549+1)/768, tocolor(0, 0, 0, 255), 1.11, "default-bold", "center", "center", false, true)
    --dxDrawText("Otrzyma?e?(a?) dodatkow? reputacj?...", sx*393/1024, sy*(513)/768, sx*759/1024, sy*549/768, white, 1.11, "default-bold", "center", "center", false, true)
    --dxDrawText(data.text.." ("..data.value.." REP)", sx*(393+1)/1024, sy*(549+1)/768, sx*(759+1)/1024, sy*(603+1)/768, tocolor(0, 0, 0, 255), 1.00, "clear", "center", "center", false, true)
    dxDrawText(data.text..""..data.value.." YOSpoints", sx*510/1024, sy*549/768, sx*759/1024, sy*680/768, black, 1.50, "pricedown", "center", "center", false, true)
end

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


Postaw piwo autorowi tego posta
 

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


.RiV







Wiek: 26
Na forum: 3729 dni
Posty: 554
Nick w MP: Split

Piwa: 2598

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: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

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(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
        setElementPosition(localPlayer, -2404.24, -2189.68, 33.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