Nie rozumiem przekazu tego kodu, ale je?li chcesz usun?? jaki? element, w argument usuwania wepnij nazwe zmiennej ktora podales przy tworzeniu tego elementu
ja mam to wszystko zrobione tylko chodzi mi o to ?e nie wiem co gdzie podmieni? bo to aktualnie dzia?a /usun blokade [id] i teraz ja chce aby ?eby podmieni? w tej funkcji moj? zmienna na zmienn? gdzie jest id
addEvent("pokazHaslo", true)
addEventHandler("pokazHaslo", root, function(dupa,value,plr)
outputChatBox(edity, source)
if value then
local rbs = {}
for key, v in ipairs(getElementData(plr,'player:rbs')) do
if isElement(v) and key == tonumber(value) then
destroyElement(v)
outputChatBox('* #FFFFFFSchowa?e?(a?) blokad? – '..key, plr, 255, 255, 0, true)
else
table.insert(rbs,v)
end
setElementData(plr,'player:rbs',rbs)
end
else
--outputChatBox('Aby usun?c blokade wpisz /'..CommandName..' [id]',player,150,0,0)
end
end)
to jest ca?a funkcja od usuwania tej blokady i teraz jak wpisze w mojego edit boxa to z edit boxa wiadomosci wysylaja sie do zmiennej edity
addEvent("pokazHaslo", true)
addEventHandler("pokazHaslo", root, function(editboxwartosc,value,plr)
player = players[editboxwartosc]
for editboxwartosc,v in ipairs(getElemensByType("player"))do
if getElementData(v,"player:rbs") then
if v==2456 then
destroyElement(v)
end
end
end
end)
[ Dodano: 2021-04-26, 19:02 ]
Nie wiem czm ale nadal nie dzia??
Mo?e wyt?umacze jeszcze raz. Chodzi o to ?e jak wpisz? w panelu cyfr? np.1 to gdy wcze?niej tworz? blokad? to ona ma id 1 i przez to ?e wpisa?em 1 w panelu i klikn??em usun to powinna si? usun??
function barierka(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SAPD' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local obj = createObject(1228,x,y,z-0.65,0,0,rotZ)
table.insert(rbs,obj )
--setElementPosition ( source, x, y, z )
triggerClientEvent("setBreakable",root,obj)
setElementFrozen(obj,true)
outputChatBox('* #FFFFFFPostawi?e?(a?) barierk? – '..#rbs, source, 255, 255, 0, true)
barierkajest = true
setElementData(source,'player:rbs',rbs)
setElementInterior(obj, getElementInterior(source))
setElementDimension(obj, getElementDimension(source))
end
end
addEvent("barierka", true)
addEventHandler("barierka", root, barierka)
Dziwnie napisany, no ale dobra, robisz sobie tak :
id=pobranie id z edita
for _,v in ipairs(getElementsByType("object"))do
if getElementData(v,"player:rbs") then
if getElementData(v,"player:rbs")==tonumber(id) then
destroyElement(v)
end
end
end
Zrobi?em co? takiego wpisuje id w editbox i debug milczy nic si? nie dzieje nic si? nie usuwa
function takiese(idbarierkiu,value,plr)
id=idbarierkiu
for id,v in ipairs(getElementsByType("object"))do
if getElementData(v,"player:rbs") then
if getElementData(v,"player:rbs")==tonumber(id) then
destroyElement(v)
end
end
end
end
addEvent("pokazHaslo", true)
addEventHandler("pokazHaslo", root,takiese)
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