Ovnyx
Member
- Joined
- Jul 25, 2017
- Messages
- 163
- Solutions
- 2
- Reaction score
- 7
Hi guys im trying to creat a script to exchange 100 crystal coins for 1 bar of gold, im using tfs 1.0, and i im working on data/actions/scripts/others/changelog.lua
and i got this:
what i want to know is where are this coins variables declared, because i searched them in the global.lua, but they are not there, i understand how this function works but i need to add the bar of gold variable to asociate it with his id.
hope someone can help me, and thanks in advice.
PD: i searched in forum and scripts for this doesnt work, i guess becuase they are for another TFS Version
Ok i make it work by declaring the variables in the script, now it is working thanks!!
and i got this:
Lua:
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_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 then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
else
return false
end
return true
end
what i want to know is where are this coins variables declared, because i searched them in the global.lua, but they are not there, i understand how this function works but i need to add the bar of gold variable to asociate it with his id.
hope someone can help me, and thanks in advice.
PD: i searched in forum and scripts for this doesnt work, i guess becuase they are for another TFS Version
Ok i make it work by declaring the variables in the script, now it is working thanks!!
Last edited by a moderator: