Doongogar Posted September 30, 2021 Posted September 30, 2021 (edited) ola eu gostaria de saber como faço para excluir os objetos criados por esse script (não fui eu que fiz) gostaria de uma solução, que apagasse todos os objetos criados, indenpendente mente do id do objeto, e se estou longe ou perto do objeto function createObjectCommand(thePlayer, commandName) if (thePlayer) then local x, y, z = getElementPosition(thePlayer) local theObject = createObject(1238, x, y, z - 0.50, 0, 0, 0) if (theObject) then end end end addCommandHandler("cone", createObjectCommand) Edited September 30, 2021 by SciptNovato
Blaack Posted September 30, 2021 Posted September 30, 2021 3 hours ago, SciptNovato said: ola eu gostaria de saber como faço para excluir os objetos criados por esse script (não fui eu que fiz) gostaria de uma solução, que apagasse todos os objetos criados, indenpendente mente do id do objeto, e se estou longe ou perto do objeto function createObjectCommand(thePlayer, commandName) if (thePlayer) then local x, y, z = getElementPosition(thePlayer) local theObject = createObject(1238, x, y, z - 0.50, 0, 0, 0) if (theObject) then end end end addCommandHandler("cone", createObjectCommand) Para isso você deve armazenar todos os objetos dentro de uma tabela, e depois entrar na tabela e remover todos os objetos que ali estão... local objetos = {} function createObjectCommand(thePlayer, commandName) if (thePlayer) then local x, y, z = getElementPosition(thePlayer) local theObject = createObject(1238, x, y, z - 0.50, 0, 0, 0) if (theObject) then table.insert(objetos, {theObject}) end end end addCommandHandler("cone", createObjectCommand) addCommandHandler("remover", function (thePlayer) if objetos and #objetos > 0 then for i, v in ipairs(objetos) do if v and isElement(v) then destroyElement(v) end end end end
Doongogar Posted October 2, 2021 Author Posted October 2, 2021 ERROR: Loading script failed: blitz\script.lua:50: '<name>' expected near '(' dando este erro no debug, não oque é, poderia ajudar?
Doongogar Posted October 15, 2021 Author Posted October 15, 2021 Não to conseguindo, consegue explicar melhor
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now