Advertisement
Kevick

Addon system

May 24th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.59 KB | None | 0 0
  1. Vá em actions/scripts e crie um arquivo chamado addon.lua.
  2. Adicione isso lá:
  3. function onUse(cid, item, fromPosition, itemEx, toPosition)
  4. local addons = {
  5. [ID DO ITEM] = {pokemon= "NOME DO POKEMON" , looktype = LOOKTYPE NORMAL, fly = FLY, SE NÃO TIVER PONHA 0, ride = RIDE, SE NÃO TIVER PONHA 0, surf = SE NÃO TIVER SURF PONHA 0},
  6. }
  7.  
  8. if #getCreatureSummons(cid) > 0 then
  9. doPlayerSendCancel(cid, "Please back your pokemon.")
  10. return false
  11. end
  12. local addon = addons[item.itemid].looktype
  13. local fly = addons[item.itemid].fly
  14. local ride = addons[item.itemid].ride
  15. local surf = addons[item.itemid].surf
  16.  
  17. local pb = getPlayerSlotItem(cid, 8).uid
  18. local pk = addons[item.itemid].pokemon
  19.  
  20. if getItemAttribute(pb,"poke") ~= pk then
  21. doPlayerSendCancel(cid, "Sorry, you can't use this addon on this poke.")
  22. return false
  23. end
  24.  
  25. if getItemAttribute(pb,"addon") >= 0 then
  26. doRemoveItem(item.uid, 1)
  27. doPlayerSendTextMessage(cid, 27, "Congratulations! Now your pokemon will use the addon.")
  28. doSetItemAttribute(pb,"addon",addon)
  29. doSetItemAttribute(pb,"addonfly",fly)
  30. doSetItemAttribute(pb,"addonride",ride)
  31. doSetItemAttribute(pb,"addonsurf",surf)
  32. return true
  33. end
  34.  
  35. return true
  36. end
  37. Em actions.xml adicione:
  38. <action itemid="ID;ID;ID" event="script" value="addon.lua"/>
  39. Agora em actions/goback.lua antes de:
  40. else
  41. doPlayerSendCancel(cid, "This pokemon is fainted.")
  42. end
  43. return true
  44. end
  45. Adicione:
  46. local pk = getCreatureSummons(cid)[1]
  47. local pb = getPlayerSlotItem(cid, 8).uid
  48. local look = getItemAttribute(pb,"addon")
  49. if not look then
  50. doSetItemAttribute(pb,"addon",0)
  51.  
  52. end
  53. if look > 0 then
  54. doSetCreatureOutfit(pk, {lookType = look}, -1)
  55.  
  56. end
  57. Em lib/order.lua encontre:
  58. local pokemon = flys[getPokemonName(getCreatureSummons(cid)[1])]
  59. doPlayerSendTextMessage(cid, 27, "Type \"up\" or \"h1\" to fly higher and \"down\" or \"h2\" to fly lower.")
  60. doChangeSpeed(cid, -getCreatureSpeed(cid))
  61. local speed = 500 + PlayerSpeed/5 + getSpeed(sid) * 6 * speedRate
  62. doChangeSpeed(cid, speed)
  63. setPlayerStorageValue(cid, 54844, speed)
  64. doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1)
  65. doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", getCreatureHealth(getCreatureSummons(cid)[1]) / getCreatureMaxHealth(getCreatureSummons(cid)[1]))
  66. doRemoveCreature(getCreatureSummons(cid)[1])
  67. setPlayerStorageValue(cid, 17000, 1)
  68. Abaixo adicione:
  69. local addonfly= getPlayerSlotItem(cid, 8).uid
  70. local addofly = getItemAttribute(addonfly,"addonfly")
  71. if not addofly then
  72. doSetItemAttribute(addonfly,"addonfly",0)
  73.  
  74. end
  75. if addofly > 0 then
  76. doSetCreatureOutfit(cid, {lookType = addofly}, -1)
  77.  
  78. end
  79. Continuando em order.lua Encontre:
  80. local pokemon = rides[getPokemonName(getCreatureSummons(cid)[1])]
  81. doChangeSpeed(cid, -getCreatureSpeed(cid))
  82. local speed = 150 + PlayerSpeed + getSpeed(sid) * 5 * speedRate
  83. doChangeSpeed(cid, speed)
  84. setPlayerStorageValue(cid, 54844, speed)
  85. doSetCreatureOutfit(cid, {lookType = pokemon[1] + 351}, -1)
  86. doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", getCreatureHealth(getCreatureSummons(cid)[1]) / getCreatureMaxHealth(getCreatureSummons(cid)[1]))
  87. doRemoveCreature(getCreatureSummons(cid)[1])
  88. setPlayerStorageValue(cid, 17001, 1)
  89. Em baixo adicione:
  90. local addonride = getPlayerSlotItem(cid, 8).uid
  91. local addoride = getItemAttribute(addonride,"addonride")
  92. if not addoride then
  93. doSetItemAttribute(addonride,"addonride",0)
  94.  
  95. end
  96. if addoride > 0 then
  97. doSetCreatureOutfit(cid, {lookType = addoride}, -1)
  98.  
  99. en
  100. Agora em movements/surf.lua encontre:
  101. doSetCreatureOutfit(cid, {lookType = surfs[getPokemonName(getCreatureSummons(cid)[1])].lookType + 351}, -1)
  102.  
  103. doCreatureSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", lets surf!", 1)
  104. doChangeSpeed(cid, -(getCreatureSpeed(cid)))
  105.  
  106. E troque por:
  107. local addonsurf = getPlayerSlotItem(cid, 8).uid
  108. local addosurf = getItemAttribute(addonsurf,"addonsurf")
  109. if not addosurf then
  110. doSetItemAttribute(addonsurf,"addonsurf",0)
  111. doSetCreatureOutfit(cid, {lookType = surfs[getPokemonName(getCreatureSummons(cid)[1])].lookType + 351}, -1)
  112. end
  113. if addosurf > 0 then
  114. doSetCreatureOutfit(cid, {lookType = addosurf}, -1)
  115.  
  116. end
  117. doCreatureSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", lets surf!", 1)
  118. doChangeSpeed(cid, -(getCreatureSpeed(cid)))
  119. No mesmo arquivo ache:
  120.  
  121. doSummonMonster(cid, pokemon)
  122. Logo abaixo adicione:
  123. local pk = getCreatureSummons(cid)[1]
  124. local balla = getPlayerSlotItem(cid, 8).uid
  125. local balladdon = getItemAttribute(balla,"addon")
  126. if not balladdon then
  127. doSetItemAttribute(balla,"addon",0)
  128.  
  129. end
  130. if balladdon > 0 then
  131. doSetCreatureOutfit(pk, {lookType = balladdon}, -1)
  132.  
  133. end
  134. Por ultimo em actions/order.lua encontre:
  135.  
  136. doPlayerSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", let me get down!", 1)
  137.  
  138. doRegainSpeed(cid) --alterado v1.7
  139.  
  140. doRemoveCondition(cid, CONDITION_OUTFIT)
  141. Abaixo adicione:
  142. local pkjg = getCreatureSummons(cid)[1]
  143. local pkza = getPlayerSlotItem(cid, 8).uid
  144. local pkxd = getItemAttribute(pkjg,"addon")
  145. if not pkxd then
  146. doSetItemAttribute(pkza,"addon",0)
  147.  
  148.  
  149. elseif pkxd > 0 then
  150. doSetCreatureOutfit(pkjg, {lookType = pkxd}, -1)
  151. end
  152. Vá em creaturescripts/scripts/login.lua Troque tudo por:
  153. [spoiler]
  154. local config = {
  155. loginMessage = getConfigValue('loginMessage'),
  156. useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
  157. }
  158.  
  159. --alterado v2.6 tabelas soh em lib/configuration.lua;
  160.  
  161. function onLogin(cid)
  162.  
  163. if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 10 then --alterado v2.8
  164. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
  165. else
  166. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, (getPlayerLevel(cid) >= 200 and 100 or math.floor(getPlayerLevel(cid)/2)) )
  167. end
  168. doCreatureSetDropLoot(cid, false)
  169.  
  170. local accountManager = getPlayerAccountManager(cid)
  171.  
  172. if(accountManager == MANAGER_NONE) then
  173. local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
  174. if(lastLogin > 0) then
  175. doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  176. str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
  177. else
  178. str = str
  179. end
  180.  
  181.  
  182. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Welcome to Planet Pokemon.')
  183.  
  184.  
  185. doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  186.  
  187. elseif(accountManager == MANAGER_NAMELOCK) then
  188. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
  189. elseif(accountManager == MANAGER_ACCOUNT) then
  190. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
  191. else
  192. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
  193. end
  194.  
  195. if getCreatureName(cid) == "Account Manager" then
  196. local outfit = {}
  197. if accountManagerRandomPokemonOutfit then
  198. outfit = {lookType = getPokemonXMLOutfit(oldpokedex[math.random(151)][1])}
  199. else
  200. outfit = accountManagerOutfit
  201. end
  202.  
  203. doSetCreatureOutfit(cid, outfit, -1)
  204. return true
  205. end
  206.  
  207. if(not isPlayerGhost(cid)) then
  208. doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
  209. end
  210.  
  211. local outfit = {}
  212.  
  213. if getPlayerVocation(cid) == 0 then
  214. doPlayerSetMaxCapacity(cid, 7)
  215. doPlayerSetVocation(cid, 1)
  216. setCreatureMaxMana(cid, 6)
  217. doPlayerAddSoul(cid, -getPlayerSoul(cid))
  218. setPlayerStorageValue(cid, 19898, 0)
  219. if getCreatureOutfit(cid).lookType == 128 then
  220. outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
  221. elseif getCreatureOutfit(cid).lookType == 136 then
  222. outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
  223. end
  224. doCreatureChangeOutfit(cid, outfit)
  225. end
  226.  
  227. registerCreatureEvent(cid, "dropStone") --alterado v2.7
  228. --alterado v2.6.1
  229. registerCreatureEvent(cid, "ShowPokedex") --alterado v2.6
  230. registerCreatureEvent(cid, "ClosePokedex") --alterado v2.6
  231. registerCreatureEvent(cid, "WatchTv")
  232. registerCreatureEvent(cid, "StopWatchingTv")
  233. registerCreatureEvent(cid, "WalkTv")
  234. registerCreatureEvent(cid, "RecordTv")
  235. registerCreatureEvent(cid, "Death")
  236. registerCreatureEvent(cid, "PlayerLogout")
  237. registerCreatureEvent(cid, "WildAttack")
  238. registerCreatureEvent(cid, "Idle")
  239. registerCreatureEvent(cid, "PokemonIdle")
  240. registerCreatureEvent(cid, "EffectOnAdvance")
  241. registerCreatureEvent(cid, "reward")
  242. registerCreatureEvent(cid, "GeneralConfiguration")
  243. registerCreatureEvent(cid, "ReportBug")
  244. registerCreatureEvent(cid, "LookSystem")
  245. registerCreatureEvent(cid, "T1")
  246. registerCreatureEvent(cid, "T2")
  247. registerCreatureEvent(cid, "ll1")
  248. registerCreatureEvent(cid, "task_count")
  249. registerCreatureEvent(cid, "ctff")
  250. registerCreatureEvent(cid, "ctfd")
  251. registerCreatureEvent(cid, "task")
  252. registerCreatureEvent(cid, "dota")
  253. registerCreatureEvent(cid, "atk")
  254. registerCreatureEvent(cid, "balance")
  255.  
  256. registerCreatureEvent(cid, "aloot_kill")
  257. if getPlayerStorageValue(cid, 99284) == 1 then
  258. setPlayerStorageValue(cid, 99284, -1)
  259. end
  260.  
  261. if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then
  262. setPlayerStorageValue(cid, 6598754, -1)
  263. setPlayerStorageValue(cid, 6598755, -1)
  264. doRemoveCondition(cid, CONDITION_OUTFIT) --alterado v2.9 \/
  265. doTeleportThing(cid, posBackPVP, false)
  266. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  267. end
  268.  
  269. doChangeSpeed(cid, -(getCreatureSpeed(cid)))
  270.  
  271. --///////////////////////////////////////////////////////////////////////////--
  272. local storages = {17000, 63215, 17001, 13008, 5700}
  273. for s = 1, #storages do
  274. if not tonumber(getPlayerStorageValue(cid, storages[s])) then
  275. if s == 3 then
  276. setPlayerStorageValue(cid, storages[s], 1)
  277. elseif s == 4 then
  278. setPlayerStorageValue(cid, storages[s], -1)
  279. else
  280. if isBeingUsed(getPlayerSlotItem(cid, 8).itemid) then
  281. setPlayerStorageValue(cid, storages[s], 1) --alterado v2.6
  282. else
  283. setPlayerStorageValue(cid, storages[s], -1)
  284. end
  285. end
  286. doPlayerSendTextMessage(cid, 27, "Sorry, but a problem occurred on the server, but now it's alright")
  287. end
  288. end
  289. --/////////////////////////////////////////////////////////////////////////--
  290.  
  291. if getPlayerStorageValue(cid, 17000) >= 1 then -- fly
  292.  
  293. local item = getPlayerSlotItem(cid, 8)
  294. local poke = getItemAttribute(item.uid, "poke")
  295. doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  296. doRemoveCondition(cid, CONDITION_OUTFIT)
  297. local addonfly = getPlayerSlotItem(cid, 8).uid
  298. local addofly = getItemAttribute(addonfly,"addonfly")
  299. if not addofly then
  300. doSetItemAttribute(addonfly,"addonfly",0)
  301. doSetCreatureOutfit(cid, {lookType = flys[poke][1] + 351}, -1)
  302.  
  303. end
  304. if addofly > 0 then
  305. doSetCreatureOutfit(cid, {lookType = addofly}, -1)
  306.  
  307. end
  308.  
  309. local apos = getFlyingMarkedPos(cid)
  310. apos.stackpos = 0
  311.  
  312. if getTileThingByPos(apos).itemid <= 2 then
  313. doCombatAreaHealth(cid, FIREDAMAGE, getFlyingMarkedPos(cid), 0, 0, 0, CONST_ME_NONE)
  314. doCreateItem(460, 1, getFlyingMarkedPos(cid))
  315. end
  316.  
  317. doTeleportThing(cid, apos, false)
  318. if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then
  319. sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")]) --alterado v2.8
  320. end
  321.  
  322. local posicao = getTownTemplePosition(getPlayerTown(cid))
  323. markFlyingPos(cid, posicao)
  324.  
  325. elseif getPlayerStorageValue(cid, 63215) >= 1 then -- surf
  326.  
  327. local item = getPlayerSlotItem(cid, 8)
  328. local poke = getItemAttribute(item.uid, "poke")
  329. local addonsurf = getPlayerSlotItem(cid, 8).uid
  330. local addosurf = getItemAttribute(addonsurf,"addonsurf")
  331. if not addosurf then
  332. doSetItemAttribute(addonsurf,"addonsurf",0)
  333. doSetCreatureOutfit(cid, {lookType = surfs[poke].lookType + 351}, -1)
  334.  
  335. end
  336. if addosurf > 0 then
  337. doSetCreatureOutfit(cid, {lookType = addosurf}, -1)
  338.  
  339. end
  340. doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  341. if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then
  342. sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")]) --alterado v2.8
  343. end
  344.  
  345. elseif getPlayerStorageValue(cid, 17001) >= 1 then -- ride
  346.  
  347. local item = getPlayerSlotItem(cid, 8)
  348. local poke = getItemAttribute(item.uid, "poke")
  349.  
  350.  
  351. if rides[poke] then
  352. doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
  353. doRemoveCondition(cid, CONDITION_OUTFIT)
  354. local addonride = getPlayerSlotItem(cid, 8).uid
  355. local addoride = getItemAttribute(addonride,"addonride")
  356. if not addofly then
  357. doSetItemAttribute(addonride,"addonride",0)
  358. doSetCreatureOutfit(cid, {lookType = rides[poke][1] + 351}, -1)
  359.  
  360. end
  361. if addoride > 0 then
  362. doSetCreatureOutfit(cid, {lookType = addoride}, -1)
  363.  
  364. end
  365. if getItemAttribute(item.uid, "boost") and getItemAttribute(item.uid, "boost") >= 50 and getPlayerStorageValue(cid, 42368) >= 1 then
  366. sendAuraEffect(cid, auraSyst[getItemAttribute(item.uid, "aura")]) --alterado v2.8
  367. end
  368. else
  369. setPlayerStorageValue(cid, 17001, -1)
  370. doRegainSpeed(cid) --alterado v2.6
  371. end
  372.  
  373. local posicao2 = getTownTemplePosition(getPlayerTown(cid))
  374. markFlyingPos(cid, posicao2)
  375.  
  376. elseif getPlayerStorageValue(cid, 13008) >= 1 then -- dive
  377. if not isInArray({5405, 5406, 5407, 5408, 5409, 5410}, getTileInfo(getThingPos(cid)).itemid) then
  378. setPlayerStorageValue(cid, 13008, 0)
  379. doRegainSpeed(cid) --alterado v2.6
  380. doRemoveCondition(cid, CONDITION_OUTFIT)
  381. return true
  382. end
  383.  
  384. if getPlayerSex(cid) == 1 then
  385. doSetCreatureOutfit(cid, {lookType = 1034, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  386. else
  387. doSetCreatureOutfit(cid, {lookType = 1035, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
  388. end
  389. doChangeSpeed(cid, 800)
  390.  
  391. elseif getPlayerStorageValue(cid, 5700) > 0 then --bike
  392. doChangeSpeed(cid, -getCreatureSpeed(cid))
  393. doChangeSpeed(cid, getPlayerStorageValue(cid, 5700)) --alterado v2.8
  394. if getPlayerSex(cid) == 1 then
  395. doSetCreatureOutfit(cid, {lookType = 1394}, -1)
  396. else
  397. doSetCreatureOutfit(cid, {lookType = 1393}, -1)
  398. end
  399. elseif getPlayerStorageValue(cid, 75846) >= 1 then --alterado v2.9 \/
  400. doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
  401. setPlayerStorageValue(cid, 75846, -1)
  402. sendMsgToPlayer(cid, 20, "You have been moved to your town!")
  403. else
  404. doRegainSpeed(cid) --alterado v2.6
  405. end
  406.  
  407. if getPlayerStorageValue(cid, 22545) >= 1 then --golden arena
  408. setPlayerStorageValue(cid, 22545, -1) --alterado v2.4
  409. doTeleportThing(cid, getClosestFreeTile(cid, posBackGolden), false)
  410. setPlayerRecordWaves(cid) --alterado v2.7
  411. end
  412.  
  413. return true
  414. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement