Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.09 KB | None | 0 0
  1. function onJoinChannel(cid, channelId, users, isTv)
  2.  
  3.  
  4. if channelId == 10 then
  5. doShowPokemonStatistics(cid)
  6. return false
  7. end
  8.  
  9. if channelId == 11 then
  10. if reloadHighscoresWhenUsingPc then
  11. doReloadHighscores()
  12. end
  13. doPlayerPopupFYI(cid, getHighscoreString(8))
  14. return false
  15. end
  16.  
  17. if channelId == 12 then
  18. if reloadHighscoresWhenUsingPc then
  19. doReloadHighscores()
  20. end
  21. doPlayerPopupFYI(cid, getHighscoreString(6))
  22. return false
  23. end
  24. --////////////////////////////////////////////////////////////////////////////////////////--
  25. if channelId >= 19 and channelId <= 21 then --alterado v2.8 \/
  26. setPlayerStorageValue(cid, 52480, (channelId-18))
  27. setPlayerStorageValue(cid, 52484, ((channelId-18)*2)-1)
  28. doSendAnimatedText(getThingPosWithDebug(cid), (channelId-18).."x"..(channelId-18), COLOR_BURN)
  29. doPlayerSetVocation(cid, 8)
  30. openChannelDialog(cid)
  31. return false
  32. end
  33.  
  34. if channelId >= 13 and channelId <= 18 then
  35. local sid = getPlayerByName(getPlayerStorageValue(cid, 52483):match("(.*),"))
  36. ---------------- Proteçao para ter um oponente valido!
  37. if not isCreature(sid) then
  38. doPlayerSendTextMessage(cid, 20, "The other player isn't online! Duel is canceled!")
  39. doPlayerSetVocation(cid, 1)
  40. for i = 1, #storagesDuel do
  41. setPlayerStorageValue(cid, storagesDuel[i], -1)
  42. end
  43. doCreatureSetSkullType(cid, 0)
  44. return false
  45. end
  46. ---------------- Proteçao para os 2 players terem a qntdade de pokes pro duel
  47. local pokes1 = getLivePokeballs(cid, getPlayerSlotItem(cid, 3).uid, true)
  48. local pokes2 = getLivePokeballs(sid, getPlayerSlotItem(sid, 3).uid, true)
  49. if #pokes1 < (channelId-12) or #pokes2 < (channelId-12) then
  50. local tpw = getPlayerStorageValue(cid, 52480) > 1 and "ally" or "opponent"
  51. doPlayerSendTextMessage(cid, 20, "You or your "..tpw.." doesn't have that amount of pokemons in their bags! Duel are canceled!")
  52. doPlayerSetVocation(cid, 1)
  53. for i = 1, #storagesDuel do
  54. setPlayerStorageValue(cid, storagesDuel[i], -1)
  55. end
  56. doCreatureSetSkullType(cid, 0)
  57. return false
  58. end
  59. ----------------
  60. if getPlayerStorageValue(cid, 52480) > 1 then
  61. setPlayerStorageValue(cid, 52482, getPlayerStorageValue(cid, 52482).. getCreatureName(sid)..",")
  62. setPlayerStorageValue(cid, 52483, "")
  63. end
  64. ----------------
  65.  
  66. doSendAnimatedText(getThingPos(cid), (channelId-12).." Poke"..(channelId > 13 and "s" or ""), COLOR_BURN)
  67. setPlayerStorageValue(cid, 52481, (channelId-12))
  68.  
  69. setPlayerStorageValue(sid, 52485, getCreatureName(cid))
  70. setPlayerStorageValue(sid, 52481, (channelId-12))
  71.  
  72. local players, pokes = getPlayerStorageValue(cid, 52480), getPlayerStorageValue(cid, 52481)
  73. local str = {} --alterado v2.9 \/
  74.  
  75. table.insert(str, getCreatureName(cid).." is inviting you to a duel! Use order in him to accept it!\n")
  76. table.insert(str, "Info Battle: Duel "..players.."x"..players.." - "..pokes.." pokes.")
  77. doPlayerSendTextMessage(sid, 20, table.concat(str))
  78.  
  79. addEvent(doSendAnimatedText, 1000, getThingPos(cid), "BATTLE", COLOR_ELECTRIC)
  80. doPlayerSetVocation(cid, 1)
  81. return false
  82. end
  83. --////////////////////////////////////////////////////////////////////////////////////////--
  84.  
  85. if channelId >= 100 and channelId <= 10000 then
  86.  
  87. local owner = getPlayerByGUID(getChannelOwner(channelId))
  88.  
  89. if isChannelTv(channelId) then
  90. if isCreature(owner) then
  91. if owner ~= cid then
  92. doPlayerWatchOther(cid, owner)
  93. local plural = #users == 1 and "" or "s"
  94. doPlayerSendChannelMessage(owner, "TV Channel", getCreatureName(cid)..' is now watching your channel (currently '..#users..' player'..plural..' watching this channel).', 15, channelId)
  95. else
  96. setPlayerStorageValue(cid, 99284, 1)
  97. end
  98. end
  99. elseif owner == cid then
  100. setPlayerStorageValue(cid, 99284, 2)
  101. end
  102.  
  103. return true
  104. end
  105.  
  106. return true
  107. end
  108.  
  109. function onLeaveChannel(cid, channelId, users)
  110.  
  111. if channelId >= 100 and channelId <= 10000 then
  112.  
  113. local owner = getPlayerByGUID(getChannelOwner(channelId))
  114.  
  115. if isChannelTv(channelId) then
  116. if owner ~= cid and getCreatureOutfit(cid).lookType == 814 then
  117. doPlayerStopWatching(cid)
  118. local plural = #users == 2 and "" or "s"
  119. doPlayerSendChannelMessage(owner, "TV Channel", getCreatureName(cid)..' is not watching your channel anymore (currently '..#users - (1)..' player'..plural..' watching this channel).', 15, channelId)
  120. elseif owner == cid then
  121. setPlayerStorageValue(cid, 99284, -1)
  122. doSendAnimatedText(getThingPos(cid), "CAM OFF", 180)
  123. for stops = 1, #users do
  124. if users[stops] ~= owner then
  125. doPlayerStopWatching(users[stops])
  126. end
  127. end
  128. end
  129. elseif owner == cid then
  130. setPlayerStorageValue(cid, 99284, -1)
  131. end
  132.  
  133. return true
  134. end
  135.  
  136. return true
  137. end
  138.  
  139. function onWalk(cid, fromPosition, toPosition)
  140.  
  141.  
  142.  
  143. -- Código năo é mais necessário, feito em c++
  144. -- Code deprecated, made in c++
  145. --if not canWalkOnPos(toPosition, false, false, false, true, false) and getPlayerStorageValue(cid, 17000) >= 1 then
  146. -- doTeleportThing(cid, fromPosition, false)
  147. -- doPlayerSendCancel(cid, "Sorry, not possible.")
  148. --end
  149.  
  150. if getPlayerStorageValue(cid, 99284) <= 0 then return true end
  151.  
  152. local speed = getCreatureSpeed(cid)
  153. local a = getWatchingPlayersFromPos(cid, fromPosition)
  154.  
  155. for b = 1, #a do
  156. if getCreatureSpeed(a[b]) ~= speed then
  157. doChangeSpeed(a[b], - getCreatureSpeed(a[b]))
  158. doChangeSpeed(a[b], speed)
  159. end
  160. doTeleportThing(a[b], toPosition, true)
  161. end
  162.  
  163. return true
  164. end
  165.  
  166. local permited = {"a", "b", "c", "ç", "d", "e", "f", "g", "đ", "h", "ý", "i", "j", "k", "l", "m", "n", "o", "ö", "p", "q", "r", "s", "ţ",
  167. "t", "u", "ü", "v", "x", "w", ",", "'", '"',
  168. "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", "!", "@", "#", "$", "%", "&", "*", "(", ")",
  169. "-", "_", "+", "/", ";", ":", "?", "^", "~", "{", "[", "}", "]", ">", "<", "Ł", "˘", "¬"}
  170.  
  171. function onTextEdit(cid, item, newText)
  172.  
  173. if item.itemid == 12330 then
  174.  
  175. if getPlayerStorageValue(cid, 99284) >= 1 then
  176. doPlayerSendCancel(cid, "You are already on air!")
  177. return false
  178. end
  179.  
  180. local channelName = getCreatureName(cid).."'s TV Channel"
  181.  
  182. if string.len(newText) <= 0 then
  183. doPlayerSendCancel(cid, "Your channel is going to be shown as \""..getCreatureName(cid).."'s TV Channel\".")
  184. elseif string.len(newText) > 25 then
  185. doPlayerSendCancel(cid, "Your channel name can't have more than 25 characters.")
  186. return false
  187. else
  188. channelName = newText
  189. end
  190.  
  191.  
  192. setPlayerStorageValue(cid, 99284, 1)
  193. setPlayerStorageValue(cid, 99285, "")
  194. setPlayerStorageValue(cid, 99285, channelName)
  195. doPlayerCreatePrivateChannel(cid, channelName)
  196. doSendAnimatedText(getThingPos(cid), "ON AIR!", COLOR_GRASS)
  197.  
  198. return false
  199. end
  200.  
  201. return true
  202. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement