Hello Dear Community. I am learning how to make scripts for my OTS so I made this script for my custom made boots. Tested with TFS 0.3.7. Hope you will like it. Enjoy!
/data/talkactions/scripts/xxxxx.lua
/data/talkactions/talkactions.xml
/data/talkactions/scripts/xxxxx.lua
Code:
local boots = xxxx -- [COLOR="#008000"]ID of boots that are brand new[/COLOR]
local eboots = xxxx -- [COLOR="#008000"]ID of boots when they are equiped on BOOTS_SLOT[/COLOR]
local wboots = xxxx -- [COLOR="#008000"]ID of fully worn boots[/COLOR]
local money = xxxxx -- [COLOR="#008000"]Amount of money needed for repair[/COLOR]
function onSay(cid, words, param, channel)
if (getPlayerItemCount(cid, wboots) == 0) and (getPlayerItemCount(cid, eboots) == 0) and (getPlayerItemCount(cid, boots) == 0) then
doCreatureSay(cid, "You need to buy boots first!", TALKTYPE_ORANGE_1)
end
if(getPlayerItemCount(cid, boots) >= 1) then
doCreatureSay(cid, "You need to worn your boots fully!", TALKTYPE_ORANGE_1)
end
if (getPlayerItemCount(cid, wboots) >= 1) then
if (getPlayerMoney(cid) >= money) then
doPlayerRemoveItem(cid, wboots, 1)
doPlayerRemoveMoney(cid, money)
doPlayerAddItem(cid, boots, 1)
doSendAnimatedText(getCreaturePosition(cid), "Done!", TEXTCOLOR_LIGHTBLUE)
else
doCreatureSay(cid, "You need more gold to repair your boots!", TALKTYPE_ORANGE_1)
end
end
if (getPlayerItemCount(cid, eboots) >= 1) then
doCreatureSay(cid, "You need to unequip your boots first!", TALKTYPE_ORANGE_1)
end
return true
end
/data/talkactions/talkactions.xml
Code:
<talkaction words="xxxxx" script="xxxxx.lua" />