Witam, chcialbym sie zapytac was jak zrobic by
1. Po dojechaniu do ostatniego markera teleportowalo nas na miejsce rozpoczecia pracy ( Kordy : -1998.69, 70.68, 28.62.)
Oraz kolejne :
2. Zeby pokazywalo nam blipem gdzie mamy kolejny marker (czyli jak np zdaje sie prawo jazdy, to tam na mini mapce lub tez na F11 sa zaznaczone te markery blipem i wlasnie o to was prosze)
Z gory wielkie Dziekuje!!
Jak dojedzie do ostatniego markeru to funkcja na zakonczenie pracy oraz setElementPosition (localPlayer, koordy)
kolejny blip to po pierwszym markerze createBlip, po wjechaniu w marker z oznaczonym blipem to destroyBlip, dajesz znowu createBlip
Axmell, moglbys mi powiedziec gdzie to dac nie musisz calego kodu tylko pomiedzy czym zaraz to sprobuje jeszcze ogarnac bo jestem zielony w tym ale dzieki. Nie wiem jeszcze o co z tymi blipami gdzie to mam w jakim miejscu z gory thx now :> za pomoc
EDIT:
A wiec tak zrobilem takie cos jest to po stronie clienta
addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("[Informacja] Zako?czy?e? prac? ?mieciarek. Otrzymujesz 50 PLN")
end
end
end
setElementPosition ( localPlayer, -1998.69, 70.68, 28.62 )
end)
Na samym koncu dodalem setElementPosition :> Jest dobrze ?
Tutaj jest juz inna praca ale o takim samym kodzie (dlatego outPutChatBox jest zmienone :> )
Oczywi?cie robisz niewidzialny marker i koordy marker?w (local districtsBus)
Ja bym tak zrobi? ale nie jestem pewiem na 100%, zapytaj bardziej zaawansowanego ni? ja, (DestroY, Fapciak"Fanciak" albo Wicka)
Axmell, a to podpiac do clienta czy serwa ?. I koljne pytanie jak sa te kropki i pierwsze z markerem to mam dac pierwszy marker tak? i takie same kordy dac jako blip ? i kolejne to 2 destory blip ma byc ten co w pierwszym? i i blip 2 to jest marker 2 tak ?
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
local districtsBus = {
{
-1985.46484375, 72.0615234375, 27.953262329102},
{-1987.7734375, 66.0009765625, 28.20802116394},
{-1982.232421875, 61.4873046875, 28.397748947144},
{-1975.87890625, 54.33984375, 28.820150375366},
{-1979.0498046875, 42.4169921875, 30.257034301758},
{-1987.0859375, 44.1552734375, 30.382406234741},
{-1992.884765625, 42.53515625, 31.611793518066},
{-1986.7724609375, 39.0703125, 31.022226333618},
{-1983.4111328125, 35.2568359375, 31.097345352173},
{-1978.9111328125, 29.7802734375, 31.77773475647},
{-1976.244140625, 40.6865234375, 30.465520858765},
{-1967.7197265625, 50.033203125, 29.339172363281},
{-1963.4794921875, 60.6533203125, 28.409980773926},
{-1963.546875, 66.1484375, 28.088659286499},
{-1968.9736328125, 67.52734375, 28.111268997192},
{-1968.015625, 73.3701171875, 27.749971389771},
{-1980.62890625, 71.923828125, 27.959045410156},
{-1992.4296875, 69.5458984375, 28.074096679688},
{-1993.462890625, 64.068359375, 28.889764785767},
{-1989.5576171875, 56.416015625, 29.259981155396},
{-1982.267578125, 59.7333984375, 28.471450805664},
{-1984.201171875, 73.5771484375, 27.889549255371},
}
local jobTarget
local jobMarker
local jobBlip
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("[Informacja] Zako?czy?e?/a? prac? kosiarek!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("givePlayerMoney", localPlayer, 5, 0)
end
end
function showMarker()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
destroyElement(jobBlip)
jobMarker = nil
jobBlip = nil
end
jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)
jobBlip = createBlipAttachedTo(jobMarker, 41)
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("[Informacja] Rozpocz??e?/a? prac? kosiarek!")
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("[Informacja] Zako?czy?e? prac?")
end
end
end)
local m1 = createMarker(-1998.69, 70.68, 28.62, "cylinder", 4.0, 255, 0, 0)
vehs = {}
local blip = createBlip(-1998.69, 70.68, 28.62, 52)
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", getRootElement(),function(ile)
givePlayerMoney(source, tonumber(ile))
end)
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("[Informacja] 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(572, x,y,z,-1992.3388671875, 75.3896484375, 27.813388824463)
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
setElementPosition(source, -1998.69, 70.68, 28.62)
end)
Ostatnio zmieniony przez #404 2016-02-17, 15:06, w całości zmieniany 3 razy
function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
destroyElement(jobBlip)
jobBlip = nil
end
if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0
end
triggerServerEvent("destroyVeh", localPlayer)
end
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