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

One item.

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
I requests you to make script for me.

- Player going to use with itemid: 8384 (ex. pick) on item "9349"
- If player dont have 2x items 9349 (in one stack ex. small stones) the msg appear:
"You must have pair of those to do this"
- If player have 2x items 9349 the itemid: 8349 is appear and 2x items are removing
You get also 10% chance to fail this (when fail the 2x 9349 items will removing and msg:
"You fail this..")

Its nice if will be make in table because i need to add 5 items like /up\ .


Sorry for my english i write it too fast xd
 
LUA:
local config = {
	itemToUseIds = {8384},
	itemToUseOnIds = {9349},
	itemReagent = 9349,
	itemToGive = 8349
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(not isInArray(config.itemToUseIds, item.itemid)) then
		return false
	elseif(not isInArray(config.itemToUseOnIds, itemEx.itemid)) then
		return false
	elseif(getPlayerItemCount(cid, config.itemReagent) < 2) then
		return doPlayerSendCancel(cid, 'You must have a pair of ' .. getItemPluralNameById(config.itemReagent) .. ' to do this.')
	elseif(math.random(1,10) == 10) then
		return	doPlayerSendCancel(cid, 'You failed this..'),
				doPlayerRemoveItem(cid, config.itemReagent, 2)
	end
	
	return 	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratuulatios, you did it!"),
			doPlayerRemoveItem(cid, config.itemReagent, 2),
			doPlayerAddItem(cid, config.itemToGive)
end
 
Last edited by a moderator:
Its cool but.
I dont want one item to give, i have mining system and while im smelting Cooper ores i got Cooper bars and also i can smelt Gold Ores and i can get Gold Bars...

Anyone can fix it ?
 
Bump.

The random part of failed not working.. I got always 100% chance to smelt it..
And if i putting doSendMagicEffect i got errors to close function ;/
 
Fresh said:
- If player have 2x items 9349 the itemid: 8349 is appear and 2x items are removing
You get also 10% chance to fail this (when fail the 2x 9349 items will removing and msg:
"You fail this..")

What?
 
I remade the script like this:
LUA:
local forge = 11587
local cooper = {
	ores = 11672,
	cooperore = 11672,
	cooperbar = 11682
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Function to check if its Forge
	if(not isInArray(forge, item.itemid)) then
		return false
-- Cooper Ores --
	elseif(not isInArray(cooper.ores, itemEx.itemid)) then
		return false
	elseif(getPlayerItemCount(cid, cooper.cooperore) < 2) then
		return doPlayerSendCancel(cid, 'You must have a pair of cooper ores to do this.') and doSendMagicEffect(toPosition, 2)
	end
	doPlayerRemoveItem(cid, cooper.cooperore, 2)
	doPlayerAddItem(cid, cooper.cooperbar)
	doSendMagicEffect(fromPosition, 15)
	doSendMagicEffect(toPosition, 13)
	doSendAnimatedText(fromPosition, "~Smelted", 192)
	else
	
return true
end
-- Milthirl Ores --

But how i can add another ore smelting ?
 
Last edited:
Back
Top