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

Wysłany: 2018-03-04, 22:09


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Siemka mam skrypt na bramy kt?re otwieraj? si? graczowi z danym UID.
Lecz gdy chce aby brama si? dla mnie otworzy?a to niestety nie dzia?a to. A w DB3 te? czystko a tak?e UID te? dobre poda?em.
Daje kod:

local gate={
    -- var
    object=createObject(50201811.74, -1889.5613.410090),
    marker=createMarker(1811.74, -1889.5613.41"cylinder"60000),
    closed=true,
    animation=false,
}

gate.open=function()
    if gate.animation or not gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5610.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=false
    end60001)
end

gate.close=function()
    if gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5613.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=true
    end60001)
end

gate.toggle=function(el)
    if not el then return end

    if getElementData(el,"player_uid") == 2 then
        if gate.animation then
            return
        end

        if gate.closed then
            gate.open()
            setTimer(function()
                gate.close()
            end80001)

        end
    else
        outputChatBox("* Brak uprawnien."el25500)
    end
end

addEventHandler("onMarkerHit"gate.marker, function(el,md)
    gate.toggle(el)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-04, 22:13


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Powinno by?,

if getElementData(el,"player:uid") ~= 2 then


A, je?eli chcesz doda? wi?cej os?b to robisz,

if getElementData(el,"player:uid") ~= or 3 then


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2018-03-05, 17:34


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Ok dzia?a

A da rade zrobi? ?eby na id skina sie otwiera?a?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-05, 17:38


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Oczywi?cie, ?e si? da:

Więcej informacji znajdziesz w Wikipedii MTA:

getElementModel


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-05, 17:46


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Spr?buj,

local uprawnieniaSkin = {

    [ID]=true; -- tutaj wpisz id skina [ID]
    
}

local gate={
    -- var
    object=createObject(50201811.74, -1889.5613.410090),
    marker=createMarker(1811.74, -1889.5613.41"cylinder"60000),
    closed=true,
    animation=false,
}

gate.open=function()
    if gate.animation or not gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5610.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=false
    end60001)
end

gate.close=function()
    if gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5613.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=true
    end60001)
end

gate.toggle=function(el)
    if not el then return end

    local skin getElementModel (thePlayer) 
     if uprawnieniaSkin[skinthen 
        if gate.animation then
            return
        end

        if gate.closed then
            gate.open()
            setTimer(function()
                gate.close()
            end80001)
          end 
        end
    else
        outputChatBox("* Brak uprawnien."el25500)
    end
end

addEventHandler("onMarkerHit"gate.marker, function(el,md)
    gate.toggle(el)
end)


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2018-03-05, 18:15


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Niestety jakie? b??dy w DB3:
ERROR: Loading script failed: [XyzzyRP]/[obiekty]/wb-baza_gangu/brama.lua:53: 'end' expected (to close 'function' at line 37) near 'else'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-05, 18:17


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Pisa?em z g?owy i nie zauwa?y?em, ?e nie da?em end. Teraz powinno by? poprawnie,

local uprawnieniaSkin = {

    [ID]=true; -- tutaj wpisz id skina [ID]
    
}

local gate={
    -- var
    object=createObject(50201811.74, -1889.5613.410090),
    marker=createMarker(1811.74, -1889.5613.41"cylinder"60000),
    closed=true,
    animation=false,
}

gate.open=function()
    if gate.animation or not gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5610.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=false
    end60001)
end

gate.close=function()
    if gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5613.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=true
    end60001)
end

gate.toggle=function(el)
    if not el then return end

    local skin getElementModel (thePlayer) 
     if uprawnieniaSkin[skinthen 
        if gate.animation then
            return
        end
    end

        if gate.closed then
            gate.open()
            setTimer(function()
                gate.close()
            end80001)
        end
    else
        outputChatBox("* Brak uprawnien."el25500)
    end
end

addEventHandler("onMarkerHit"gate.marker, function(el,md)
    gate.toggle(el)
end)


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2018-03-05, 18:20


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Nie wiem o co chodzi ale dalej ten sam b??d

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-05, 18:23


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

"ReMiK1337" napisał/a:

Nie wiem o co chodzi ale dalej ten sam b??d


Co? nie dodaje mi tego end. Musisz wsadzi? end po funkcji if. Zaraz przetestuj? to Ci pode?l?

Teraz powinno by?, ok. Wkrad? si? b??d z end...
Jak co? to testowa?em na id skina: 280 - mo?esz zmieni?

createBlip (1811.74, -1889.5610.4150)

local uprawnieniaSkin = {

    [280]=true; -- tutaj wpisz id skina [ID]
    
}

local gate={
    -- var
    object=createObject(50201811.74, -1889.5613.410090),
    marker=createMarker(1811.74, -1889.5613.41"cylinder"60000),
    closed=true,
    animation=false,
}

gate.open=function()
    if gate.animation or not gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5610.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=false
    end60001)
end

gate.close=function()
    if gate.closed then return end

    gate.animation=true
    moveObject(gate.object50001811.74, -1889.5613.41000"OutQuad")
        
    setTimer(function()
        gate.animation=falsegate.closed=true
    end60001)
end

gate.toggle=function(el)
    if not el then return end

    local skin getElementModel (el) 
     if uprawnieniaSkin[skinthen 
        if gate.animation then
            return
        end

        if gate.closed then
            gate.open()
            setTimer(function()
                gate.close()
            end80001)
        end
    else
        outputChatBox("* Brak uprawnien."el25500)
    end
end

addEventHandler("onMarkerHit"gate.marker, function(el,md)
    gate.toggle(el)
end)


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2018-03-05, 18:47


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Wszystko dzia?a
Dzi?ki bardzo

Postaw piwo autorowi tego posta
 

 
Tagi: brama
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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