Advertisement
poxipox

Untitled

Oct 24th, 2023
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local breakChance = 60
  2. local rustyItems = {
  3.     -- [fromItemId] = toItemId,
  4.     [epicItemId] = diamondItemId,
  5.  
  6. }
  7. function onUse(cid, item, fromPosition, itemEx, toPosition)
  8.     local newId = rustyItems[itemEx.itemid]
  9.     if newId then
  10.         if math.random(100) <= breakChance then
  11.             doRemoveItem(itemEx.uid)
  12.             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You broke it.")
  13.         else
  14.             doTransformItem(itemEx.uid, newId)
  15.             doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
  16.         end
  17.         doRemoveItem(item.uid,1)
  18.         return TRUE
  19.     end
  20.     return FALSE
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement