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

Solved Selling and Buying things with Gold Nuggets!

  • Thread starter Thread starter LordVissie
  • Start date Start date
L

LordVissie

Guest
Hey guys, I currently have a script in my server that changes 100cc to 1 Golden Nugget (2157). But I can't buy items with it then the NPCs say: You don't have enough money! , I heared I needed to add a attribute in Items.xml:

Code:
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
        <attribute key="weight" value="10" />
        <attribute key="worth" value="1000000" />
    </item>

But I can still not buy anything with it. This is the script I use:

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 = 2157, effect = TEXTCOLOR_TEAL
},
[2157] = {
from = ITEM_CRYSTAL_COIN, to = 9971, 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

Does anyone know what I did wrong or what I need to do?

Edit: Using cryingdamson 0.3.6 (8.60) V8.2
 
Last edited by a moderator:

Similar threads

Back
Top