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

Wysłany: 2015-08-07, 15:55


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Witam co jest ?le bo nie tworz? si? markery ;(

Server

createBlip (-2749.2126464844, -282.72048950195, 7.0390625, 52, 2)

local m1 = createMarker(-2749.2126464844, -282.72048950195, 7.0390625, "cylinder", 2.0, 0, 0, 255)
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("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(574, x,y,z,0.0, 360.0, 269.9)

    setElementData(bus, "zrespilGracz", el)
    setElementData(bus, "pojazd_paliwo", 50)
    setElementData(bus, "pojazd_przebieg", 69696969)

    setVehicleHandling(bus,"maxVelocity", 50.00)

    warpPedIntoVehicle(el, bus)
    removePreviousVehicles(el)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
    setVehicleHandling(bus,"maxVelocity", 50,00) 

    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
end)


Client

local districtsBus = {
{-2759.78515625, -300.92272949219, 6.8835577964783},
{-2773.8361816406, -308.59124755859, 7.0846495628357},
{-2793.779296875, -327.03012084961, 6.88765001297},
{-2816.8186035156, -343.99880981445, 6.918562412262},
{-2821.4213867188, -376.2610168457, 7.0752058029175},
{-2823.5893554688, -411.74310302734, 7.0917067527771},
{-2822.4833984375, -438.37521362305, 7.0492911338806},
{-2813.8803710938, -469.29611206055, 6.9075212478638},
{-2799.2646484375, -479.85018920898, 7.2319717407227},
{-2780.4416503906, -484.73931884766, 7.0658345222473},
{-2766.7194824219, -467.84332275391, 7.0986380577087},
{-2748.4162597656, -447.96112060547, 7.2059483528137},
{-2725.7619628906, -426.81869506836, 7.3407506942749},
{-2698.5961914063, -405.72415161133, 7.8891768455505},
{-2670.0832519531, -386.27404785156, 9.6316785812378},
{-2640.3544921875, -369.75347900391, 12.902630805969},
{-2619.3635253906, -363.56521606445, 15.981020927429},
{-2593.1499023438, -356.41973876953, 20.162046432495},
{-2565.2365722656, -350.38421630859, 23.93825340271},
{-2538.2202148438, -347.13732910156, 26.719783782959},
{-2507.6264648438, -344.45175170898, 29.533433914185},
{-2473.9079589844, -344.09725952148, 32.209060668945},
{-2435.1982421875, -344.67300415039, 35.02466583252},
{-2401.1145019531, -344.9582824707, 37.100784301758},
{-2369.4729003906, -345.47967529297, 38.684703826904},
{-2332.7465820313, -347.08026123047, 39.702171325684},
{-2283.7736816406, -349.50787353516, 39.854637145996},
{-2239.9313964844, -350.88650512695, 38.217311859131},
{-2200.79296875, -351.31774902344, 36.684803009033},
{-2119.822265625, -350.8317565918, 35.093048095703},
{-2085.0456542969, -355.4928894043, 35.381050109863},
{-2047.3256835938, -344.05838012695, 35.335376739502},
{-2027.3559570313, -320.31622314453, 35.272094726563},
{-2002.6357421875, -274.40112304688, 35.146259307861},
{-2002.1392822266, -237.64616394043, 35.783416748047},
{-2002.1201171875, -189.88154602051, 35.765701293945},
{-2002.4118652344, -145.06700134277, 35.766960144043},
{-2003.3151855469, -102.12397003174, 35.719841003418},
{-2014.3458251953, -68.00562286377, 34.955924987793},
{-2035.2889404297, -67.558113098145, 35.217990875244},
{-2065.3271484375, -67.271354675293, 35.225231170654},
{-2090.3310546875, -67.191215515137, 35.225151062012},
{-2124.7634277344, -67.144561767578, 35.225467681885},
{-2161.0964355469, -67.225357055664, 35.226318359375},
{-2194.9211425781, -67.301376342773, 35.225452423096},
{-2228.2924804688, -67.376045227051, 35.225448608398},
{-2260.5302734375, -67.447860717773, 35.225402832031},
{-2291.6936035156, -67.516990661621, 35.217666625977},
{-2327.6398925781, -67.596336364746, 35.217533111572},
{-2363.4113769531, -67.674865722656, 35.231216430664},
{-2398.2707519531, -67.751052856445, 35.218166351318},
{-2419.10546875, -57.94694519043, 35.153244018555},
{-2418.796875, -37.200229644775, 35.21688079834},
{-2418.5908203125, -7.0211186408997, 35.216732025146},
{-2418.6157226563, 29.176654815674, 35.072303771973},
{-2433.6379394531, 42.248638153076, 34.720203399658},
{-2452.8505859375, 40.767295837402, 33.596279144287},
{-2481.3356933594, 40.86625289917, 28.065719604492},
{-2531.603515625, 40.640571594238, 21.937063217163},
{-2590.7875976563, 40.668231964111, 4.0481724739075},
{-2630.9853515625, 40.787540435791, 4.2346301078796},
{-2678.7512207031, 40.935779571533, 4.2389912605286},
{-2708.435546875, 18.455026626587, 4.2151455879211},
{-2708.3083496094, -8.241268157959, 4.2246460914612},
{-2708.279296875, -43.70027923584, 4.2364273071289},
{-2708.2446289063, -87.169235229492, 4.2297778129578},
{-2708.208984375, -132.12907409668, 4.232958316803},
{-2708.1774902344, -174.3166809082, 4.2675747871399},
{-2728.2336425781, -208.43060302734, 6.6568455696106},
{-2777.251953125, -207.30152893066, 7.0923757553101},
{-2812.0173339844, -232.98579406738, 7.0773029327393}
{-2812.6689453125, -250.9415435791, 7.0817537307739},
{-2815.275390625, -293.75814819336, 7.0845141410828},
{-2817.3041992188, -326.49703979492, 7.1099371910095},
{-2795.4387207031, -332.86657714844, 7.0847282409668},
{-2774.5307617188, -315.64337158203, 7.1167311668396},

}



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("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 5, 1)
    end
end

function showMarker()
    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], "checkpoint", 4, 0, 0, 255)
    
    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, "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("* Zako?czy?e? prac?")
        end
    end
end)


DB3:
Loading Script Failed ulica\bus_c.lua:74: '}' expected (to close'{' at line 2) near '{'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-07, 16:48


THEGizmo

Modeler/Uczeń Lua






Wiek: 28
Na forum: 4283 dni
Posty: 255
Nick w MP: THEGizmo

Piwa: 3091

Respekt: 200
Respekt: 200Respekt: 200


local districtsBus = {
{-2759.78515625, -300.92272949219, 6.8835577964783},
{-2773.8361816406, -308.59124755859, 7.0846495628357},
{-2793.779296875, -327.03012084961, 6.88765001297},
{-2816.8186035156, -343.99880981445, 6.918562412262},
{-2821.4213867188, -376.2610168457, 7.0752058029175},
{-2823.5893554688, -411.74310302734, 7.0917067527771},
{-2822.4833984375, -438.37521362305, 7.0492911338806},
{-2813.8803710938, -469.29611206055, 6.9075212478638},
{-2799.2646484375, -479.85018920898, 7.2319717407227},
{-2780.4416503906, -484.73931884766, 7.0658345222473},
{-2766.7194824219, -467.84332275391, 7.0986380577087},
{-2748.4162597656, -447.96112060547, 7.2059483528137},
{-2725.7619628906, -426.81869506836, 7.3407506942749},
{-2698.5961914063, -405.72415161133, 7.8891768455505},
{-2670.0832519531, -386.27404785156, 9.6316785812378},
{-2640.3544921875, -369.75347900391, 12.902630805969},
{-2619.3635253906, -363.56521606445, 15.981020927429},
{-2593.1499023438, -356.41973876953, 20.162046432495},
{-2565.2365722656, -350.38421630859, 23.93825340271},
{-2538.2202148438, -347.13732910156, 26.719783782959},
{-2507.6264648438, -344.45175170898, 29.533433914185},
{-2473.9079589844, -344.09725952148, 32.209060668945},
{-2435.1982421875, -344.67300415039, 35.02466583252},
{-2401.1145019531, -344.9582824707, 37.100784301758},
{-2369.4729003906, -345.47967529297, 38.684703826904},
{-2332.7465820313, -347.08026123047, 39.702171325684},
{-2283.7736816406, -349.50787353516, 39.854637145996},
{-2239.9313964844, -350.88650512695, 38.217311859131},
{-2200.79296875, -351.31774902344, 36.684803009033},
{-2119.822265625, -350.8317565918, 35.093048095703},
{-2085.0456542969, -355.4928894043, 35.381050109863},
{-2047.3256835938, -344.05838012695, 35.335376739502},
{-2027.3559570313, -320.31622314453, 35.272094726563},
{-2002.6357421875, -274.40112304688, 35.146259307861},
{-2002.1392822266, -237.64616394043, 35.783416748047},
{-2002.1201171875, -189.88154602051, 35.765701293945},
{-2002.4118652344, -145.06700134277, 35.766960144043},
{-2003.3151855469, -102.12397003174, 35.719841003418},
{-2014.3458251953, -68.00562286377, 34.955924987793},
{-2035.2889404297, -67.558113098145, 35.217990875244},
{-2065.3271484375, -67.271354675293, 35.225231170654},
{-2090.3310546875, -67.191215515137, 35.225151062012},
{-2124.7634277344, -67.144561767578, 35.225467681885},
{-2161.0964355469, -67.225357055664, 35.226318359375},
{-2194.9211425781, -67.301376342773, 35.225452423096},
{-2228.2924804688, -67.376045227051, 35.225448608398},
{-2260.5302734375, -67.447860717773, 35.225402832031},
{-2291.6936035156, -67.516990661621, 35.217666625977},
{-2327.6398925781, -67.596336364746, 35.217533111572},
{-2363.4113769531, -67.674865722656, 35.231216430664},
{-2398.2707519531, -67.751052856445, 35.218166351318},
{-2419.10546875, -57.94694519043, 35.153244018555},
{-2418.796875, -37.200229644775, 35.21688079834},
{-2418.5908203125, -7.0211186408997, 35.216732025146},
{-2418.6157226563, 29.176654815674, 35.072303771973},
{-2433.6379394531, 42.248638153076, 34.720203399658},
{-2452.8505859375, 40.767295837402, 33.596279144287},
{-2481.3356933594, 40.86625289917, 28.065719604492},
{-2531.603515625, 40.640571594238, 21.937063217163},
{-2590.7875976563, 40.668231964111, 4.0481724739075},
{-2630.9853515625, 40.787540435791, 4.2346301078796},
{-2678.7512207031, 40.935779571533, 4.2389912605286},
{-2708.435546875, 18.455026626587, 4.2151455879211},
{-2708.3083496094, -8.241268157959, 4.2246460914612},
{-2708.279296875, -43.70027923584, 4.2364273071289},
{-2708.2446289063, -87.169235229492, 4.2297778129578},
{-2708.208984375, -132.12907409668, 4.232958316803},
{-2708.1774902344, -174.3166809082, 4.2675747871399},
{-2728.2336425781, -208.43060302734, 6.6568455696106},
{-2777.251953125, -207.30152893066, 7.0923757553101},
{-2812.0173339844, -232.98579406738, 7.0773029327393},
{-2812.6689453125, -250.9415435791, 7.0817537307739},
{-2815.275390625, -293.75814819336, 7.0845141410828},
{-2817.3041992188, -326.49703979492, 7.1099371910095},
{-2795.4387207031, -332.86657714844, 7.0847282409668},
{-2774.5307617188, -315.64337158203, 7.1167311668396},

}



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("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 5, 1)
    end
end

function showMarker()
    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], "checkpoint", 4, 0, 0, 255)
    
    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, "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("* Zako?czy?e? prac?")
        end
    end
end)


Je?li pomog?em daj :piwo:

Podpis
Modeler Corporation Sp. Z.O.O

Postaw piwo autorowi tego posta
 

 
Tagi: praca :: sweeper
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