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

Wysłany: 2015-08-25, 18:13


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157


--[[
Praca busa

@copyright 2013-2014 Split <split@go-life.pl>
@author Split <split@go-life.pl>
@version 1.0 beta
@changelog:
* Poprawiono prac?.

Nie masz prawa u?ywac tego kodu bez mojej zgody.
Napisz do mnie by? mo?e si? zgodz? na u?ycie kodu.
]]--
local districtsBus = {
 
 {365.1037902832, 2535.1870117188, 28.978340148926},
 {332.31658935547, 2493.296875, 41.081680297852},
 {301.78073120117, 2427.9694824219, 60.128322601318},
 {272.986328125, 2365.1137695313, 78.775672912598},
 {240.82670593262, 2299.0495605469, 88.779518127441},
 {195.92169189453, 2198.2749023438, 106.62964630127},
 {148.11741638184, 2079.39453125, 121.19399261475},
 {71.565788269043, 1878.9143066406, 137.08000183105},
 {23.038728713989, 1743.6721191406, 157.64511108398},
 {-8.123215675354, 1651.3896484375, 158.23648071289},
 {-96.989768981934, 1383.0947265625, 145.01481628418},
 {-135.19259643555, 1258.9887695313, 137.48251342773},
 {-182.58676147461, 1098.1326904297, 124.80664825439},
 {-182.58755493164, 990.39410400391, 126.6547088623},
 {-107.2110748291, 931.13787841797, 137.63739013672},
 {-3.0844504833221, 971.85510253906, 148.95761108398},
 {57.474384307861, 1075.6530761719, 142.88092041016},
 {90.087326049805, 1299.9056396484, 109.51367950439},
 {113.49279022217, 1452.0389404297, 111.97846984863},
 {195.57073974609, 1876.6184082031, 114.44400787354},
 {253.78149414063, 2128.2270507813, 103.76750946045},
 {309.42895507813, 2343.7844238281, 92.612403869629},
 {340.17135620117, 2456.6708984375, 60.742736816406},
 {360.67468261719, 2518.2041015625, 33.290943145752},
 {364.28253173828, 2540.8449707031, 20.09356880188},
    
    }

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("giveGPoint", root) 
        triggerServerEvent("givePlayerMoney", el, 10 ,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], "ring", 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 to przerobi? ?e jak ju? wesz?e? w marker i ci si? zrespi?o auto to ci losowo wybiera punkt /

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-25, 18:28


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

1. Wszed?e?*


2. przyk?ad :

local pkt={
    {0,0,1},
    {0,0,2}
}


rnd=math.random(1,#pkt)
local x,y,z=pkt[rnd][1],pkt[rnd][2],pkt[rnd][3]


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-25, 18:42


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

local pkt = {
 
 {365.1037902832, 2535.1870117188, 28.978340148926},
 {332.31658935547, 2493.296875, 41.081680297852},
 {301.78073120117, 2427.9694824219, 60.128322601318},
 {272.986328125, 2365.1137695313, 78.775672912598},
 {240.82670593262, 2299.0495605469, 88.779518127441},
 {195.92169189453, 2198.2749023438, 106.62964630127},
 {148.11741638184, 2079.39453125, 121.19399261475},
 {71.565788269043, 1878.9143066406, 137.08000183105},
 {23.038728713989, 1743.6721191406, 157.64511108398},
 {-8.123215675354, 1651.3896484375, 158.23648071289},
 {-96.989768981934, 1383.0947265625, 145.01481628418},
 {-135.19259643555, 1258.9887695313, 137.48251342773},
 {-182.58676147461, 1098.1326904297, 124.80664825439},
 {-182.58755493164, 990.39410400391, 126.6547088623},
 {-107.2110748291, 931.13787841797, 137.63739013672},
 {-3.0844504833221, 971.85510253906, 148.95761108398},
 {57.474384307861, 1075.6530761719, 142.88092041016},
 {90.087326049805, 1299.9056396484, 109.51367950439},
 {113.49279022217, 1452.0389404297, 111.97846984863},
 {195.57073974609, 1876.6184082031, 114.44400787354},
 {253.78149414063, 2128.2270507813, 103.76750946045},
 {309.42895507813, 2343.7844238281, 92.612403869629},
 {340.17135620117, 2456.6708984375, 60.742736816406},
 {360.67468261719, 2518.2041015625, 33.290943145752},
 {364.28253173828, 2540.8449707031, 20.09356880188},
    
    }

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("giveGPoint", root) 
        triggerServerEvent("givePlayerMoney", el, 10 ,1)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    rnd=math.random(1,#pkt)
     local x,y,z=pkt[rnd][1],pkt[rnd][2],pkt[rnd][3]
    
    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
 

 
Wysłany: 2015-08-25, 20:42


Dexnes_

Tiger






Wiek: 26
Na forum: 4542 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Sprawdz czy dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-25, 20:42


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Nie dzia?a ;(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-25, 20:48


Dexnes_

Tiger






Wiek: 26
Na forum: 4542 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-25, 20:51


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

nie mo?esz ty pom?c ?

Postaw piwo autorowi tego posta
 

 
Tagi: praca :: dorywcza
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