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

Wysłany: 2016-02-17, 12:02


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
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!!

Serwer


local m1 createMarker(-1998.6970.6828.62"cylinder"4.025500)
vehs = {}

local blip createBlip(-1998.6970.6828.6252)

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"getRootElement(),function(ile)
givePlayerMoney(sourcetonumber(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(elmd)
if getElementData(el"zrespilGracz"then
outputChatBox("[Informacja] Praca w trakcie poprawek"el)
return
end

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

local x,y,getElementPosition(el)
local bus createVehicle(572x,y,z,-1992.338867187575.389648437527.813388824463)

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

warpPedIntoVehicle(elbus)
removePreviousVehicles(el)
triggerClientEvent(el"STARTJobBus"resourceRootbus)

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[sourcethen
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)


Client


local districtsBus = {
{
-1985.4648437572.061523437527.953262329102},
{-1987.773437566.000976562528.20802116394},
{-1982.23242187561.487304687528.397748947144},
{-1975.8789062554.3398437528.820150375366},
{-1979.049804687542.416992187530.257034301758},
{-1987.085937544.155273437530.382406234741},
{-1992.88476562542.5351562531.611793518066},
{-1986.772460937539.070312531.022226333618},
{-1983.411132812535.256835937531.097345352173},
{-1978.911132812529.780273437531.77773475647},
{-1976.24414062540.686523437530.465520858765},
{-1967.719726562550.03320312529.339172363281},
{-1963.479492187560.653320312528.409980773926},
{-1963.54687566.148437528.088659286499},
{-1968.973632812567.5273437528.111268997192},
{-1968.01562573.370117187527.749971389771},
{-1980.6289062571.92382812527.959045410156},
{-1992.429687569.545898437528.074096679688},
{-1993.46289062564.06835937528.889764785767},
{-1989.557617187556.41601562529.259981155396},
{-1982.26757812559.733398437528.471450805664},
{-1984.20117187573.577148437527.889549255371},

}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget #districtsBus

function finishJob()
if jobMarker and isElement(jobMarkerthen
destroyElement(jobMarker)
jobMarker nil
end

if jobTarget and isElement(jobTargetthen
destroyElement(jobTarget)
jobTarget nil
jobTarget 0

end

triggerServerEvent("destroyVeh"localPlayer)

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("[Informacja] Zako?czy?e?/a? prac? kosiarek!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("givePlayerMoney"localPlayer50)
end
end

function showMarker()
if jobMarker and isElement(jobMarkerthen
destroyElement(jobMarker)
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+1]
setMarkerTarget(jobMarkerile[1], ile[2], ile[3])
end

addEventHandler("onClientMarkerHit"jobMarkerbusDriver)
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(plrseat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("[Informacja] Zako?czy?e? prac?")
end
end
end)


Jeszcze raz DZIEKUJE!!.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 12:14


Axmell

E-Commerce






Wiek: 24
Na forum: 3810 dni
Posty: 279
Nick w MP: %Axmell

Piwa: 224

Respekt: 50

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

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 12:20


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
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 :arrow: :piwo:

EDIT:
A wiec tak zrobilem takie cos jest to po stronie clienta


addEventHandler("onClientVehicleExit"resourceRoot, function(plrseat)
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.6970.6828.62 )
end)


Na samym koncu dodalem setElementPosition :> Jest dobrze ?

Tutaj jest juz inna praca ale o takim samym kodzie (dlatego outPutChatBox jest zmienone :> )

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 13:02


Axmell

E-Commerce






Wiek: 24
Na forum: 3810 dni
Posty: 279
Nick w MP: %Axmell

Piwa: 224

Respekt: 50

Taa, raczej tak, zobacz czy dzia?a, a co do tych blip?w to ja bym zrobi? tak:
 function marker ()  - 1 marker
marker createmarker (..)
blipcreateBlip (...)
addEventHandler ("onClientMarkerHit"marker)

function marker2 ()
destroyBlip (...)
blip2 createBlip = (...)
addEventHandler ("onClientmarkerHit"marker2)

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)

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 14:25


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
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 ?

Podpis
Jeżeli Ci pomogłem daj Piwko ;piwo;
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 14:34


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Da? Ci kod po stronie klienta, te (...) uzupe?niasz argumentami funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

createBlip


Więcej informacji znajdziesz w Wikipedii MTA:

createMarker


Kod tak by wygl?da?:
 function marker ()  -- 1 marker
marker createMarker (..)
blipcreateBlip (...)
end
addEventHandler ("onClientMarkerHit"markermarker)

function marker2 ()
marker2 createMarker (..)
destroyElement (blip)
blip2 createBlip = (...)
end
addEventHandler ("onClientmarkerHit"marker2marker2)

i tak dalej, je?li Ci o to chodzi

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! 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.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 14:39


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Powinno lata?:


local districtsBus = {
{
-1985.4648437572.061523437527.953262329102},
{-1987.773437566.000976562528.20802116394},
{-1982.23242187561.487304687528.397748947144},
{-1975.8789062554.3398437528.820150375366},
{-1979.049804687542.416992187530.257034301758},
{-1987.085937544.155273437530.382406234741},
{-1992.88476562542.5351562531.611793518066},
{-1986.772460937539.070312531.022226333618},
{-1983.411132812535.256835937531.097345352173},
{-1978.911132812529.780273437531.77773475647},
{-1976.24414062540.686523437530.465520858765},
{-1967.719726562550.03320312529.339172363281},
{-1963.479492187560.653320312528.409980773926},
{-1963.54687566.148437528.088659286499},
{-1968.973632812567.5273437528.111268997192},
{-1968.01562573.370117187527.749971389771},
{-1980.6289062571.92382812527.959045410156},
{-1992.429687569.545898437528.074096679688},
{-1993.46289062564.06835937528.889764785767},
{-1989.557617187556.41601562529.259981155396},
{-1982.26757812559.733398437528.471450805664},
{-1984.20117187573.577148437527.889549255371},

}

local jobTarget
local jobMarker
local jobBlip
local jobVehicle
local maxTarget #districtsBus

function finishJob()
if jobMarker and isElement(jobMarkerthen
destroyElement(jobMarker)
jobMarker nil
end

if jobTarget and isElement(jobTargetthen
destroyElement(jobTarget)
jobTarget nil
jobTarget 0

end

triggerServerEvent("destroyVeh"localPlayer)

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("[Informacja] Zako?czy?e?/a? prac? kosiarek!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("givePlayerMoney"localPlayer50)
end
end

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

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

if districtsBus[jobTarget+1then
ile districtsBus[jobTarget+1]
setMarkerTarget(jobMarkerile[1], ile[2], ile[3])
end

addEventHandler("onClientMarkerHit"jobMarkerbusDriver)
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(plrseat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("[Informacja] Zako?czy?e? prac?")
end
end
end)




local m1 createMarker(-1998.6970.6828.62"cylinder"4.025500)
vehs = {}

local blip createBlip(-1998.6970.6828.6252)

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"getRootElement(),function(ile)
givePlayerMoney(sourcetonumber(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(elmd)
if getElementData(el"zrespilGracz"then
outputChatBox("[Informacja] Praca w trakcie poprawek"el)
return
end

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

local x,y,getElementPosition(el)
local bus createVehicle(572x,y,z,-1992.338867187575.389648437527.813388824463)

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

warpPedIntoVehicle(elbus)
removePreviousVehicles(el)
triggerClientEvent(el"STARTJobBus"resourceRootbus)

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[sourcethen
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
setElementPosition(source, -1998.6970.6828.62)
end)



Ostatnio zmieniony przez #404 2016-02-17, 15:06, w całości zmieniany 3 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 14:59


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
Dziekuje nw czy skrypt dziala bo nietestowalem ale na pewno bedzie :> dziekuje. Kazdy dostal po :arrow: :piwo:

[ Komentarz dodany przez: DestroY: 2016-02-17, 15:07 ]
To lepiej przetestuj xD, na razie nie zamykam tematu.

Podpis
Jeżeli Ci pomogłem daj Piwko ;piwo;
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 15:21


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
Narazie glownego wlascciela nie ma a nie podal FTP :<

[ Dodano: 2016-02-17, 18:06 ]
No to dobrze powiedzial ostatni blip nieznika moglby ktos podac rozwiazanie tego :>. Z gory dzieki :>

Ostatnio zmieniony przez #404 2016-02-17, 19:58, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-17, 20:01


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%

function finishJob()
if jobMarker and isElement(jobMarkerthen
destroyElement(jobMarker)
jobMarker nil
destroyElement(jobBlip)
jobBlip nil
end

if jobTarget and isElement(jobTargetthen
destroyElement(jobTarget)
jobTarget nil
jobTarget 0

end

triggerServerEvent("destroyVeh"localPlayer)

end



Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-18, 12:24


Snapig

Amator LUA






Wiek: 28
Na forum: 3793 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
Dodalem kod mniejszy od tego co DestroY mi dal ale dzieki wszystkim juz dziala mam jeden problem ale to juz oleje. A wiec mozna zamknac :>

Podpis
Jeżeli Ci pomogłem daj Piwko ;piwo;
Postaw piwo autorowi tego posta
 

 
Tagi: blip :: markery :: teleportowanie :: zakonczeniu :: pracy
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