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

Wysłany: 2016-03-11, 22:02


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4044 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

Kod:

local blip = createBlip ( -1754.18, 956.30, 24.88, 58 )

local m1 = createMarker(-1755.05, 951.73, 23.74, "cylinder", 4.0, 255, 0, 0)
vehs = {}


function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end

addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
outputChatBox("praca w trakcie poprawek", el)
return
end

if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end

local x,y,z = getElementPosition(el)
local bus = createVehicle(437, x,y,z,0.0, 360.0, 269.9)

setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 50)
setElementData(bus, "pojazd_przebieg", 100)

warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

vehs[el] = bus
end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)

addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", root, function(ile)
givePlayerMoney (source,(ile))
end)

Kod:

local districtsBus = {
{-1735.86, 935.60, 24.74},
{-1856.70, 934.15, 35.02},
{-1976.56, 929.94, 45.30},
{-2010.05, 889.21, 45.30},
{-2007.90, 687.83, 45.49},
{-2009.29, 164.41, 27.73},
{-2008.72, -47.67, 35.36},
{-2024.01, -311.14, 35.52},
{-2181.06, -314.15, 35.43},
{-2205.83, -200.09, 35.47},
{-2338.28, -188.65, 35.36},
{-2371.03, -75.48, 35.44},
{-2017.15, -72.04, 35.36},
{-2005.12, 48.98, 31.51},
{-1991.66, 138.80, 27.73},
{-2001.05, 313.72, 35.21},
{-2000.35, 594.87, 35.22},
{-2000.49, 844.61, 45.49},
{-1902.01, 842.09, 35.21},
{-1897.27, 916.37, 35.21},
{-1795.58, 921.17, 24.93},
{-1766.85, 950.46, 24.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, 20, 0)
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?›/-a?› prac?™")
end
end
end)


[ Dodano: 2016-03-11, 22:03 ]
Po wzi?ciu pracy markery si? nie pojawiaj?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-11, 22:16


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Db3?

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Tagi: markery :: się :: nie :: pojawiają
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