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

Higher Currency Problem

GMBear

chaos revived Owner
Joined
Jan 28, 2008
Messages
575
Reaction score
2
Location
New york
Hey, I am trying to Make a higher currency like this

100 gold=1 platium coin
100 Platium coins = 1 crystal
100 crystal coins = 1 Gold Ingot coin
100 Gold ingot coin = 100 gold ingot coin

BUT I got the script but what happens is It will change the ingot into 100 cc but, then if I try and have say 100 ingot coins and try to change into 100cc it will, do this

100 ingot coin turned into 100cc and Leave u with only 100cc

I want it to make 1 ingot coin = 100cc

So if I right click a 100 ingot coin it will leave me with

99 ingot coin and 100 crystal coins.

Here is the script.
PHP:
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_LIGHTBLUE) 
         
    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 - 1) 
        doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_GOLD_INGOT, 1) 
        doSendAnimatedText(fromPosition, "BIG MONEY", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_GOLD_INGOT and item.type < ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_GOLD_INGOT and item.type == ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
         
    else 
        return FALSE 
    end 
    return TRUE 
end

Here it is in
Code:
 if it easier

[CODE]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_LIGHTBLUE) 
         
    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 - 1) 
        doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_GOLD_INGOT, 1) 
        doSendAnimatedText(fromPosition, "BIG MONEY", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_GOLD_INGOT and item.type < ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
    elseif item.itemid == ITEM_GOLD_INGOT and item.type == ITEMCOUNT_MAX then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) 
         
         
    else 
        return FALSE 
    end 
    return TRUE 
end

Hmm maybe a quote box will make it easier to read.
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_LIGHTBLUE)

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 - 1)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)

elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_GOLD_INGOT, 1)
doSendAnimatedText(fromPosition, "BIG MONEY", TEXTCOLOR_LIGHTBLUE)

elseif item.itemid == ITEM_GOLD_INGOT and item.type < ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)

elseif item.itemid == ITEM_GOLD_INGOT and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE)


else
return FALSE
end
return TRUE
end


Its a actions script
 
Code:
local ITEM_GOLD_NUGGET = 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, effect = TEXTCOLOR_TEAL
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerFlagValue(cid, PlayerFlag_CannotPickupItem) == TRUE) then
		return FALSE
	end

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

	if(coin.to 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) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return TRUE
end
Don\'t forget to add it into actions.xml
  • For TFS 0.3
    PHP:
    	<action itemid="9971" event="script" value="other/changegold.lua"/>
  • For TFS 0.2
    PHP:
    	<action itemid="9971" script="other/changegold.lua"/>
 
Back
Top