Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local breakChance = 60
- local rustyItemsTemp = {
- -- [fromItemId] = toItemId,
- [diamondItemId] = {armorId_1, armorId_2},
- }
- local rustyItems = {}
- for diamoondId, data in pairs(rustyItemsTemp) do
- for i = 1, #data do
- rustyItems[data[i]] = diamoondId
- end
- end
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- local newId = rustyItems[itemEx.itemid]
- if newId then
- if math.random(100) <= breakChance then
- doRemoveItem(itemEx.uid)
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You broke it.")
- else
- doTransformItem(itemEx.uid, newId)
- doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
- end
- doRemoveItem(item.uid,1)
- return TRUE
- end
- return FALSE
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement