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

Wysłany: 2016-01-15, 19:09


Toffiaaak.







Wiek: 23
Na forum: 4410 dni
Posty: 128
Nick w MP: Toffy.

Piwa: 1836

Respekt: 242
Respekt: 242Respekt: 242

Siemano, posiadam skrypt na lakiernika w ls jednak?e mam ma?y problem, wszystko dzia?a lecz denerwuje mnie jeden warning.
Kod:

(GER)-MechanikDoherty/lakiernia.lua:30: Bad argument @ 'getElementData' [Expected element at argument 1, got boolean]

Tak wygl?da kod:
local strefyLakiernicze = {
    LakierniaDoherty = {
        cuboid = {1909.25574,-1861.5625013.60732-112.008.007.00},-- cuboid w ktorym musi znalezc sie pojazd
        marker = {1922.22437,-1853.95325,13.56194-0.9}, -- pozycja markera w ktorym gracz bedzie stal aby w??czylakierni?
        dostep_frakcja 1, -- id frakcji ktora ma do tego dostep
  },
}

for i,v in pairs(strefyLakiernicze) do
    setGarageOpen(21true)
    l_cuboid createColCuboid(unpack(v.cuboid))
    l_wybor createMarker(v.marker[1], v.marker[2], v.marker[3], "cylinder"1000100)
    setElementData(l_wybor"dostep_frakcja"v.dostep_frakcja)
    setElementData(l_wybor"lakiernia_cs"l_cuboid)
end

addEventHandler("onMarkerHit"root, function(elmd)
    if getElementData(source"lakiernia_cs"then
        local accName getAccountName (getPlayerAccount(el))
        if isObjectInACLGroup("user."..accNameaclGetGroup("Mechanik")) then
            if getElementType(el) == "player" then
                local pojazd getElementsWithinColShape(l_cuboid"vehicle")
                if #pojazd<1 then
                    outputChatBox("Na stanowisku lakierniczym nie ma ?adnego pojazdu!"el)
                    return
                end
                if #pojazd>1 then
                    outputChatBox("Na stanowisku lakierniczym jest zbyt du?o pojazd?w!"el)
                    return
                end
                for _,v in ipairs(getElementsByType("vehicle")) do
                    if isElementWithinColShape(vl_cuboidthen
                        if getVehicleOccupant(vthen
                            triggerClientEvent(el"onWyborLakieru"root)
                        else
                            outputChatBox("Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!"el)
                        end
                    end
                end
            end
        else
            outputChatBox("Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!"el25500)
        end
    end
end)

addEvent("onLakierujPojazd"true)
addEventHandler("onLakierujPojazd"root, function(kolor)
    if kolor == 0 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                playSoundFrontEnd(v46)
                setTimer(setVehicleColor30001v25500)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 1 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v2552550)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 2 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v095255)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 3 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v000)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 4 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v255255255)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 5 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v128128128)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 6 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v890255)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 7 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v255960)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 8 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v281435)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 9 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v2550186)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 10 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v02550)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 06:47


limitowanyy







Wiek: 43
Na forum: 4555 dni
Posty: 41

Piwa: 281

Respekt: 20,5

Ostrzeżeń: 20%
Zmien nazwe badz usun ( i )

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 07:19


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4266 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
Nazwa nic do b??du nie ma. A tak na szybkie oko masz co? nie tak z getelementdat? ale nie pomog? za bardzo bo nie mam jak

Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 10:48


THEGizmo

Modeler/Uczeń Lua






Wiek: 27
Na forum: 4141 dni
Posty: 255
Nick w MP: THEGizmo

Piwa: 3072

Respekt: 200
Respekt: 200Respekt: 200

Zobacz tera strona (server)
local strefyLakiernicze = {
    LakierniaDoherty = {
        cuboid = {1909.25574,-1861.5625013.60732-112.008.007.00},-- cuboid w ktorym musi znalezc sie pojazd
        marker = {1922.22437,-1853.95325,13.56194-0.9}, -- pozycja markera w ktorym gracz bedzie stal aby w??czylakierni?
        dostep_frakcja 1, -- id frakcji ktora ma do tego dostep
  },
}

for i,v in pairs(strefyLakiernicze) do
    setGarageOpen(21true)
    l_cuboid createColCuboid(unpack(v.cuboid))
    l_wybor createMarker(v.marker[1], v.marker[2], v.marker[3], "cylinder"1000100)
    setElementData(l_wybor"dostep_frakcja"v.dostep_frakcja)
    setElementData(l_wybor"lakiernia_cs"l_cuboid)
end

addEventHandler("onMarkerHit"root, function(elmd)
    if getElementData(source"lakiernia_cs"then
        local accName getAccountName (getPlayerAccount(el))
        if isObjectInACLGroup("user."..accNameaclGetGroup("Mechanik")) then
            if getElementType(el) == "player" then
                local pojazd getElementsWithinColShape(l_cuboid"vehicle")
                if #pojazd<1 then
                    outputChatBox("Na stanowisku lakierniczym nie ma ?adnego pojazdu!"el)
                    return
                end
                if #pojazd>1 then
                    outputChatBox("Na stanowisku lakierniczym jest zbyt du?o pojazd?w!"el)
                    return
                end
                for _,v in ipairs(getElementsByType("vehicle")) do
                    if isElementWithinColShape(vl_cuboidthen
                        if getVehicleOccupant(vthen
                            triggerClientEvent(el"onWyborLakieru"root)
                        else
                            outputChatBox("Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!"el)
                        end
                    end
                end
            end
        else
            outputChatBox("Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!"el25500)
        end
    end
end)

addEvent("onLakierujPojazd"true)
addEventHandler("onLakierujPojazd"root, function(kolor)
    if kolor == 0 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                playSoundFrontEnd(v46)
                setTimer(setVehicleColor30001v25500)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 1 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v2552550)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 2 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v039194)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 3 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v000)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 4 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v255255255)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 5 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v128128128)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 6 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v150750)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 7 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v2251650)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 8 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v65105225)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 9 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v255204221)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
    if kolor == 10 then
        for _,v in ipairs(getElementsByType("vehicle")) do
            if isElementWithinColShape(vl_cuboidthen
                setGarageOpen(21false)
                setTimer(setVehicleColor30001v02550)
                setTimer(setGarageOpen4000121true)
            end
        end
    end
end)


Podpis
Modeler Corporation Sp. Z.O.O

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 10:49


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

 if getElementType(el) == "player" then

daj to na poczatek
i wtedy
if getElementData(el"lakiernia_cs"then


Postaw piwo autorowi tego posta
 

 
Tagi: lakiernik
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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