carlinhous1996
New Member
Could someone help me for this leverage system to take from 1 to 10 players .
ex: it will work if you have only 1 player and/or if you have 7, 3, 5, 10.
I made a change that a friend suggested, but it is giving this error
[Error - Action Interface]
data/actions/scripts/alavanca/bossdeath.luanUse
Description:
(luaGetThingFromPos) Tile not found
ex: it will work if you have only 1 player and/or if you have 7, 3, 5, 10.
I made a change that a friend suggested, but it is giving this error
[Error - Action Interface]
data/actions/scripts/alavanca/bossdeath.luanUse
Description:
(luaGetThingFromPos) Tile not found
Lua:
-- CONFIG --
local playersOnly = "no"
local questLevel = 1
local STORAGE_BOSS_CD = 17457
local cdtime = 1 * 1 * 1 -- exhaust in seconds
local room = { -- boss room
fromX = 1802,
fromY = 675,
fromZ = 7,
--------------
toX = 1868,
toY = 724,
toZ = 7
}
local monster_pos = {
[1] = { pos = { 1837, 716, 7 }, monster = "Cursed Prospector Soul" }
}
local players_pos = {
{ x = 1834, y = 702, z = 6, stackpos = 253 },
{ x = 1834, y = 701, z = 6, stackpos = 253 },
{ x = 1835, y = 701, z = 6, stackpos = 253 },
{ x = 1836, y = 701, z = 6, stackpos = 253 },
{ x = 1837, y = 701, z = 6, stackpos = 253 },
{ x = 1838, y = 701, z = 6, stackpos = 253 },
{ x = 1837, y = 702, z = 6, stackpos = 253 },
{ x = 1836, y = 702, z = 6, stackpos = 253 },
{ x = 1835, y = 702, z = 6, stackpos = 253 },
{ x = 1838, y = 702, z = 6, stackpos = 253 }
}
local new_player_pos = {
{ x = 1830, y = 715, z = 7 },
{ x = 1842, y = 715, z = 7 },
{ x = 1836, y = 720, z = 7 },
{ x = 1836, y = 710, z = 7 },
{ x = 1836, y = 715, z = 7 },
{ x = 1836, y = 715, z = 7 },
{ x = 1835, y = 713, z = 7 },
{ x = 1833, y = 721, z = 7 },
{ x = 1838, y = 718, z = 7 },
{ x = 1837, y = 718, z = 7 }
}
-- CONFIG END --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local all_ready, monsters, player, level = 0, 0, {}, 0
if item.itemid == 9826 then
for i = 1, #players_pos do
table.insert(player, 0)
end
for i = 1, #players_pos do
player[i] = getThingfromPos(players_pos[i])
if player[i].itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player[i].uid) == true then
all_ready = all_ready + 1
else
monsters = monsters + 1
end
else
all_ready = all_ready + 1
end
end
end
if all_ready > 0 then
for i = 1, #players_pos do
player[i] = getThingfromPos(players_pos[i])
if isPlayer(player[i].uid) == true then
if getPlayerStorageValue(player[i].uid, STORAGE_BOSS_CD) > os.time() then
doPlayerSendCancel(cid, "Acesso so liberado a cada 20h.")
return false
end
if getPlayerLevel(player[i].uid) >= questLevel then
level = level + 1
end
else
level = level + 1
end
end
if level == #players_pos then
if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
for _, area in pairs(monster_pos) do
doSummonCreature(area.monster, { x = area.pos[1], y = area.pos[2], z = area.pos[3] })
end
for i = 1, #players_pos do
if isPlayer(player[i].uid) then
doSendMagicEffect(players_pos[i], CONST_ME_POFF)
doTeleportThing(player[i].uid, new_player_pos[i])
doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
setPlayerStorageValue(player[i].uid, STORAGE_BOSS_CD, os.time() + cdtime)
end
end
doTransformItem(item.uid, 9825)
else
doPlayerSendTextMessage(cid, 19, "Only players can do this quest.")
return false
end
else
doPlayerSendTextMessage(cid, 19, "All Players have to be level " .. questLevel .. " to do this quest.")
return false
end
else
doPlayerSendCancel(cid, "You need " .. table.getn(players_pos) .. " players to do this quest.")
return false
end
elseif item.itemid == 9825 then
local player_room = 0
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = { x = x, y = y, z = z, stackpos = 253 }
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
if isPlayer(thing.uid) == true then
player_room = player_room + 1
end
end
end
end
end
if player_room >= 1 then
doPlayerSendTextMessage(cid, 19, "There is already a team in the quest room.")
return false
elseif player_room == 0 then
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = { x = x, y = y, z = z, stackpos = 253 }
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
doRemoveCreature(thing.uid)
end
end
end
end
doTransformItem(item.uid, 9826)
end
end
return true
end