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

Bug Magic Wall

Sir Gabriiel

New Member
Joined
Mar 24, 2012
Messages
88
Reaction score
2
I would like to fix this bug in my server ...
When you have too much junk in sqm Magic Wall can not hit it, I wonder how to fix ...

Thanks
 
kidding :p :p
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local limit = getConfigInfo('tileLimit')

function onCastSpell(cid, var)
	local pos = variantToPosition(var)

	if getTileInfo(getThingPos(cid)).protection or getTileInfo(pos).protection then
		return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
	end

	local v = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid
	if v ~= 0 then
		doRemoveItem(v)
	end

	local count = getTileInfo(pos).items
	if count >= limit then
		local removed
		for i = 1, count do
			pos.stackpos  = i
			local v = getThingfromPos(pos)
			if v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isCreature(v.uid) then
				doRemoveItem(v.uid)
				removed = true
				break
			end
		end
		if not removed then
			return not doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
		end
	end

	v = doCreateItemEx(1497)
	if doTileAddItemEx(pos, v) == 1 and getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid ~= 0 then
		doDecayItem(v)
		return doCombat(cid, combat, var)
	else
		return not doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
	end
end
 
Back
Top