Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onUse(cid, item, position, itemEx)
- local chance = 10 -- Porcentagem de chance de conseguir roubar alguém
- local count = 10 -- Porcentagem do dinheiro total da pessoa que será roubado
- if not isPlayer(itemEx.uid) then
- doPlayerSendCancel(cid, "You can only steal from players.")
- return true
- elseif getPlayerLevel(cid) < getPlayerLevel(itemEx.uid) then
- doPlayerSendCancel(cid, "You can only steal items from players with lower level than you.")
- return true
- elseif itemEx.uid == cid then
- doPlayerSendCancel(cid, "You can't steal money from yourself!")
- return true
- elseif getPlayerMoney(itemEx.uid) <= 0 then
- doPlayerSendCancel(cid, "This player hasn't money.")
- return true
- elseif math.random(1, 100) > chance then
- doPlayerSendTextMessage(itemEx.uid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(cid).." tried to steal money from you and failed.")
- doSendMagicEffect(getCreaturePosition(cid), 2)
- doPlayerSendCancel(cid, "You failed in stealing.")
- return true
- end
- doRemoveItem(item.uid, 1)
- doPlayerRemoveMoney(itemEx.uid, math.ceil(getPlayerMoney(itemEx.uid)*(count/100)))
- doPlayerAddMoney(cid, math.ceil(getPlayerMoney(itemEx.uid)*(count/100)))
- doPlayerSendTextMessage(itemEx.uid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..getCreatureName(cid).." stole "..math.ceil(getPlayerMoney(itemEx.uid)*(count/100)).." gold coins from you successfully.")
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You stole "..math.ceil(getPlayerMoney(itemEx.uid)*(count/100)).." gold coins from "..getCreatureName(itemEx.uid).." successfully.")
- doSendMagicEffect(getCreaturePosition(itemEx.uid))
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement