• 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!

Anhhilator script

Sheriff

New Member
Joined
Mar 13, 2009
Messages
68
Reaction score
0
Location
Spain
What is wrong in this script?
I get error in console im using tfs 0.3.6

Code:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015
	entry =
	{
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
	},
	destination =
	{
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end
 
Lua:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015,
	entry = {
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
        },
	destination = {
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end

If this didnt work try this:
Lua:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015,
	entry = {
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
        },
	destination = {
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end

OR this one:
Lua:
local config = {
	daily = "no",
	level = 100,
	storage = 30015
}

local playerPosition =
{
	{x = 247, y = 659, z = 13},
	{x = 247, y = 660, z = 13},
	{x = 247, y = 661, z = 13},
	{x = 247, y = 662, z = 13}
}

local newPosition =
{
	{x = 189, y = 650, z = 13},
 	{x = 189, y = 651, z = 13},
	{x = 189, y = 652, z = 13},
	{x = 189, y = 653, z = 13}
}

-- Do not modify the declaration lines below.
local players = {}
local failed = true
config.daily = getBooleanFromString(config.daily)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendCancel(cid, "Sorry, not possible.")
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	for i, pos in ipairs(playerPosition) do
		pos.stackpos = STACKPOS_TOP_CREATURE
		players[i] = getThingFromPos(playerPosition[i]).uid
		if(players[i] > 0 and
			isPlayer(players[i]) and
			getPlayerStorageValue(players[i].uid, config.storage) == -1 and
			getPlayerLevel(players[i].uid) >= config.level)
		then
			failed = false
		end

		if(failed) then
			doPlayerSendCancel(cid, "Sorry, not possible.")
			return true
		end

		failed = true
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
		doTeleportThing(pid, newPosition[i], false)
		doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end
 
Last edited:
Back
Top