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

Wysłany: 2015-03-15, 16:49


GumaPL123







Wiek: 52
Na forum: 4160 dni
Posty: 6
Nick w MP: GumaPl

Piwa: 1

Respekt: 50

Klatka dzia?a, ale gdy chce usun?? j? usuwa si?, ale wyst?puje b??d z destroyElement. Stawiam piwka.

-- Copyright by Fanta @2014. Zachowaj autora !

local kratki={}
klatka = {}
local komenda "klatka" -- komenda bez '/'

addCommandHandler(komenda, function(plrcmdtarget)
local accName getAccountName getPlayerAccount plr ) ) 
     if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then 
    if not target then 
        outputChatBox("Uzyj: /klatka <nick gracza>")
        return
    end

    local cel=getPlayerFromName(target)
    if not cel then 
        outputChatBox("Nie ma takiego gracza.")
        return
    end

    local x,y,z=getElementPosition(cel)
    local dim=getElementDimension(cel)
    local int=getElementInterior(cel)

    if kratki[celthen
        for i=1#kratki[cel] do -- najoptymalniejsza petla
            if isElement(kratki[cel][i]) then
                destroyElement(kratki[cel][i])
            end
        end
        kratki[cel]=nil
    end

    kratki[cel]={}
    kratki[cel][1]=createObject(971xyz-0.92700180.0) -- O.KNie rusza?
    kratki[cel][2]=createObject(971xyz+62700180) -- O.K Nie rusza?
    kratki[cel][3]=createObject(971xy+3.5z+2.5000) -- O.KNie rusza?
    kratki[cel][4]=createObject(971x-4.5yz+2.500270) -- O.KNie rusza?
    kratki[cel][5]=createObject(971xy-3.5z+2.500180) -- O.KNie rusza?
    kratki[cel][6]=createObject(971x+4yz+2.500270) -- O.KNie rusza?
    table.insert klatkakratki[cel][1] )
    table.insert klatkakratki[cel][2] )
    table.insert klatkakratki[cel][3] )
    table.insert klatkakratki[cel][4] )
    table.insert klatkakratki[cel][5] )
    table.insert klatkakratki[cel][6] )
    

    setElementInterior(kratki[cel][1], int)
    setElementDimension(kratki[cel][1], dim)
    setElementInterior(kratki[cel][2], int)
    setElementDimension(kratki[cel][2], dim)
    setElementInterior(kratki[cel][3], int)
    setElementDimension(kratki[cel][3], dim)
    setElementInterior(kratki[cel][4], int)
    setElementDimension(kratki[cel][4], dim)
    setElementInterior(kratki[cel][5], int)
    setElementDimension(kratki[cel][5], dim)
    setElementInterior(kratki[cel][6], int)
    setElementDimension(kratki[cel][6], dim)
    outputChatBox("Stworzy?e?/a? klatk? wok?? gracza " .. getPlayerName(cel), plr)
    end
end)


-- Event

function zabezpieczenie()
        -- zabezpieczenie jezeli zakratowano graczaa on wyszedl.
    if kratki[sourcethen
        for i=1#kratki[source] do
            if isElement(kratki[source][i]) then
                destroyElement(kratki[source][i])
            end
        end
        kratki[source]=nil
    end
end
addEventHandler("onPlayerQuit"rootzabezpieczenie)
addCommandHandler("klatkausun"zabezpieczenie)


addCommandHandler "usunklatke", function(plr)
for k,v in ipairs klatka ) do
local accName getAccountName getPlayerAccount plr ) ) 
     if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then 
destroyElement )
end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-03-15, 18:38


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Nie wnios? nic do tematu, ale pan Fanta powinien by? ukarany. Kod pochodzi z innego forum, kt?ry wstawi? m?j kolega, nie wiem czemu na g?rze jest napisane "Copyright by Fanta.."

Co do kodu, prosz? przerobi?em go lekko dla swojego serwera ale udost?pnie Ci go :


addCommandHandler "usun", function ( plrcmdcel )
    gr exports["core"]:partNick plrcel )
    if gr then
        if kratki[grthen
            for i=1#kratki[gr] do -- najoptymalniejsza petla
                if isElement(kratki[gr][i]) then
                    destroyElement(kratki[gr][i])
                end
            end
        kratki[gr]=nil
        id getElementData gr"ID" )
        outputChatBox "Administrator "..getPlayerName plr ).." [ "..id.." ] uwolni? Ci?"gr255255255 )
        setElementData gr"klatka"false )
        end
    end
end)


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Tagi: usuwanie :: klatki
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