• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Disable Errors on Console?

Lanibox

Brutal1ty.com
Joined
Sep 21, 2010
Messages
179
Reaction score
4
Hey, I made one event for my server, it teleports ppl when I pull lever, I want it to work with no minimum players required, so It sends errors to console "Thing not found", when I use lever. Is there way to disable those errors on that script, or is there some way to check all fields where is player standing and teleports only those?
 
Here is my script


Code:
        local players_pos = {
        {x=31827, y=32246, z=6,stackpos = 253},
        {x=31826, y=32247, z=6,stackpos = 253},
        {x=31826, y=32248, z=6,stackpos = 253},
        {x=31826, y=32249, z=6,stackpos = 253},
	{x=31826, y=32250, z=6,stackpos = 253},
	{x=31828, y=32247, z=6,stackpos = 253},
	{x=31828, y=32248, z=6,stackpos = 253},
	{x=31828, y=32249, z=6,stackpos = 253},
	{x=31828, y=32250, z=6,stackpos = 253}
        }

        local new_player_pos = {
	{x=31824, y=32240, z=6},
	{x=31824, y=32239, z=6},
	{x=31825, y=32238, z=6},
	{x=31828, y=32238, z=6},
	{x=31829, y=32239, z=6},
	{x=31829, y=32242, z=6},
	{x=31828, y=32243, z=6},
	{x=31825, y=32243, z=6},
	{x=31824, y=32242, z=6}
        }


function onUse(cid, item, fromPosition, itemEx, toPosition)
	local group = getPlayerGroupId(cid)
	if group >= 3 then
		for i = 1, #players_pos do
			local thing = getThingfromPos(players_pos[i],false)
			doSendMagicEffect(players_pos[i], CONST_ME_POFF)
			doTeleportThing(thing.uid, new_player_pos[i], FALSE)
			doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
		end
	else
	doPlayerSendTextMessage(cid,19,"Only Official Staff can start this event! Get into your position, thank you!")
	end
	return TRUE
end


Try using:

Lua:
getThingFromPos(pos, false)
Regards,
TibiaWR

Thanks but didnt make any difference.
 

Code:
local CreaturePositions = { 
    { x = 31827, y = 32246, z = 6, stackpos = 253 }, 
    { x = 31826, y = 32247, z = 6, stackpos = 253 }, 
    { x = 31826, y = 32248, z = 6, stackpos = 253 }, 
    { x = 31826, y = 32249, z = 6, stackpos = 253 }, 
    { x = 31826, y = 32250, z = 6, stackpos = 253 }, 
    { x = 31828, y = 32247, z = 6, stackpos = 253 }, 
    { x = 31828, y = 32248, z = 6, stackpos = 253 }, 
    { x = 31828, y = 32249, z = 6, stackpos = 253 }, 
    { x = 31828, y = 32250, z = 6, stackpos = 253 }, 
    } ; 

local CreatureDestinations = { 
    { x = 31824, y = 32240, z = 6 }, 
    { x = 31824, y = 32239, z = 6 }, 
    { x = 31825, y = 32238, z = 6 }, 
    { x = 31828, y = 32238, z = 6 }, 
    { x = 31829, y = 32239, z = 6 }, 
    { x = 31829, y = 32242, z = 6 }, 
    { x = 31828, y = 32243, z = 6 }, 
    { x = 31825, y = 32243, z = 6 }, 
    { x = 31824, y = 32242, z = 6 }, 
    } ; 

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerGroupId(cid) < 3 then
        doPlayerSendTextMessage(cid, 19, "Only staff members can initiate events! Get into position, thank you!") ; 
    else
        for i = 1, #CreaturePositions do
            local creature = getThingFromPos(CreaturePositions[i]) ; if isPlayer(creature) then
                doTeleportThing(creature.uid, CreatureDestinations[i], false) ; 
                doSendMagicEffect(CreaturePositions[i], CONST_ME_POFF) ; 
                doSendMagicEffect(CreatureDestinations[i], CONST_ME_ENERGYAREA) ; 
            end ; 
        end ; 
    end ; return true ; 
end ;
 
Back
Top