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

Wysłany: 2017-07-12, 17:09


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

Witam mam problem bo pr?buje zrobi? kila marker?w do za?adunku i nie dzia?a a w DB3 nic si? nie pokazuj? prosz? o pomoc

reloadMarker = {
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}

local ladunek = createMarker( reloadMarker, "cylinder", 5.0, 255, 0, 0, 130)

to jest funkcja na tworzenie marker?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 17:12


neku^







Wiek: 24
Na forum: 3662 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5


reloadMarker = {
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}

addEventHandler("onResourceStart", getRootElement(), function()
    for k,v in ipairs(reloadMarker) do
        local ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,130)
    end
end)


Powinno dzia?a?, nie testowane.. ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 17:22


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Zadzia?a? zadzia?a, szkoda tylko, ?e gdy ten zas?b b?dzie odpalony i odpali inny zas?b, to te markery b?dzie tworzy?o na nowo i na nowo :P

'getRootElement()' zamie? na: getResourceRootElement(getThisResource()) lub jak kto woli resourceRoot

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
neku^
Wysłany: 2017-07-12, 17:32


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3


addEventHandler("onResourceStart", getRootElement(), function()
    for k,v in ipairs(reloadMarker) do
        local ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,130)
    end
end)


i nie dzia?a i nie ma b??d?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 18:00


Szymczu

Programista bo tak






Wiek: 27
Na forum: 3575 dni
Posty: 194
Nick w MP: Szymczu

Piwa: 36

Respekt: 120
Respekt: 120

"polaczkos" napisał/a:


i nie dzia?a i nie ma b??d?w


Jak nie dzia?a jak dzia?a :D i zamie? to getRootElement() na resourceRoot tak jak Ci Jurandovsky poradzi?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 18:22


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

dobra dzia?a tylko teraz jak pol?czy? to

strona serwera

reloadMarker = {
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}


addEventHandler("onResourceStart", resourceRoot, function()
    for k,v in ipairs(reloadMarker) do
        ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
    end
end)


z tym
strona clienta


function takeFurniture(he, md, plr)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local car = getPedOccupiedVehicle(he)

if getElementData(car, "vopis") == "Dostawca Gazu - Firma GAZOL" then
     if getElementData(he, "zaladowany") == false then  
        setElementFrozen(car,true)
        outputChatBox("[INFO] Ladujesz Butle z gazem na pake. Prosze Czekac!", 0, 240, 255)
        setTimer(function()
    setElementData(car, "vopis", "Dostawca Gazu - Firma GAZOL")
        setElementFrozen(car,false)
    outputChatBox("[INFO] Zaladowales Pojazd Butlami z Gazem, Jedz Do klienta, punkt jest oznaczony Blipem 'C' na mapie", 0, 240, 255)
    setElementData(he, "zaladowany", true)
        showDestination()
        end, 5000, 1)
    else
    outputChatBox("[INFO] Nie mo?esz kilka razy ?adowa? pojazdu", plr, 255, 0, 0)
    end
end
end
addEventHandler("onClientMarkerHit", ladunek, takeFurniture)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 18:36


Szymczu

Programista bo tak






Wiek: 27
Na forum: 3575 dni
Posty: 194
Nick w MP: Szymczu

Piwa: 36

Respekt: 120
Respekt: 120

addEventHandler("onClientMarkerHit", getRootElement(), takeFurniture)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 22:26


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

teraz mam taki problem ze po wiechaniu w punk roz?adunku wyskakuje znow? ?adowanie prosz? jeszcze z tym o pomoc
stona clienta


destinationMarker = nil
destBlip = nil

addEvent("ladunek", ladunek)
function ladunek ()
triggerServerEvent ( "zaladujek", resourceRoot)
end


unloadingPos = {

{-2734.32,820.22,53.21},
{-2672.17,269.63,3.95},
{-2592.43,59.72,3.95},
{-2655.98,-133.58,3.65},
{-2314.70,-155.81,34.93},
{-2029.54,157.96,28.45},
{-2081.72,773.69,69.17},
{-2053.12,146.63,27.84},
{-1929.06,275.68,40.05},
{-2418.97,960.39,44.30},
{-2425.96,1030.55,49.39},
{-2345.91,991.95,49.70},
{-1674.98,438.14,6.18},
}

function endOfWork()
if destinationMarker and isElement(destinationMarker) then
destroyElement(destinationMarker)
destinationMarker = nil
end
if destBlip and isElement(destBlip) then
destroyElement(destBlip)
destBlip = nil
end
end


function takeFurniture(he, md, plr)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local car = getPedOccupiedVehicle(he)

if getElementData(car, "vopis") == "Dostawca Gazu - Firma GAZOL" then
     if getElementData(he, "zaladowany") == false then  
        setElementFrozen(car,true)
        outputChatBox("[INFO] Ladujesz Butle z gazem na pake. Prosze Czekac!", 0, 240, 255)
        setTimer(function()
    setElementData(car, "vopis", "Dostawca Gazu - Firma GAZOL")
        setElementFrozen(car,false)
    outputChatBox("[INFO] Zaladowales Pojazd Butlami z Gazem, Jedz Do klienta, punkt jest oznaczony Blipem 'C' na mapie", 0, 240, 255)
    setElementData(he, "zaladowany", true)
        showDestination()
        end, 5000, 1)
    else
    outputChatBox("[INFO] Nie mo?esz kilka razy ?adowa? pojazdu", plr, 255, 0, 0)
    end
end
end
addEventHandler("onClientMarkerHit", getRootElement(), takeFurniture)


function showDestination()
local rand = math.random(1, #unloadingPos)
local destMarker = unloadingPos[rand]
destinationMarker = createMarker(destMarker[1], destMarker[2], destMarker[3], "cylinder", 3.0, 255, 0, 0, 130)
destBlip = createBlipAttachedTo(destinationMarker, 12)
addEventHandler("onClientMarkerHit", destinationMarker, unloadFurniture)
end

function unloadFurniture(plr, md)
if plr ~= localPlayer then return end
if not getPedOccupiedVehicle(plr) then return end

local carr = getPedOccupiedVehicle(plr)

if getElementData(carr, "vopis") == "Dostawca Gazu - Firma GAZOL" then
if getElementData(plr, "zaladowany") == true then
    outputChatBox("[INFO] Dojechales Do klienta i zainstalowales mu butle z gazem w kuchni!", 0, 240, 255)
    setElementData(plr, "zaladowany", false)
    setElementData(carr, "vopis", "Dostawca Gazu - Firma GAZOL")
    local kasa = givePlayerMoney ( math.random(40,90) )
    setElementPosition (carr, -2473.81,777.43,35.16 )
    outputChatBox("[INFO] Dostajesz" ..kasa.. "Z? za dostarczenie butli dla klientow.", 0, 240, 255)
    endOfWork()
else
    outputChatBox("[INFO] Brak butli na pace, twoje auto nie jest zaladowane butlami!", 255, 0, 0)
end
end
end


addEvent("kurier_praca", true)
addEventHandler("kurier_praca", resourceRoot, function()
takeFurniture(plr, md)
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            triggerServerEvent ( "checkCars", resourceRoot)
            destroyElement(destBlip)
            setElementData(plr, "graczPraca", false)
            setElementData(plr, "zaladowany", false)
            setElementPosition ( plr, -2470.14,774.66,35.17 )
            outputChatBox("[INFO] Praca dostawczy gaz zaosta?a zako?czona!", 255, 0, 0)
            endOfWork()
        end
    end
end)

addEventHandler("onClientPlayerQuit", resourceRoot, function(plr)
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany" ,false)
end)

addEventHandler("onClientPlayerWasted", resourceRoot, function(plr)
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany", false)
outputChatBox("* Zginales podczas dorywczej pracy! Musisz zaczac od nowa!", 255, 0, 0)
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
setElementData(source, "graczPraca", false)
setElementData(plr, "zaladowany", false)
end)


i strona serwera


reloadMarker = {
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}


addEventHandler("onResourceStart", resourceRoot, function()
    for k,v in ipairs(reloadMarker) do
        ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
    end
end)
addEvent( "zaladujek", true )

Pojazdy = {
{-2479.94,794.45,35.16,0,0,-90},
{-2479.94,790.45,35.16,0,0,-90},
{-2479.94,786.10,35.16,0,0,-90},
{-2479.94,782.10,35.16,0,0,-90},
{-2479.94,777.45,35.16,0,0,-90},

}

for i,v in ipairs(Pojazdy) do
    local Pojazd = createVehicle(478, v[1], v[2], v[3], v[4], v[5], v[6])
    setElementData(Pojazd, "vopis", "Dostawca Gazu - Firma GAZOL")
    setVehiclePlateText(Pojazd,"GAZOL")
    setVehicleColor (Pojazd, 0, 255, 84 )
    setVehicleHandling(Pojazd,"maxVelocity",80)
    setElementData(Pojazd, "pojazdy_przebieg", math.random(500, 1000))
    setElementData(Pojazd, "pojazdy_paliwo", 50)
    setElementFrozen(Pojazd, true)
    setVehicleEngineState(Pojazd, false)
end

addEventHandler("onVehicleEnter", resourceRoot, function(plr, seat)
    if seat == 0 then
        if getElementData(plr, "graczPraca") == false then
            setElementData(plr, "graczPraca", true)
            setElementFrozen(source, false)
            outputChatBox("[INFO] Rozpoczales Prace Jako Dostawca Butli z Gazem, Jedz Zaladowac butle z gazem na pake!", plr, 0, 240, 255)
            triggerClientEvent(plr, "kurier_praca", resourceRoot)
        else
        end
    end
end)



function respawnVehicles()
    for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
        if not getVehicleOccupant(v) then
            respawnVehicle(v)
            setElementFrozen(v, true)
            setElementData(v, "vopis", "Dostawca Gazu - Firma GAZOL")
            setVehicleColor (v, 0, 255, 255 )
            setVehicleHandling(v,"maxVelocity",100)
            setElementData(v, "pojazdy_przebieg", math.random(500, 1000))
            setElementData(v, "pojazd_paliwo", 50)
            setVehicleEngineState(v, false)
        end
    end
end
--setTimer(respawnVehicles, 5000, 0)
addEvent("checkCars", true)
addEventHandler("checkCars", resourceRoot, respawnVehicles)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-12, 23:41


Malentas

Koder mirofali w lua






Wiek: 24
Na forum: 3822 dni
Posty: 146
Nick w MP: Malentas

Piwa: 1633

Respekt: 47,3

Client:
 

destinationMarker?=?nil
destBlip?=?nil

addEvent("ladunek",?ladunek)
function?ladunek?()
triggerServerEvent?(?"zaladujek",?resourceRoot)
end


unloadingPos?=?{

{-2734.32,820.22,53.21},
{-2672.17,269.63,3.95},
{-2592.43,59.72,3.95},
{-2655.98,-133.58,3.65},
{-2314.70,-155.81,34.93},
{-2029.54,157.96,28.45},
{-2081.72,773.69,69.17},
{-2053.12,146.63,27.84},
{-1929.06,275.68,40.05},
{-2418.97,960.39,44.30},
{-2425.96,1030.55,49.39},
{-2345.91,991.95,49.70},
{-1674.98,438.14,6.18},
}

function?endOfWork()
if?destinationMarker?and?isElement(destinationMarker)?then
destroyElement(destinationMarker)
destinationMarker?=?nil
end
if?destBlip?and?isElement(destBlip)?then
destroyElement(destBlip)
destBlip?=?nil
end
end


addEvent("wjechalwmarkerMalentaska", true)
addEventHandler("wjechalwmarkerMalentaska", root, function(he, md, plr)
if?he?~=?localPlayer?then?return?end
if?not?getPedOccupiedVehicle(he)?then?return?end

local?car?=?getPedOccupiedVehicle(he)

if?getElementData(car,?"vopis")?==?"Dostawca?Gazu?-?Firma?GAZOL"?then
?????if?getElementData(he,?"zaladowany")?==?false?then??
????????setElementFrozen(car,true)
????????outputChatBox("[INFO]?Ladujesz?Butle?z?gazem?na?pake.?Prosze?Czekac!",?0,?240,?255)
????????setTimer(function()
????setElementData(car,?"vopis",?"Dostawca?Gazu?-?Firma?GAZOL")
????????setElementFrozen(car,false)
????outputChatBox("[INFO]?Zaladowales?Pojazd?Butlami?z?Gazem,?Jedz?Do?klienta,?punkt?jest?oznaczony?Blipem?'C'?na?mapie",?0,?240,?255)
????setElementData(he,?"zaladowany",?true)
????????showDestination()
????????end,?5000,?1)
????else
????outputChatBox("[INFO]?Nie?mo?esz?kilka?razy??adowa??pojazdu",?plr,?255,?0,?0)
????end
end
end)


function?showDestination()
local?rand?=?math.random(1,?#unloadingPos)
local?destMarker?=?unloadingPos[rand]
destinationMarker?=?createMarker(destMarker[1],?destMarker[2],?destMarker[3],?"cylinder",?3.0,?255,?0,?0,?130)
destBlip?=?createBlipAttachedTo(destinationMarker,?12)
addEventHandler("onClientMarkerHit",?destinationMarker,?unloadFurniture)
end

function?unloadFurniture(plr,?md)
if?plr?~=?localPlayer?then?return?end
if?not?getPedOccupiedVehicle(plr)?then?return?end

local?carr?=?getPedOccupiedVehicle(plr)

if?getElementData(carr,?"vopis")?==?"Dostawca?Gazu?-?Firma?GAZOL"?then
if?getElementData(plr,?"zaladowany")?==?true?then
????outputChatBox("[INFO]?Dojechales?Do?klienta?i?zainstalowales?mu?butle?z?gazem?w?kuchni!",?0,?240,?255)
????setElementData(plr,?"zaladowany",?false)
????setElementData(carr,?"vopis",?"Dostawca?Gazu?-?Firma?GAZOL")
????local?kasa?=?givePlayerMoney?(?math.random(40,90)?)
????setElementPosition?(carr,?-2473.81,777.43,35.16?)
????outputChatBox("[INFO]?Dostajesz"?..kasa..?"Z??za?dostarczenie?butli?dla?klientow.",?0,?240,?255)
????endOfWork()
else
????outputChatBox("[INFO]?Brak?butli?na?pace,?twoje?auto?nie?jest?zaladowane?butlami!",?255,?0,?0)
end
end
end


addEvent("kurier_praca",?true)
addEventHandler("kurier_praca",?resourceRoot,?function()
takeFurniture(plr,?md)
end)

addEventHandler("onClientVehicleExit",?resourceRoot,?function(plr,?seat)
????if?seat?==?0?then
????????if?plr?==?localPlayer?then
????????????triggerServerEvent?(?"checkCars",?resourceRoot)
????????????destroyElement(destBlip)
????????????setElementData(plr,?"graczPraca",?false)
????????????setElementData(plr,?"zaladowany",?false)
????????????setElementPosition?(?plr,?-2470.14,774.66,35.17?)
????????????outputChatBox("[INFO]?Praca?dostawczy?gaz?zaosta?a?zako?czona!",?255,?0,?0)
????????????endOfWork()
????????end
????end
end)

addEventHandler("onClientPlayerQuit",?resourceRoot,?function(plr)
setElementData(source,?"graczPraca",?false)
setElementData(plr,?"zaladowany"?,false)
end)

addEventHandler("onClientPlayerWasted",?resourceRoot,?function(plr)
setElementData(source,?"graczPraca",?false)
setElementData(plr,?"zaladowany",?false)
outputChatBox("*?Zginales?podczas?dorywczej?pracy!?Musisz?zaczac?od?nowa!",?255,?0,?0)
end)

addEventHandler("onClientResourceStop",?resourceRoot,?function()
setElementData(source,?"graczPraca",?false)
setElementData(plr,?"zaladowany",?false)
end)


server:

reloadMarker?=?{
{-2460.45,779.61,34.17},
{-2460.45,786.63,34.17},
{-2460.45,793.69,34.17},
}


addEventHandler("onResourceStart",?resourceRoot,?function()
????for?k,v?in?ipairs(reloadMarker)?do
????????ladunek?=?createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
        addEventHandler("onClientMarkerHit", ladunek, function()
            triggerClientEvent(source, "wjechalwmarkerMalentaska", source)
      end)
????end
end)
addEvent(?"zaladujek",?true?)

Pojazdy?=?{
{-2479.94,794.45,35.16,0,0,-90},
{-2479.94,790.45,35.16,0,0,-90},
{-2479.94,786.10,35.16,0,0,-90},
{-2479.94,782.10,35.16,0,0,-90},
{-2479.94,777.45,35.16,0,0,-90},

}

for?i,v?in?ipairs(Pojazdy)?do
????local?Pojazd?=?createVehicle(478,?v[1],?v[2],?v[3],?v[4],?v[5],?v[6])
????setElementData(Pojazd,?"vopis",?"Dostawca?Gazu?-?Firma?GAZOL")
????setVehiclePlateText(Pojazd,"GAZOL")
????setVehicleColor?(Pojazd,?0,?255,?84?)
????setVehicleHandling(Pojazd,"maxVelocity",80)
????setElementData(Pojazd,?"pojazdy_przebieg",?math.random(500,?1000))
????setElementData(Pojazd,?"pojazdy_paliwo",?50)
????setElementFrozen(Pojazd,?true)
????setVehicleEngineState(Pojazd,?false)
end

addEventHandler("onVehicleEnter",?resourceRoot,?function(plr,?seat)
????if?seat?==?0?then
????????if?getElementData(plr,?"graczPraca")?==?false?then
????????????setElementData(plr,?"graczPraca",?true)
????????????setElementFrozen(source,?false)
????????????outputChatBox("[INFO]?Rozpoczales?Prace?Jako?Dostawca?Butli?z?Gazem,?Jedz?Zaladowac?butle?z?gazem?na?pake!",?plr,?0,?240,?255)
????????????triggerClientEvent(plr,?"kurier_praca",?resourceRoot)
????????else
????????end
????end
end)



function?respawnVehicles()
????for?i,v?in?ipairs(getElementsByType("vehicle",?resourceRoot))?do
????????if?not?getVehicleOccupant(v)?then
????????????respawnVehicle(v)
????????????setElementFrozen(v,?true)
????????????setElementData(v,?"vopis",?"Dostawca?Gazu?-?Firma?GAZOL")
????????????setVehicleColor?(v,?0,?255,?255?)
????????????setVehicleHandling(v,"maxVelocity",100)
????????????setElementData(v,?"pojazdy_przebieg",?math.random(500,?1000))
????????????setElementData(v,?"pojazd_paliwo",?50)
????????????setVehicleEngineState(v,?false)
????????end
????end
end
--setTimer(respawnVehicles,?5000,?0)
addEvent("checkCars",?true)
addEventHandler("checkCars",?resourceRoot,?respawnVehicles) 


Podpis
Aktualny projekt:


AntoriaMTA
Discord: https://discord.gg/TVrAddp3Wu

Najszybszy kontakt (discord): Malentas#2091
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-13, 16:02


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

teraz nie da si? ?adowa? a dok?adniej kiedy wjezdzam w punkt nic sie nie dzieje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-14, 12:35


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

addEventHandler("onResourceStart", resourceRoot, function()
    for k,v in ipairs(reloadMarker) do
        ladunek = createMarker(v[1],v[2],v[3],"cylinder",5.0,255,0,0,255)
        addEventHandler("onMarkerHit", ladunek, function()
            triggerClientEvent(source, "wjechalwmarkerMalentaska", source)
      end)
    end
end)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Tagi: marker :: załadunku
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » marker załadunku 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