Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. local corpos = {
  2. [17378] = {11931, pokeshiny = "Shiny Cubone"},
  3. [17379] = {11940, pokeshiny = "Shiny Pidgey"},
  4. [17380] = {11953, pokeshiny = "Shiny Rattata"},
  5. }
  6.  
  7. function onUse(cid, item, frompos, item2, topos)
  8.  
  9. local corpse = getTopCorpse(topos).uid
  10. local b = corpos[item.itemid]
  11.         if not b then return true end
  12.        
  13. if(getDistanceBetween(getCreaturePosition(cid), topos) > 3) then
  14.         doPlayerSendTextMessage(cid, 27, "Você está muito longe para fazer isso.")
  15.         return true
  16.     end
  17.    
  18.     local owner = getItemAttribute(item2.uid, "corpseowner")
  19.    
  20. local playerParty, ownerParty = getPlayerParty(cid), getPlayerParty(owner)
  21.     local partyConditions = false
  22.    
  23.     if playerParty and isPlayer(owner) and ownerParty then
  24.         if playerParty == ownerParty then
  25.             partyConditions = true
  26.         end
  27.     end
  28.    
  29.     if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner and not partyConditions then
  30.         doPlayerSendTextMessage(cid, 27, "Desculpe, você não pode usar o card em um pokemon derrotado por outra pessoa.")
  31.         return true
  32.     end
  33.  
  34.  
  35. if(b[1] ~= corpse) then
  36.         doPlayerSendCancel(cid, "Pokemon não compativel com este card.")
  37.         return true
  38.     end
  39.    
  40.    
  41.     doRemoveItem(corpse, 1)
  42.     doRemoveItem(item.uid, 1)
  43.     doSendMagicEffect(topos, 18)
  44.     doCreateMonster(b.pokeshiny,topos)
  45.     doPlayerSendTextMessage(cid, 27, "Incrivel! Você encontrou um ".. b.pokeshiny .."!")
  46.  
  47.  
  48.  
  49. return true
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement