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

Mining Script made by cyko~

grogan

New Member
Joined
Dec 6, 2007
Messages
133
Reaction score
0
IM using this script:

I want it so once you use the pick on the rock every couple minutes the rock respawns again..

local config = {
stones = {1358},
level = 200,
skill = SKILL_FIST,
skillReq = 20,
effect = CONST_ME_BLOCKHIT,
addTries = 100,
debris = 1336,
msgType = MESSAGE_EVENT_ADVANCE
}
local t = {
[{1, 100}] = {msg = "Oh no, you missed and picked a hole in the ground and a orshabaal came out of it!", summon = "Orshabaal"},
[{101, 200}] = {msg = "You found %A %N.", item = 2160, amountmax = 4},
[{201, 300}] = {msg = "You found %A %N.", item = 4874, amountmax = 1},
[{301, 400}] = {msg = "You found %A %N.", item = 8306},
[{401, 500}] = {msg = "You found %A %N.", item = 2492, amountmax = 1},
[{501, 600}] = {msg = "You found %A %N.", item = 2894, amountmax = 1},
[{601, 700}] = {msg = "You found %A %N.", item = 2466, amountmax = 1},
[{701, 800}] = {msg = "You found %A %N.", item = 2520, amountmax = 1},
[{801, 900}] = {msg = "You found %A %N.", item = 5880},
[{901, 1000}] = {msg = "You lost %D hitpoints due to exhaustion of mining.", damage = {1, 100}},
[{1001, 1100}] = {msg = "You found %A %N.", item = 2798, amountmax = 10},
[{1101, 1200}] = {msg = "You found %A %N.", item = 2143, amountmax = 10},
[{1201, 1300}] = {msg = "You found %A %N.", item = 2144, amountmax = 10},
[{1301, 1400}] = {msg = "An angry mining guard came out of the rock piles!", summon = "Mining Guard"},
[{1401, 1500}] = {msg = "A robin hood got unstuck and it looks angry!", summon = "Robin Hood"},
[{1501, 1600}] = {msg = "A demon came from a hole you made on the ground!", summon = "Demon"},
[{1601, 1700}] = {msg = "You suffered %D hitpoints due to an earthquake!", damage = {1, 1100}},
[{1701, 1800}] = {msg = "A weak native has appeared from the pile of rocks!", summon = "Natives"},
[{1801, 1900}] = {msg = "Woah! A evil wizard just appeared from the pile of rocks!", summon = "Evil Wizard"},
[{1901, 2000}] = {msg = "Your pick has been heavily damaged and it broke...", destroy = true}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(config.stones, itemEx.itemid) and config.level <= getPlayerLevel(cid) and config.skillReq <= getPlayerSkill(cid, config.skill) then
local v, amount, damage = math.random(2000), 1, nil
for i, k in pairs(t) do
if v >= i[1] and v <= i[2] then
if k.destroy then
doRemoveItem(item.uid)
end
if k.summon then
doCreateMonster(k.summon, toPosition)
end
if k.damage then
damage = math.random(k.damage[1], k.damage[2])
doCreatureAddHealth(cid, - damage, CONST_ME_DRAWBLOOD, TEXTCOLOR_RED)
end
if k.item then
if k.amountmax then
amount = math.random(k.amountmax)
end
doPlayerAddItem(cid, k.item, amount)
end
if k.msg then
local msg = k.msg
if msg:find("%%") then
if msg:find("%%A") and k.item then
msg = msg:gsub("%%A", amount > 1 and amount or getItemDescriptionsById(k.item).article)
end
if msg:find("%%N") and k.item then
msg = msg:gsub("%%N", amount > 1 and getItemDescriptionsById(k.item).plural or getItemNameById(k.item))
end
if msg:find("%%D") and damage then
msg = msg:gsub("%%D", damage)
end
end
doPlayerSendTextMessage(cid, config.msgType, msg)
end
doTransformItem(itemEx.uid, config.debris)
doSendMagicEffect(toPosition, k.destroy and CONST_ME_HITAREA or config.effect)
return doPlayerAddSkillTry(cid, config.skill, config.addTries)
end
end
end
return doPlayerSendCancel(cid, "You either aren't experienced or skilled enough or this isn't a breakable rock.")
end









REP++ if you no thanks.
 
Lua:
local config = {
	resetTime = 180, -- in seconds
	stones = {1358},
	level = 200,
	skill = SKILL_FIST,
	skillReq = 20,
	effect = CONST_ME_BLOCKHIT,
	addTries = 100,
	debris = 1336,
	msgType = MESSAGE_EVENT_ADVANCE
}

local t = {
	[{1, 100}] = {msg = "Oh no, you missed and picked a hole in the ground and a orshabaal came out of it!", summon = "Orshabaal"},
	[{101, 200}] = {msg = "You found %A %N.", item = 2160, amountmax = 4},
	[{201, 300}] = {msg = "You found %A %N.", item = 4874},
	[{301, 400}] = {msg = "You found %A %N.", item = 8306},
	[{401, 500}] = {msg = "You found %A %N.", item = 2492},
	[{501, 600}] = {msg = "You found %A %N.", item = 2894},
	[{601, 700}] = {msg = "You found %A %N.", item = 2466},
	[{701, 800}] = {msg = "You found %A %N.", item = 2520},
	[{801, 900}] = {msg = "You found %A %N.", item = 5880},
	[{901, 1000}] = {msg = "You lost %D hitpoints due to exhaustion of mining.", damage = {1, 100}},
	[{1001, 1100}] = {msg = "You found %A %N.", item = 27980},
	[{1101, 1200}] = {msg = "You found %A %N.", item = 21430},
	[{1201, 1300}] = {msg = "You found %A %N.", item = 21440},
	[{1301, 1400}] = {msg = "An angry mining guard came out of the rock piles!", summon = "Mining Guard"},
	[{1401, 1500}] = {msg = "A robin hood got unstuck and it looks angry!", summon = "Robin Hood"},
	[{1501, 1600}] = {msg = "A demon came from a hole you made on the ground!", summon = "Demon"},
	[{1601, 1700}] = {msg = "You suffered %D hitpoints due to an earthquake!", damage = {1, 1100}},
	[{1701, 1800}] = {msg = "A weak native has appeared from the pile of rocks!", summon = "Natives"},
	[{1801, 1900}] = {msg = "Woah! A evil wizard just appeared from the pile of rocks!", summon = "Evil Wizard"},
	[{1901, 2000}] = {msg = "Your pick has been heavily damaged and it broke...", destroy = true}
}

local function reset(pos, id)
	local v = getTileItemById(pos, config.debris).uid
	return v > 0 and doTransformItem(v, id)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInArray(config.stones, itemEx.itemid) and config.level <= getPlayerLevel(cid) and config.skillReq <= getPlayerSkill(cid, config.skill) then
		local v, amount, damage = math.random(2000), 1
		for i, k in pairs(t) do
			if v >= i[1] and v <= i[2] then
				if k.destroy then
					doRemoveItem(item.uid)
				end
				if k.summon then
					doCreateMonster(k.summon, toPosition)
				end
				if k.damage then
					damage = math.random(k.damage[1], k.damage[2])
					doCreatureAddHealth(cid, - damage, CONST_ME_DRAWBLOOD, TEXTCOLOR_RED)
				end
				if k.item then
					if k.amountmax then
						amount = math.random(k.amountmax)
					end
					doPlayerAddItem(cid, k.item, amount)
				end
				if k.msg then
					local msg = k.msg
					if k.item then
						msg = msg:gsub("%%A", amount > 1 and amount or getItemDescriptionsById(k.item).article)
					end
					if k.item then
						msg = msg:gsub("%%N", amount > 1 and getItemDescriptionsById(k.item).plural or getItemNameById(k.item))
					end
					if damage then
						msg = msg:gsub("%%D", damage)
					end
					doPlayerSendTextMessage(cid, config.msgType, msg)
				end
				doTransformItem(itemEx.uid, config.debris)
				addEvent(reset, config.resetTime * 1000, toPosition, itemEx.itemid)
				doSendMagicEffect(toPosition, k.destroy and CONST_ME_HITAREA or config.effect)
				return doPlayerAddSkillTry(cid, config.skill, config.addTries)
			end
		end
	end
	return doPlayerSendCancel(cid, "You either aren't experienced or skilled enough or this isn't a breakable rock.")
end
 
Back
Top