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

Wysłany: 2018-06-13, 23:10


Grubyyy







Wiek: 22
Na forum: 3262 dni
Posty: 22
Nick w MP: GrubyMTA



Respekt: 50

Hej! To znowu ja.

Od jakiego? czasu na gtao.pl jest skrypt "Custom Markers" ( link http://gtao.pl/%3Cfont-co...rs-vt115427.htm )

Przyznam szczerze ?e markery bardzo mi si? spodoba?y tylko mam pewien problem.
Nie wiem jak w gotowym kodzie podmieni? normalne markery, na te takie paradajsowe.


Podaje ca?y kod, w kt?rym chcia?bym podmieni? markery

 

local m1 = createMarker(-1754.20, 962.35, 24.88-.9, "cylinder", 3.0, 0, 186, 255)
local t = createElement('text')
setElementPosition(t,-1754.20, 962.35, 24.88)
setElementData(t,"name","Rozpocz?cie pracy autobus?w")
local vehs = {}

createBlip(-1754.20, 962.35, 24.88, 46,2,0,0,0,0,0,275)

local code = "Autobusy"
        local zone = createColCuboid(-1542.65320, 599.93549, 6.18316, 7.600830078125, 42.438110351563, 7.0280956268311)

addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "vehicle_job_owner") then
        outputChatBox("praca w trakcie poprawek", el)
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:reputation") < 200 then outputChatBox("Aby rozpocz?? t? prac? potrzebujesz minimum 200 RP!",el) return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local autbus = createVehicle(431, -1755.78, 951.76, 24.84, 359.5, 360.0, 269.7)
    setElementFrozen(el,true)
    setElementData(autbus, "vehicle_job_owner", el)
    setElementData(autbus, "vehicle:fuel", 100000)
    setElementData(autbus, "vehicle:mileage", math.random(50000,80000))
    setVehicleHandling(autbus, "maxVelocity", 100.0)
    setElementData(el,"player:job",code)
    setTimer(warpPedIntoVehicle,2000,1,el, autbus)
    setTimer(setElementFrozen,2000,1,el, false)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, autbus)

    vehs[el] = autbus
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("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
    end
end) 


Oraz drugi kod z checkpointami (tras?)
 local code = "Autobusy"
local districtsBus = {
{-1734.31, 941.31, 24.84, 359.5, 0.0, 212.1},
{-1581.19, 918.69, 7.58, 358.8, 359.7, 270.1},
{-1562.08, 789.62, 7.14, 359.5, 0.0, 180.5},
{-1566.04, 505.87, 7.14, 359.5, 0.0, 170.2},
{-1802.76, 254.36, 14.66, 3.2, 1.2, 143.5},
{-1801.11, -40.39, 14.90, 354.8, 0.4, 181.5},
{-1801.62, -308.34, 25.05, 358.7, 0.1, 177.1},
{-1880.40, -575.49, 24.55, 359.5, 0.0, 90.5},
{-2195.72, -447.88, 50.33, 2.5, 0.0, 45.4},
{-2252.01, -165.17, 35.28, 359.5, 359.6, 1.0},
{-2249.09, 197.96, 35.27, 359.5, 0.0, 358.9},
{-2677.44, 159.56, 4.28, 359.5, 359.9, 90.5},
{-2708.17, 3.65, 4.28, 359.5, 0.0, 181.6},
{-2689.33, -212.74, 4.28, 359.5, 359.9, 272.1},
{-2419.26, -88.42, 35.27, 359.4, 359.3, 359.2},
{-2035.42, -72.31, 35.26, 359.5, 359.9, 270.0},
{-2003.60, 140.18, 27.64, 359.5, 360.0, 357.7},
{-1999.89, 424.20, 35.12, 359.5, 0.2, 359.6},
{-2000.23, 734.48, 45.46, 358.6, 1.2, 0.6},
{-1894.90, 907.80, 35.12, 359.5, 359.7, 342.2},
{-1755.33, 951.90, 24.84, 359.5, 0.0, 270.2},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    if isElement(blip) then
destroyElement(blip)
end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end  
if getElementData(localPlayer,"player:job") == code then
setElementData(localPlayer,"player:job",false)
end
triggerServerEvent("destroyVeh", localPlayer)
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(),finishJob)


addEvent("finishJob",true)
addEventHandler("finishJob",root,function(plr)
if plr ~= localPlayer then return end
finishJob()
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, 3000, 0)
        outputChatBox("Za dojazd otrzymujesz 3000 $")
    end
end

function showMarker()
if isElement(blip) then
destroyElement(blip)
end
    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], "corona", 4, 0, 255, 255)
    blip = createBlip(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3],12)
    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, "player:job") then
        setElementData(localPlayer, "player:job", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("Zako?czy?e? prac?")
        end
    end
end) 


Mi?o by by?o gdyby kto? wyt?umaczy?. :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-13, 23:29


nanKy







Wiek: 23
Na forum: 4006 dni
Posty: 498
Nick w MP: nanky

Piwa: 1775

Respekt: 239
Respekt: 239Respekt: 239

Zmie? funkcje createMarker na:
exports.custom_markers:createCustomMarker
czyli

local m1 = exports.custom_markers:createCustomMarker(-1754.20, 962.35, 24.88-.9, "cylinder", 3.0, 0, 186, 255)

i tak dalej...

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Grubyyy
Wysłany: 2018-06-14, 11:07


Eitho







Wiek: 24
Na forum: 3630 dni
Posty: 330
Nick w MP: Eitho

Piwa: 749

Respekt: 256,5
Respekt: 256,5Respekt: 256,5Respekt: 256,5

Albo wklej sobie na samej g?rze kodu to:
function createMarker(x, y ,z, typ, rozmiar, r, g, b, a)
    local marker = exports['custom_markers']:createCustomMarker(x, y, z, typ or 'cylinder', rozmiar or '3', r or 0, g or 0, b or 255, a or 255)
    return marker
end


Podpis
good old days :]
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Grubyyy
Wysłany: 2018-06-14, 21:10


Grubyyy







Wiek: 22
Na forum: 3262 dni
Posty: 22
Nick w MP: GrubyMTA



Respekt: 50

Dzi?kuje pi?knie za pomoc!

Postaw piwo autorowi tego posta
 

 
Tagi: customowe :: markery :: jak :: poprawnie :: użyć?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Customowe markery, jak poprawnie użyć? 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