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

Gold -> gold lingot

kilirt

New Member
Joined
May 11, 2009
Messages
223
Reaction score
2
hello i've a probleme with a script this script do: when we clic on money this transform to:


gold -> platinum
Platinum -> crystal
Crystal -> gold nugget
Gold nugget -> crystal
Crystal -> platinum
Platinum -> gold

please can you modify this script to add: Gold nugget -> gold lingot and Gold lingot -> gold nugget

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
	elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL)
	elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_GOLD_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_YELLOW)
	elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, 2157, 1)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)
	elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTGREEN)
	elseif item.itemid == 2157 then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTGREEN)
	else
		return FALSE
	end
	return TRUE
end
 
Lua:
local ITEM_GOLD_NUGGET = 2157
local ITEM_GOLD_INGOT = 9971

local coins = {
	[ITEM_GOLD_COIN] = {
		to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
	},
	[ITEM_PLATINUM_COIN] = {
		from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
	},
	[ITEM_CRYSTAL_COIN] = {
		from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
	},
	[ITEM_GOLD_NUGGET] = {
		from = ITEM_CRYSTAL_COIN, to = ITEM_GOLD_INGOT, effect = TEXTCOLOR_LIGHTGREEN
	},
	[ITEM_GOLD_INGOT] = {
		from = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_YELLOW
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
		return false
	end

	local coin = coins[item.itemid]
	if(not coin) then
		return false
	end

	if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, coin.to, 1)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
	elseif(coin.from ~= nil) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return true
end
 
And you must add it in actions.xml.
XML:
	<action itemid="9971" event="script" value="other/changegold.lua"/>
 
Thx work rep++ but i've other question Do you know how can i make an item when i use it i get a random outfit monster for 5 min or logout ???
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v, tmp = math.random(351), getCreatureOutfit(cid)
	while isInArray({tmp.lookType, 75, 135, 266, 302}, v) or v <= 1 or (v > 160 and v < 192) or v > 351 do
		v = math.random(351)
	end

	tmp.lookType = v
	doSetCreatureOutfit(cid, tmp, 5 * 60 * 1000)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	doCreatureSay(cid, 'Your outfit has been changed.', TALKTYPE_ORANGE_1, false, cid)
	return true
end
 

Similar threads

Back
Top