Advertisement
Kevick

Fishing System TFS 1.3 (BETA)

Jul 8th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. function onUse(player, item, fromPos, itemEx, toPos)
  2.  
  3.   if getTileInfo(player:getPosition()).protection or #player:getSummons() >= 1 and getTileInfo(player:getPosition(player:getSummons()[1])).protection then
  4.     return true
  5.   end
  6.  
  7. local pokemons ={
  8.   [1] = {name = "Magikarp", qnt = 4},
  9.   [2] = {name = "Squirtle", qnt = 2},
  10.   [3] = {name = "Staryu", qnt = 3},
  11. }
  12.  
  13.   local config = {
  14.     waters = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621,4664, 4622, 4623, 4624, 4625, 7236, 10499, 15401, 15402},
  15.   }
  16.  
  17.   local tabelas = {
  18.  
  19.     position = player:getPosition(),
  20.     level = 15,
  21.     fail = math.random(1, 100),
  22.     r = math.random(1, #pokemons),
  23.     playerpos = player:getPosition(),
  24.     skill = player:getSkillLevel(SKILL_FISHING),
  25.   }
  26.  
  27.  
  28.   if not (isInArray(config.waters, itemEx.itemid)) then
  29.     return player:sendCancelMessage("NOT IS POSSIBRU")
  30.   end
  31.  
  32.   if(isInArray(config.waters, itemEx.itemid)) then
  33.     if tabelas.fail >= 20 then
  34.     toPos:sendEffect(2)
  35.     return player:sendCancelMessage("FALHOU")
  36. end
  37.  
  38.     for i = 1,pokemons[tabelas.r].qnt do
  39.     local pokemon = Game.createPokemon(pokemons[tabelas.r].name, tabelas.level, tabelas.position)
  40.     if pokemon then
  41.       toPos:sendEffect(2)
  42.       toPos:sendEffect(CONST_ME_WATERSPLASH)
  43.       pokemon:getPosition():sendEffect(943)
  44.       player:addSkillTries(SKILL_FISHING, 1)
  45.     else
  46.       player:sendCancelMessage("There is not enough room.")
  47.       tabelas.position:sendEffect(CONST_ME_POFF)
  48.     end
  49.     end
  50. end
  51.  
  52.   return true
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement