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.
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,z = getElementPosition(player)
sk = createObject(971, x, y, z + 6, 90, 0, 0)
setElementData(sk,"jest",true)
setElementData(sk,"kogo",getPlayerName(player))
lxk = createObject(971, x, y+ 4.2, z+2.7, 0, 0, 180)
setElementData(lxk,"jest",true)
setElementData(lxk,"kogo",getPlayerName(player))
lzk = createObject(971, x, y- 4.2, z+2.7, 0, 0, 180)
setElementData(lzk,"jest",true)
setElementData(lzk,"kogo",getPlayerName(player))
pxk = createObject(971, x+ 4.2, y, z+2.7, 0, 0, 90)
setElementData(pxk,"jest",true)
setElementData(pxk,"kogo",getPlayerName(player))
pzk = createObject(971, x- 4.2, y, z+2.7, 0, 0, 90)
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(player) then
destroyElement(sk)
if not getElementData(lxk,"jest") then return end
elseif getElementData(lxk,"kogo")==getPlayerName(player) then
destroyElement(lxk)
if not getElementData(lzk,"jest") then return end
elseif getElementData(lzk,"kogo")==getPlayerName(player) then
destroyElement(lzk)
if not getElementData(pxk,"jest") then return end
elseif getElementData(pxk,"kogo")==getPlayerName(player) then
destroyElement(pxk)
if not getElementData(pzk,"jest") then return end
elseif getElementData(pzk,"kogo")==getPlayerName(player) then
destroyElement(pzk)
klatka = false
else
end
end
end
end
)
end
)
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,z = getElementPosition(player)
sk = createObject(971, x, y, z + 6, 90, 0, 0)
setElementData(sk,"jest",true)
setElementData(sk,"kogo",getPlayerName(player))
lxk = createObject(971, x, y+ 4.2, z+2.7, 0, 0, 180)
setElementData(lxk,"jest",true)
setElementData(lxk,"kogo",getPlayerName(player))
lzk = createObject(971, x, y- 4.2, z+2.7, 0, 0, 180)
setElementData(lzk,"jest",true)
setElementData(lzk,"kogo",getPlayerName(player))
pxk = createObject(971, x+ 4.2, y, z+2.7, 0, 0, 90)
setElementData(pxk,"jest",true)
setElementData(pxk,"kogo",getPlayerName(player))
pzk = createObject(971, x- 4.2, y, z+2.7, 0, 0, 90)
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(player) then
destroyElement(sk)
if not getElementData(lxk,"jest") then return end
elseif getElementData(lxk,"kogo")==getPlayerName(player) then
destroyElement(lxk)
if not getElementData(lzk,"jest") then return end
elseif getElementData(lzk,"kogo")==getPlayerName(player) then
destroyElement(lzk)
if not getElementData(pxk,"jest") then return end
elseif getElementData(pxk,"kogo")==getPlayerName(player) then
destroyElement(pxk)
if not getElementData(pzk,"jest") then return end
elseif getElementData(pzk,"kogo")==getPlayerName(player) then
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,z = getElementPosition(player)
local sk = createObject(971, x, y, z + 6, 90, 0, 0)
local lxk = createObject(971, x, y+ 4.2, z+2.7, 0, 0, 180)
local lzk = createObject(971, x, y- 4.2, z+2.7, 0, 0, 180)
local pxk = createObject(971, x+ 4.2, y, z+2.7, 0, 0, 90)
local pzk = createObject(971, x- 4.2, y, z+2.7, 0, 0, 90)
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.
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
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?.
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
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