• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Change gold tfs 10.96

Acrenactive

★Designer★
Joined
Mar 21, 2013
Messages
224
Reaction score
56
Location
Los Angels L.A
Can someone script 1 gold ingot is 100 crystal coins on client 10.96?



I want it be like 100 gold coin = 1 platinum coin : 100 platinum coin = 1 crystal coin : 100 crystal coin = 1 gold ingot.

TFS 1.0
 
Last edited:
Explain in more detail, post server version not client version.
[TFS 1.2]
What do you want the script to do, on use 100 cc -> 1 gold ingot? Be detailed.
 
Now quickly test and see if it works:

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_PLATINUM_COIN, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_CRYSTAL_COIN, 1)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(9971, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_GOLD_COIN, ITEMCOUNT_MAX)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
elseif item.itemid == 9971 then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
else
return false
end
return true
end
 
Last edited:
Code:
local transforms = {
    [ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {to = ITEM_CRYSTAL_COIN, from = ITEM_GOLD_COIN},
    [ITEM_CRYSTAL_COIN] = {to = 9971, from = ITEM_CRYSTAL_COIN},
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local tmp = transforms[item:getId()]
    if tmp then
        if item:getCóunt() == ITEMCOUNT_MAX then
            item:transform(tmp.to, 1)
        elseif tmp.from then
            item:remove(1)
            player:addItem(tmp.from, 100)
        else
            return false
        end
    end
    return true
end
 
Last edited:
Now quickly test and see if it works:

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_PLATINUM_COIN, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_CRYSTAL_COIN, 1)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(9971, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_GOLD_COIN, ITEMCOUNT_MAX)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
elseif item.itemid == 9971 then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
else
return false
end
return true
end
wtf is this
 
Now quickly test and see if it works:

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_PLATINUM_COIN, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(ITEM_CRYSTAL_COIN, 1)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(9971, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_GOLD_COIN, ITEMCOUNT_MAX)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
elseif item.itemid == 9971 then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
else
return false
end
return true
end
Code:
local items = {
   [ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
   [ITEM_PLATINUM_COIN] = {from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN},
   [ITEM_CRYSTAL_COIN] = {from = ITEM_PLATINUM_COIN}
}
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
   local coin = items[item.itemid]
   if coin then
     if(item.type == 100 and coin.to ~= nil)then
       Item(item.uid):remove()
       Player(cid):addItem(coin.to, 1)
     elseif(coin.from ~= nil)then
       Item(item.uid):remove(1)
       Player(cid):addItem(coin.from, 100)
     end
   end
   return true
end

Better use tables
 
Last edited:
Code:
local items = {
   [ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
   [ITEM_PLATINUM_COIN] = {from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN},
   [ITEM_CRYSTAL_COIN] = {from = ITEM_PLATINUM_COIN}
}
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
   local coin = items[item.itemid]
   if coin then
     if(item.type == 100 and coin.to ~= nil)then
       Item(item.uid):remove()
       Player(cid):addItem(coin.to, 1)
     elseif(item.type == 1 and coin.from ~= nil)then
       Item(item.uid):remove()
       Player(cid):addItem(coin.from, 100)
     end
   end
   return true
end

Better use tables
ops, missed it was 1.0 :(
 
Code:
local transforms = {
    [ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {to = ITEM_CRYSTAL_COIN, from = ITEM_GOLD_COIN},
    [ITEM_CRYSTAL_COIN] = {to = 9971, from = ITEM_CRYSTAL_COIN},
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local tmp = transforms[item.itemid]
    if tmp then
        if item.type == ITEMCOUNT_MAX then
            doTransformItem(item.uid, transforms[item.itemid)], 1)
        elseif tmp.from then
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, tmp.from, 100)
            return false
        end
    end
    return true
end
should work for 1.0 i think
i dont think 1.0 uses userdata, so item: functions wont work, but if they do, my first post should work
 
Code:
local transforms = {
    [ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {to = ITEM_CRYSTAL_COIN, from = ITEM_GOLD_COIN},
    [ITEM_CRYSTAL_COIN] = {to = 9971, from = ITEM_CRYSTAL_COIN},
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local tmp = transforms[item.itemid]
    if tmp then
        if item.type == ITEMCOUNT_MAX then
            doTransformItem(item.uid, transforms[item.itemid)], 1)
        elseif tmp.from then
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, tmp.from, 100)
            return false
        end
    end
    return true
end
should work for 1.0 i think
i dont think 1.0 uses userdata, so item: functions wont work, but if they do, my first post should work

Thanks for you guys answer and try to help me, but i need say this script you guys write here didnt work.
But I appreciate if you guys keep going help me.


@Ciroc @Zothion @tetra20
 
Code:
local transforms = {
[ITEM_GOLD_COIN] = {to = ITEM_PLATINUM_COIN},
[ITEM_PLATINUM_COIN] = {to = ITEM_CRYSTAL_COIN, from = ITEM_GOLD_COIN},
[ITEM_CRYSTAL_COIN] = {to = 9971, from = ITEM_CRYSTAL_COIN},
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
item = Item(item.uid)
player = Player(cid)
local tmp = transforms[item:getId()]
if tmp then
if item:getCóunt() == ITEMCOUNT_MAX then
item:transform(tmp.to, 1)
elseif tmp.from then
item:remove(1)
player:addItem(tmp.from, 100)
else
return false
end
end
return true
end
maybe this should work then
or you could just add another elseif statement as in the link by shyzoul
 
I got this in my error when i right click at crystal coin.
But there is no error when i right click on the gold ingot.
@Zothion

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/changegold.lua:onUse
data/actions/scripts/other/changegold.lua:12: attempt to call method 'getC├│unt' (a nil value)
stack traceback:
        [C]: in function 'getC├│unt'
        data/actions/scripts/other/changegold.lua:12: in function <data/actions/scripts/other/changegold.lua:7>
 
Back
Top