legolas23
New Member
- Joined
- Jan 8, 2009
- Messages
- 537
- Reaction score
- 3
Hello
I've been trying to modificate moneychange script for tfs 0.3.5pl1 to:
-Allow to change money only when it is in container.
-Allow to change money only if arrow,left or right hand slot is free.
Can you help me with it?
Here's my work:
Rep++ for help
I've been trying to modificate moneychange script for tfs 0.3.5pl1 to:
-Allow to change money only when it is in container.
-Allow to change money only if arrow,left or right hand slot is free.
Can you help me with it?
Here's my work:
Code:
local arrow = getPlayerSlotItem(cid, CONST_SLOT_AMMO)
local hand = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
local hand2 = getPlayerSlotItem(cid, CONST_SLOT_RIGHT )
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, effect = TEXTCOLOR_TEAL
}
}
local backpack_slot = getPlayerSlotItem(cid, 3)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') + 3010))
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local coin = coins[item.itemid]
if(not coin) then
return FALSE
end
if (arrow.itemid == 0 or hand.itemid == 0 or hand2.itemid == 0) then
if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
if (getPlayerFreeCap(cid) > 10) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
else
doPlayerSendCancel(cid, "Your cap is too low.")
end
elseif(coin.from ~= nil) then
if (getPlayerFreeCap(cid) > 10) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
else
doPlayerSendCancel(cid, "Your cap is too low.")
end
end
else
doPlayerSendCancel(cid, "You don t have free hands or arrow slot!")
end
return TRUE
end
Rep++ for help