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

Wysłany: 2016-12-21, 19:05


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Witam chcia?bym zrobi? prace dostawcy ale nie mog? zrobi? aby Spawni?a si? ci??ar?wka z naczep? razem i ?eby nie by?o mo?na jej odczepi?, macie pomys?y?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-21, 19:18


marcin778

Krytyk serwerów MTA






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

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

attachElements


Więcej informacji znajdziesz w Wikipedii MTA:

attachTrailerToVehicle


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

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

 
Wysłany: 2016-12-21, 19:45


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

A poka?esz w kodzie?

Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-21, 20:05


marcin778

Krytyk serwerów MTA






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

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

Na wiki s? przyk?ady, nie licz na gotowca.

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

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

 
Wysłany: 2016-12-21, 20:34


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Dobra masz piwo :D :piwo:

Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-21, 21:12


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Mam problem bo nie pokazuje si? naczepa wgl i jest db3

addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "zrespilGracz") then
        outputChatBox("#919191[#0053FFCocaCola#919191]Praca w trakcie przygotowania.", 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(498, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0)
    setTimer(
    function()
        trailer = createVehicle ( 450, 0, 0, 4 )    -- create a trailer
        attachTrailerToVehicle ( newvehicle, trailer )   -- attach them
    end, 50, 1)



bus.lua:35: Bad argument @ 'attachTrailerToVehicle '[Expected vehicle at argument 1,got nil]


Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-21, 21:19


_Wicek_

Majstersztyk






Wiek: 26
Na forum: 4402 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1842

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%
attachTrailerToVehicle ( bus, trailer )


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-21, 22:21


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Teraz naczepa respi si? w Ci?zar?wce a nie podpina si? pod ni?

Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-22, 14:28


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

mixLoLmix2,

addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "zrespilGracz") then
        outputChatBox("#919191[#0053FFCocaCola#919191]Praca w trakcie przygotowania.", 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(498, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0)
    setTimer(
    function()
        trailer = createVehicle ( 450, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0 )    -- create a trailer
        attachTrailerToVehicle ( bus, trailer )   -- attach them
    end, 50, 1)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-22, 16:23


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Dzia?a super a teraz ostatnie, da?o by rade ze jak wyjde z auta to Naczepa te? znika?

Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-22, 16:28


marcin778

Krytyk serwerów MTA






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

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

destroyElement


Więcej informacji znajdziesz w Wikipedii MTA:

detachTrailerFromVehicle



addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "zrespilGracz") then
        outputChatBox("#919191[#0053FFCocaCola#919191]Praca w trakcie przygotowania.", 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(498, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0)
    setTimer(
    function()
        trailer = createVehicle ( 450, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0 )    -- create a trailer
        attachTrailerToVehicle ( bus, trailer )   -- attach them
        setElementData(bus, "naczepa",true)
    end, 50, 1)

addEventHandler("onVehicleExit",getRootElement(),function()
   if getElementData(source, "naczepa") then
              detachTrailerFromVehicle(bus,trailer)
       destroyElement(trailer)
 end
end)



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

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

 
Wysłany: 2016-12-23, 10:52


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Dzai?a Piwko :) A teraz mam problem bo nie pokazuje blipu, Nie wiem gdzie go da? zeby pokaza? sie blip do celu oto kod:
S


local b=createElement("text")
setElementData(b,"name","Coca Cola [RED COUNTY]")
setElementPosition(b,-123.02,-314.29,2.76)

local blip = createBlip (-123.02,-314.29,2.76, 46 ) -- miejsce pracy dorywczej "kierowca autobusu"

local m1 = createMarker(-123.02,-314.29,2.76, "cylinder", 1.5, 35, 142, 35)
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("#919191[#0053FFCocaCola#919191]Praca w trakcie przygotowania.", 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(515, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0)
    setTimer(
    function()
        trailer = createVehicle ( 450, -130.81, -345.07, 2.04, 0.1, 0.0, 177.0 )    -- create a trailer
        attachTrailerToVehicle ( bus, trailer )   -- attach them
        setElementData(bus, "naczepa",true)
    end, 50, 1)

addEventHandler("onVehicleExit",getRootElement(),function()
   if getElementData(source, "naczepa") then
              detachTrailerFromVehicle(bus,trailer)
       destroyElement(trailer)
 end
end)
 
    setElementData(bus,"vehicle:desc","Coca Cola [RED COUNTY]")
    setElementData(bus, "zrespilGracz", el)
    setElementData(bus, "vehicle:fuel", 55)
    setElementData(bus, "vehicle:mileage", 731)
    setVehiclePlateText(bus, "CocaCola" )
    setVehicleColor(bus, 0, 0, 255 )
    
    setVehicleHandling(bus,"maxVelocity", 300.00) -- 40 + 10 = 50km/h
    
    warpPedIntoVehicle(el, bus)
    removePreviousVehicles(el)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
    setVehicleHandling(bus,"maxVelocity", 300.00) -- 40 + 10 = 50km/h

    vehs[el] = bus
end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
    local pojazd = getPedOccupiedVehicle(localPlayer)
    if pojazd then
        destroyElement(trailer)
        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)



C

local districtsBus = {
    {682.99,-440.98,17.29},
    {-117.18,-321.12,1.42},

}

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("#919191[#0053FFCocaCola#919191]Zako?czy?e?[a?] prac?.",255,255,255,true) 
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 1250, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        outputChatBox("#919191[#0053FFCocaCola#919191]Dotarczy?es[as] Towar, Wracaj do fabryki.",255,255,255,true) 
        destroyElement(jobMarker)
        blip = createBlipAttachedTo(cel, 41)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 255, 255, 255)
    blip = createBlipAttachedTo(cel, 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("#919191[#0053FFCocaCola#919191]Rozpocz??e?[a?] prac?. Zawie? towar do sklepu, Wynagrodzenie 1250PLN",255,255,255,true) 
    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()
            destroyElement(blip)
            outputChatBox("#919191[#0053FFCocaCola#919191]Zako?czy?e?[a?] prac?",255,255,255,true) 
        end
    end
end)


Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-23, 11:46


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 255, 255, 255)
    blip = createBlipAttachedTo(cel, 41)


Postaw piwo autorowi tego posta
 

 
Tagi: spawn :: pojazdu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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