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

Wysłany: 2016-08-24, 11:47


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Witam mam o to taki kodzik na klatk?:
klatka false

addCommandHandler("klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == false then
                local x,y,getElementPosition(player)
                sk createObject(971xy69000)
                lxk createObject(971xy4.2z+2.700180)
                lzk createObject(971xy4.2z+2.700180)
                pxk createObject(971x4.2yz+2.70090)
                pzk createObject(971x4.2yz+2.70090)
                klatka true
            else
                outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
            end
        end
addCommandHandler("usun.klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == true then
                destroyElement(sk)
                destroyElement(lxk)
                destroyElement(lzk)
                destroyElement(pxk)
                destroyElement(pzk)
                klatka false
            else
                
            end
        end    
    end
)
    end
)


I chcia?bym zrobi? aby jedna osoba mog?a zrobi? jedn? klatk?, a jak bedzie chciala ja usunac to usuwa jej klatke

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:23


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

To znowu najpro?ciej u?y? getElementDaty na nick

klatka false

addCommandHandler("klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == false then
                local x,y,getElementPosition(player)
                sk createObject(971xy69000)
                lxk createObject(971xy4.2z+2.700180)
                lzk createObject(971xy4.2z+2.700180)
                pxk createObject(971x4.2yz+2.70090)
                pzk createObject(971x4.2yz+2.70090)
                klatka true
                  setElementData(klatka,"stworzono",true)
                   setElementData(klatka,"kogo",getPlayerName(player))
            else
                outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
            end
        end
addCommandHandler("usun.klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == true then
                   if not getElementData(klatka"stworzono"then return end
      if getElementData(klatka,"kogo") == getPlayerName(playerthen
                destroyElement(sk)
                destroyElement(lxk)
                destroyElement(lzk)
                destroyElement(pxk)
                destroyElement(pzk)
                klatka false
            else
                end

            end
        end    
    end
)
    end
)


Nie wiem czy akurat na zmienn? podzia?a, je?li nie no to musisz osobno na ka?dy obiekt.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:25


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"marcin778" napisał/a:

To znowu najpro?ciej u?y? getElementDaty na nick

klatka false

addCommandHandler("klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == false then
                local x,y,getElementPosition(player)
                sk createObject(971xy69000)
                lxk createObject(971xy4.2z+2.700180)
                lzk createObject(971xy4.2z+2.700180)
                pxk createObject(971x4.2yz+2.70090)
                pzk createObject(971x4.2yz+2.70090)
                klatka true
                  setElementData(klatka,"stworzono",true)
                   setElementData(klatka,"kogo",getPlayerName(player)
            else
                outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
            end
        end
addCommandHandler("usun.klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == true then
                   if not getElementData(klatka"stworzono"then return end
      if getElementData(klatka,"kogo") == getPlayerName(playerthen
                destroyElement(sk)
                destroyElement(lxk)
                destroyElement(lzk)
                destroyElement(pxk)
                destroyElement(pzk)
                klatka false
            else
                end

            end
        end    
    end
)
    end
)


Nie wiem czy akurat na zmienn? podzia?a, je?li nie no to musisz osobno na ka?dy obiekt.


Jak nie wiesz to nie pomagaj... I od razu m?wi?, ?e nie zadzia?a. Do ka?dego obiektu element date trzeba przypisa? osobno. I nie trzeba element daty robi? na nick, mo?na to zrobi? na gracza i b?dzie wtedy ?atwiej go pobra?, albo jeszcze lepiej to obiekty przypisa? do gracza.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Ostatnio zmieniony przez AteX 2016-08-24, 12:29, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:29


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Wywala b??dy w elementdatach kt?re doda?e?.



Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:31


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"BlackTen" napisał/a:

Wywala b??dy w elementdatach kt?re doda?e?.

Obrazek


Jego kod nie zadzia?a, bo zrobi? elementdate na zmienn?... Musisz przypisa? ka?dy obiekt do gracza. Podpowiem, bo pewnie nie rozumiesz:
setElementData(gracz,"Obiekt1",obiekt1)
setElementData(gracz,"Obiekt2",obiekt2)
...
...


"Programista LUA" w sygnaturze, a nikt z was takich podstaw nie ogarnia...

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:37


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

AteX, Nie wiem u kogo ty widzisz programist? w sygnaturze ale to ju? tw?j dylemat.

BlackTen,
klatka false

addCommandHandler("klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == false then
                local x,y,getElementPosition(player)
                sk createObject(971xy69000)
                setElementData(sk,"jest",true)
                setElementData(sk,"kogo",getPlayerName(player))
                lxk createObject(971xy4.2z+2.700180)
                setElementData(lxk,"jest",true)
                setElementData(lxk,"kogo",getPlayerName(player))
                lzk createObject(971xy4.2z+2.700180)
                setElementData(lzk,"jest",true)
                setElementData(lzk,"kogo",getPlayerName(player))
                pxk createObject(971x4.2yz+2.70090)
                setElementData(pxk,"jest",true)
                setElementData(pxk,"kogo",getPlayerName(player))
                pzk createObject(971x4.2yz+2.70090)
                setElementData(pzk,"jest",true)
                setElementData(pzk,"kogo",getPlayerName(player))
                klatka true
            else
                outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
            end
        end
addCommandHandler("usun.klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == true then
            if not getElementData(sk"jest"then return end
               if getElementData(sk,"kogo")==getPlayerName(playerthen
                destroyElement(sk)
              if not getElementData(lxk,"jest"then return end
              elseif getElementData(lxk,"kogo")==getPlayerName(playerthen
                destroyElement(lxk)
                if not getElementData(lzk,"jest"then return end
                elseif getElementData(lzk,"kogo")==getPlayerName(playerthen
                destroyElement(lzk)
                  if not getElementData(pxk,"jest"then return end
                    elseif getElementData(pxk,"kogo")==getPlayerName(playerthen
                destroyElement(pxk)
                     if not getElementData(pzk,"jest"then return end
                         elseif getElementData(pzk,"kogo")==getPlayerName(playerthen
                destroyElement(pzk)
                klatka false
            else
                end
            end
        end    
    end
)
    end
)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:44


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"marcin778" napisał/a:

AteX, Nie wiem u kogo ty widzisz programist? w sygnaturze ale to ju? tw?j dylemat.

BlackTen,
klatka false

addCommandHandler("klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == false then
                local x,y,getElementPosition(player)
                sk createObject(971xy69000)
                setElementData(sk,"jest",true)
                setElementData(sk,"kogo",getPlayerName(player))
                lxk createObject(971xy4.2z+2.700180)
                setElementData(lxk,"jest",true)
                setElementData(lxk,"kogo",getPlayerName(player))
                lzk createObject(971xy4.2z+2.700180)
                setElementData(lzk,"jest",true)
                setElementData(lzk,"kogo",getPlayerName(player))
                pxk createObject(971x4.2yz+2.70090)
                setElementData(pxk,"jest",true)
                setElementData(pxk,"kogo",getPlayerName(player))
                pzk createObject(971x4.2yz+2.70090)
                setElementData(pzk,"jest",true)
                setElementData(pzk,"kogo",getPlayerName(player))
                klatka true
            else
                outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
            end
        end
addCommandHandler("usun.klatka",
    function (player)
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
            if klatka == true then
            if not getElementData(sk"jest"then return end
               if getElementData(sk,"kogo")==getPlayerName(playerthen
                destroyElement(sk)
              if not getElementData(lxk,"jest"then return end
              elseif getElementData(lxk,"kogo")==getPlayerName(playerthen
                destroyElement(lxk)
                if not getElementData(lzk,"jest"then return end
                elseif getElementData(lzk,"kogo")==getPlayerName(playerthen
                destroyElement(lzk)
                  if not getElementData(pxk,"jest"then return end
                    elseif getElementData(pxk,"kogo")==getPlayerName(playerthen
                destroyElement(pxk)
                     if not getElementData(pzk,"jest"then return end
                         elseif getElementData(pzk,"kogo")==getPlayerName(playerthen
                destroyElement(pzk)
                klatka false
            else
                end
            end
        end    
    end
)
    end
)


Sygantura, podpis... nie moja wina, ?e tutaj inaczej to nazwali. I b?agam przesta? pomaga? jak nie wiesz jak pom?c. Taki kod nie ZADZIA?A. Za kolejne wprowadzenie w b??d ju? b?dzie upomnienie, bo support i "Programista LUA" w podpisie nie upowa?nia do takich rzeczy. Mo?na to pod nabijanie post?w zaliczy?, bo to nawet pomoc nie jest. A to kod, bo widz? coraz to g?upsze pomys?y masz:
addCommandHandler("klatka", function (player)
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
        if not getElementData(player,"Obiekt1")  then
            local x,y,getElementPosition(player)
            local sk createObject(971xy69000)
            local lxk createObject(971xy4.2z+2.700180)
            local lzk createObject(971xy4.2z+2.700180)
            local pxk createObject(971x4.2yz+2.70090)
            local pzk createObject(971x4.2yz+2.70090)
            setElementData(player,"Obiekt1",sk)
            setElementData(player,"Obiekt2",lxk)
            setElementData(player,"Obiekt3",lzk)
            setElementData(player,"Obiekt4",pxk)
            setElementData(player,"Obiekt5",pzk)
        else
            outputChatBox("Jest ju? stworzona klatka! Aby j? usun?? wpisz /usun.klatka",player)
        end
   end
end)
addCommandHandler("usun.klatka", function (player)
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("RCON")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Moderator")) then
        if getElementData(player,"Obiekt1"then
            destroyElement(getElementData(player,"Obiekt1"))
            destroyElement(getElementData(player,"Obiekt2"))
            destroyElement(getElementData(player,"Obiekt3"))
            destroyElement(getElementData(player,"Obiekt4"))
            destroyElement(getElementData(player,"Obiekt5"))
            setElementData(player,"Obiekt1",false)
            setElementData(player,"Obiekt2",false)
            setElementData(player,"Obiekt3",false)
            setElementData(player,"Obiekt4",false)
            setElementData(player,"Obiekt5",false)
        end
    end    
end)


Mog? by? b??dy, bo kod by? straszy, ale setElementDaty s? dobre, wi?c wiesz BlackTen ju? chyba o co chodzi.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:52


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Dobra dzia?a, ale mog? tworzy? ile chce klatek a usun?? tylko jedn? ;(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 12:56


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"BlackTen" napisał/a:

Dobra dzia?a, ale mog? tworzy? ile chce klatek a usun?? tylko jedn? ;(


Skopiuj kod jeszcze raz... W?a?nie to przetestowa?em i nie mog? stworzy? wi?cej ni? jednej klatki.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 13:14


_Haze

Peace Yo!






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

Piwa: 2628

Respekt: 1020
Respekt: 1020

ah radze ci zrobi? to na tabele
obiekty={}
przy komendzie klatka
obiekty[1][plr] = createObject(...)
obiekty[2][plr] = createObject(...)
obiekty[3][plr] = createObject(...)
wtedy
przy usuwaniu klatki
for k,v in pairs(obiekty) do
destroyElement(obiekty[k][plr])
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 13:18


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"Hazmudex" napisał/a:

ah radze ci zrobi? to na tabele
obiekty={}
przy komendzie klatka
obiekty[1][plr] = createObject(...)
obiekty[2][plr] = createObject(...)
obiekty[3][plr] = createObject(...)
wtedy
przy usuwaniu klatki
for k,v in pairs(obiekty) do
destroyElement(obiekty[k][plr])
end


Te? dobry spos?b, ale obawiam si? ?e zbyt skomplikowany dla tych "programist?w". W p?tli jeszcze doda?bym sprawdzanie gracza, bo jak p?tla si? wykona dla [k][innyplr] to nwm czy debugscript nie by?by zaspamiony troch?.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-24, 13:21


_Haze

Peace Yo!






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

Piwa: 2628

Respekt: 1020
Respekt: 1020

"AteX" napisał/a:

"Hazmudex" napisał/a:

ah radze ci zrobi? to na tabele
obiekty={}
przy komendzie klatka
obiekty[1][plr] = createObject(...)
obiekty[2][plr] = createObject(...)
obiekty[3][plr] = createObject(...)
wtedy
przy usuwaniu klatki
for k,v in pairs(obiekty) do
destroyElement(obiekty[k][plr])
end


Te? dobry spos?b, ale obawiam si? ?e zbyt skomplikowany dla tych "programist?w". W p?tli jeszcze doda?bym sprawdzanie gracza, bo jak p?tla si? wykona dla [k][innyplr] to nwm czy debugscript nie by?by zaspamiony troch?.

mam rozwi?zanie problemu zamieniamy obiekty[plr][1] itd i wtedy w petli dajemy obiekty[plr] powinno dzia?a? ale nie jestem pewien na 100% znam bardziej praktyke ni? teorie ;d

Postaw piwo autorowi tego posta
 

 
Tagi: klatka
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