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

Destroy field rune.

olaajnus

New Member
Joined
Jan 2, 2009
Messages
30
Reaction score
0
I can't use Destroy Field Runes, just poffing when i trying to take off fire from the floor.

local function doRemoveField(cid, pos)
pos.stackpos = 254
local field = getThingfromPos(pos)
local playerPos = getPlayerPosition(cid)

if(field.uid > 0 and isInArray(FIELDS, field.itemid) == TRUE) then
doRemoveItem(field.uid)
doSendMagicEffect(pos, CONST_ME_POFF)
return LUA_NO_ERROR
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(playerPos, CONST_ME_POFF)
return LUA_ERROR
end

function onCastSpell(cid, var)
local pos = variantToPosition(var)
if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0) then
return doRemoveField(cid, pos)
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return LUA_ERROR
end


Someone knows what's wrong?
 
Then use the one I made:
Code:
local unremovable = {3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066}
local function isRemovable(v)
	return type(v) == "table" and v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isInArray(unremovable, v.itemid) and not isCreature(v.uid) or false
end

local function findFirstRemovable(pos)
	while getThingfromPos(pos).uid > 0 do
		if isRemovable(getThingfromPos(pos)) then
			return pos.stackpos
		end
		pos.stackpos = pos.stackpos + 1
	end
end
local function doRemoveObject(cid, pos)
	pos.stackpos = 1
	local i, first = 0, getThingfromPos(pos)
	if not isRemovable(first) then
		local k = findFirstRemovable(pos)
		if type(k) == "number" then
			pos.stackpos = k
		end
	end
	while isRemovable(getThingfromPos(pos)) do
		doRemoveItem(getThingfromPos(pos).uid)
		i = i + 1
		if not isRemovable(getThingfromPos(pos)) then
			local k = findFirstRemovable(pos)
			if type(k) == "number" then
				pos.stackpos = k
			end
		end
	end

	if i > 0 then
		doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
		return LUA_NO_ERROR
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0 and not getTileInfo(pos).protection) then
		return doRemoveObject(cid, pos)
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end
It works exactly[?] as in Cipbia.
 
Back
Top