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

Coins

own3d

Sup?
Joined
Feb 10, 2009
Messages
83
Reaction score
0
Location
Poland
I have problem with coins, because i want include one more coin to my server (tfs 0.3.5pl1),

i tried to do that script by my own, but it dont work
(its changegold.lua)

as i edited it (wanted to add smile coin- look like vampirelord token)

thats how it looks:
Code:
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_SMILE_COIN, effect = TEXTCOLOR_TEAL
	},
	[ITEM_SMILE_COIN] = {
		from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL
	}
}

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

Id of Smile Coin(Vampirelord token) is 9020, i added in actions.xml too

please help i rep++
 
Ok, ITEM_SMILE_COIN will not work because it is a global variable, and you probably havent declared it in lib/constant.lua.

Solution in lib/constant.lua put somewhere (good idea to put it near ITEM_GOLD_COIN etc.) ITEM_SMILE_COIN = 9020. Another way to do it is instead of using [ITEM_SMILE_COIN] = { statement statement statement } use [9020] = { statement statement statement }.
 
Ok, ITEM_SMILE_COIN will not work because it is a global variable, and you probably havent declared it in lib/constant.lua.

Solution in lib/constant.lua put somewhere (good idea to put it near ITEM_GOLD_COIN etc.) ITEM_SMILE_COIN = 9020.

yeah it work, but there became another problem...
npc dont see that coin as 100cc... need to exchange it to 100cc <_<

any idea?
 
add this on item.xml

Code:
	<item [COLOR="Red"]id="9020"[/COLOR] article="a" name="[COLOR="Red"]Smile Coin[/COLOR]" plural="[COLOR="Red"]Smile Coins[/COLOR]">
	    <attribute key="description" value="It worths 100 Crystal Coins."/>
		<attribute key="weight" value="10"/>
		[COLOR="Red"]<attribute key="worth" value="1000000"/>[/COLOR]
	</item>
 
Back
Top