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

Sweddy

Well-Known Member
Joined
Feb 14, 2009
Messages
2,907
Reaction score
93
Location
Sweden
Hello if i dig anywhere that is sand with an normal shovel it become a Hole :S, Help please :)?

TFS 0.3.6
 
post shovel script -.-.-.-.-.-
??????????????
local holes = {468, 481, 483}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(holes, itemEx.itemid) == TRUE then
doTransformItem(itemEx.uid, itemEx.itemid + 1)
doDecayItem(itemEx.uid)
elseif itemEx.itemid == 231 then
local rand = math.random(1, 100)
if rand == 1 then
doCreateItem(2159, 1, toPosition)
elseif rand > 95 then
doSummonCreature("Scarab", toPosition)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
return FALSE
end
return TRUE
end
 
Or you could try this
Code:
local holes = {468, 481, 483, 7932, 8579}
local sand = {231, 9059}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray(holes, itemEx.itemid) == TRUE) then
		local newId = itemEx.itemid + 1
		if(itemEx.itemid == 8579) then
			newId = 8585
		end

		doTransformItem(itemEx.uid, newId)
		doDecayItem(itemEx.uid)
	elseif(isInArray(sand, itemEx.itemid) == TRUE) then
		local rand = math.random(1, 100)
		if(rand >= 1 and rand <= 5) then
			doCreateItem(2159, 1, toPosition)
		elseif(rand > 85) then
			doSummonCreature("Scarab", toPosition)
		end

		doSendMagicEffect(toPosition, CONST_ME_POFF)
	end

	return TRUE
end
^^ A bit more advanced
 
My script:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray(HOLES, itemEx.itemid)) then
		if(itemEx.itemid ~= 8579) then
			itemEx.itemid = itemEx.itemid + 1
		else
			itemEx.itemid = 8585
		end

		doTransformItem(itemEx.uid, itemEx.itemid)
		doDecayItem(itemEx.uid)
		return true
	elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])

		doDecayItem(itemEx.uid)
		return true
	elseif(itemEx.itemid == SAND and not isRookie(cid)) then
		local rand = math.random(1, 100)
		if(rand >= 1 and rand <= 5) then
			doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
		elseif(rand > 85) then
			doCreateMonster("Scarab", toPosition, false)
		end

		doSendMagicEffect(toPosition, CONST_ME_POFF)
		return true
	end

	return false
end
 
Back
Top