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

Lua New currency (GOLD NUGGET) script

Darted450

New Member
Joined
Apr 28, 2014
Messages
54
Reaction score
1
tfs 0.3.6

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_VALUABLE_COIN, effect = TEXTCOLOR_RED
    },
    [ITEM_VALUABLE_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

Code:
    <item id="2157" article="a" name="valuable coin" plural="valuable coins">
        <attribute key="weight" value="10" />
        <attribute key="worth" value="1000000" />
    </item>



ERROR WHEN LOADING SERVER :

[19/05/2014 12:11:35] [Error - Action Interface]
[19/05/2014 12:11:35] data/actions/scripts/other/changegold.lua
[19/05/2014 12:11:36] Description:
[19/05/2014 12:11:36] data/actions/scripts/other/changegold.lua:13: table index is nil
[19/05/2014 12:11:36] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
 
Last edited:
constant.lua (I guess you are using 0.4/0.3.6)
Serach for:
Code:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160

And below it add this:
Code:
ITEM_VALUABLE_COIN = itemid
 

Similar threads

Back
Top