Hello When I try to use the lever it spawns the monsters but when i use it again it has a long line of errors it keeps going down with errors i cant even copy n paste the errors but i will try
the action script it to spawn 8 monsters its like anni
That is the error
the action script it to spawn 8 monsters its like anni
Code:
local room = { -- room with demons
from = {x = 2501, y = 4495, z = 5},
to = {x = 2503, y = 4997, z = 5},
}
local SMBOPL = { -- Summon Monster Based Off Player Level
{name = "exp", level = 1},
{name = "exp", level = 8},
{name = "exp", level = 45},
}
local monster_pos = {
{x = 2501, y = 4495, z = 5},
{x = 2502, y = 4495, z = 5},
{x = 2503, y = 4495, z = 5},
{x = 2503, y = 4496, z = 5},
{x = 2503, y = 4497, z = 5},
{x = 2502, y = 4497, z = 5},
{x = 2501, y = 4497, z = 5},
{x = 2501, y = 4496, z = 5}
}
local players_pos = {
{x = 2502, y =4496, z = 5, stackpos = 253}
}
local new_player_pos = {
{x = 2502, y =4496, z = 5}
}
local playersOnly = "no"
local minLevel = SMBOPL[1].level -- do not edit
local levelReq = 0 -- do not edit
local monsterName = '' -- do not edit
function onUse(cid, item, fromPosition, itemEx, toPosition)
local all_ready, monsters, player, level = 0, 0, {}, 0
if item.itemid == 1945 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 == #players_pos then
for i = 1, #players_pos do
player[i] = getThingfromPos(players_pos[i])
if isPlayer(player[i].uid) == TRUE then
levelReq, monsterName = reqCheck(player[i].uid, SMBOPL, minLevel)
if levelReq > minLevel then
level = level + 1
end
else
level = level + 1
end
end
if level == #players_pos and monsterName ~= nil then
if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
for m = 1, #monster_pos do
doSummonCreature(monsterName, {x = monster_pos[m].x, y = monster_pos[m].y, z = monster_pos[m].z})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos[i], CONST_ME_POFF)
doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
doTransformItem(item.uid, 1946)
end
else
doPlayerSendTextMessage(cid, 19, "Only players can use this spawn.")
end
else
doPlayerSendTextMessage(cid, 19, "All Players have to be minimum level "..minLevel.." to do this quest.")
end
else
doPlayerSendTextMessage(cid, 19, "You need "..table.getn(players_pos).." player to use this spawn.")
end
elseif item.itemid == 1946 then
local player_room = 0
for x = room.from.x, room.to.x do
for y = room.from.y, room.to.y do
for z = room.from.z, room.to.z 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 someone in the spawn.")
elseif player_room == 0 then
for x = room.from.x, room.to.x do
for y = room.from.y, room.to.y do
for z = room.from.z, room.to.z 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, 1945)
end
end
return TRUE
end
function reqCheck(c, table_, minLevel)
local playerLevel = getPlayerLevel(c)
-- this is just a check to make sure we meet the minimum level requirements
if playerLevel < minLevel then
return playerLevel, nil
end
local reqLevel = 0
local name = nil
if type(table_) == "table" then
for k, v in pairs(table_) do
if v.level > playerLevel then
break
end
reqLevel = v.level
name = v.name
end
end
return reqLevel, name
end
Hello When I try to use the lever it spawns the monsters but when i use it again it has a long line of errors it keeps going down with errors i cant even copy n paste the errors but i will try
the action script it to spawn 8 monsters its like anni
Code:local room = { -- room with demons from = {x = 2501, y = 4495, z = 5}, to = {x = 2503, y = 4997, z = 5}, } local SMBOPL = { -- Summon Monster Based Off Player Level {name = "exp", level = 1}, {name = "exp", level = 8}, {name = "exp", level = 45}, } local monster_pos = { {x = 2501, y = 4495, z = 5}, {x = 2502, y = 4495, z = 5}, {x = 2503, y = 4495, z = 5}, {x = 2503, y = 4496, z = 5}, {x = 2503, y = 4497, z = 5}, {x = 2502, y = 4497, z = 5}, {x = 2501, y = 4497, z = 5}, {x = 2501, y = 4496, z = 5} } local players_pos = { {x = 2502, y =4496, z = 5, stackpos = 253} } local new_player_pos = { {x = 2502, y =4496, z = 5} } local playersOnly = "no" local minLevel = SMBOPL[1].level -- do not edit local levelReq = 0 -- do not edit local monsterName = '' -- do not edit function onUse(cid, item, fromPosition, itemEx, toPosition) local all_ready, monsters, player, level = 0, 0, {}, 0 if item.itemid == 1945 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 == #players_pos then for i = 1, #players_pos do player[i] = getThingfromPos(players_pos[i]) if isPlayer(player[i].uid) == TRUE then levelReq, monsterName = reqCheck(player[i].uid, SMBOPL, minLevel) if levelReq > minLevel then level = level + 1 end else level = level + 1 end end if level == #players_pos and monsterName ~= nil then if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then for m = 1, #monster_pos do doSummonCreature(monsterName, {x = monster_pos[m].x, y = monster_pos[m].y, z = monster_pos[m].z}) end for i = 1, #players_pos do doSendMagicEffect(players_pos[i], CONST_ME_POFF) doTeleportThing(player[i].uid, new_player_pos[i], FALSE) doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA) doTransformItem(item.uid, 1946) end else doPlayerSendTextMessage(cid, 19, "Only players can use this spawn.") end else doPlayerSendTextMessage(cid, 19, "All Players have to be minimum level "..minLevel.." to do this quest.") end else doPlayerSendTextMessage(cid, 19, "You need "..table.getn(players_pos).." player to use this spawn.") end elseif item.itemid == 1946 then local player_room = 0 for x = room.from.x, room.to.x do for y = room.from.y, room.to.y do for z = room.from.z, room.to.z 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 someone in the spawn.") elseif player_room == 0 then for x = room.from.x, room.to.x do for y = room.from.y, room.to.y do for z = room.from.z, room.to.z 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, 1945) end end return TRUE end function reqCheck(c, table_, minLevel) local playerLevel = getPlayerLevel(c) -- this is just a check to make sure we meet the minimum level requirements if playerLevel < minLevel then return playerLevel, nil end local reqLevel = 0 local name = nil if type(table_) == "table" then for k, v in pairs(table_) do if v.level > playerLevel then break end reqLevel = v.level name = v.name end end return reqLevel, name end
Code:
[Error - Action Interface]
data/actions/scripts/youbro/Leverspawn5.lua:onUse
Description:
(luaGetThingsFromPos) Tile Not found
Last edited by a moderator: