Zak.Tibiam
New Member
- Joined
- Mar 25, 2012
- Messages
- 150
- Reaction score
- 3
local walls = {
{pos = Position(1000, 1000, 7), id = xxxx}
}
function toggleWall()
local ret = ''
for _, v in ipairs(walls) do
local tile = Tile(v.pos)
local wall = tile:getItemById(v.id)
if wall then
wall:remove()
ret = 'off'
else
Game.createItem(v.id, 1, v.pos)
ret = 'on'
end
end
return ret
end
function onSay(player, words, param)
if player:getAccountType() < 5 then
return false
end
toggleWall()
player:sendTextMessage(MESSAGE_STATUS_DESCR, "Wall toggled ".. toggleWall() ..".")...
local walls = {
{pos = Position(1000, 1000, 7), id = xxxx}
}
function toggleWall()
local ret = ''
for _, v in ipairs(walls) do
local tile = Tile(v.pos)
local wall = tile:getItemById(v.id)
if wall then
wall:remove()
ret = 'off'
else
Game.createItem(v.id, 1, v.pos)
ret = 'on'
end
end
return ret
end
function onSay(player, words, param)
if player:getAccountType() < 5 then
return false
end
toggleWall()
player:sendTextMessage(MESSAGE_STATUS_DESCR, "Wall toggled ".. toggleWall() ..".")
return false
end
-- <talkaction words="!wall" script="wall_toggle.lua" />
Lua Script Error: [TalkAction Interface]Can just simply use a toggle instead of on/off, just simply add more pos/id pairs to the table and you're good to go.
Lua:local walls = { {pos = Position(1000, 1000, 7), id = xxxx} } function toggleWall() local ret = '' for _, v in ipairs(walls) do local tile = Tile(v.pos) local wall = tile:getItemById(v.id) if wall then wall:remove() ret = 'off' else Game.createItem(v.id, 1, pos) ret = 'on' end end return ret end function onSay(player, words, param) if player:getAccountType() < 5 then return false end toggleWall() player:sendTextMessage(MESSAGE_STATUS_DESCR, "Wall toggled ".. toggleWall() ".") return false end -- <talkaction words="!wall" script="wall_toggle.lua" />
Edited the script in my post, re-copy it.Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/parede.luanSay
attempt to index a nil value
stack traceback:
[C]: in ?
[C]: in function 'createItem'
data/talkactions/scripts/parede.lua:14: in function 'toggleWall'
data/talkactions/scripts/parede.lua:25: in function <data/talkactions/scripts/parede.lua:21>
when i say !wall i got this error:Edited the script in my post, re-copy it.
for now you can just comment the line 26 outsomeone support me please, thanks!
--player:sendTextMessage(MESSAGE_STATUS_DESCR, "Wall toggled ".. toggleWall() ".")
Edited again, don't double post in order to try to get help, you've been a member for 7 years you should've at least read the rules by now.
for now you can just comment the line 26 out
--player:sendTextMessage(MESSAGE_STATUS_DESCR, "Wall toggled ".. toggleWall() ".")