Advertisement
Guest User

Untitled

a guest
Jan 19th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.10 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mod name="Rush Event" version="1.0" author="Tibia Hosting por disponibilizar, fixed by dchampag@otlands" contact="eduardo.yhago@hotmail.com" enabled="yes">
  3. <description>
  4. TUTORIAL DE COMO CONFIGURAR O EVENTO ACOMPANHE POR AQUI:
  5. q - mensagem que vai ser exibida quando o evento começar
  6. d_1 - posição do tempo vermelho ao começar evento
  7. d_2 - posição do tempo azul ao começar evento
  8. x - mensagem que vai ser exibida quando o evento não começar
  9. w - posição da sala de espera, onde os players vão ficar antes de começar
  10. lvl - level minimo para participar do evento
  11. v - a quantidade de frags que será necessária para o time ganhar
  12. mn - quantidade minima de players para começar o evento
  13. m - maximo de players dentro do evento
  14. o - mensagem exibida quando o time vermelho ganhar
  15. y - mensagem exibida quando o time azul ganhar
  16. i_1 - id do premio (agora é crystal coin = 2160)
  17. i_2 - quantidade do premio (agora esta 10 crystal coins)
  18. t - tempo para começar o evento (agora esta is 5 minutos)
  19. r - tempo em que os resultados da batalha serão mostrados aos players (agora esta 3 minutos)
  20.  
  21. Adicione isto em 050-function.lua:
  22. -------------------------------------------------------------------------------------------------
  23. function doPlayerRemoveLethalConditions(cid)
  24. local tmp = {1, 2, 4, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
  25. for i = 1, #tmp do
  26. if(hasCondition(cid, tmp[i])) then doRemoveCondition(cid, tmp[i]) end
  27. end
  28. return true
  29. end
  30. -------------------------------------------------------------------------------------------------
  31. Adicione isto em login.lua:
  32. -------------------------------------------------------------------------------------------------
  33. registerCreatureEvent(cid, "RushCombat")
  34. registerCreatureEvent(cid, "RushAttack")
  35. registerCreatureEvent(cid, "RushDead")
  36. registerCreatureEvent(cid, "RushOutfit")
  37. -------------------------------------------------------------------------------------------------
  38. Agora daqui pra baixo você vai configurar de acordo com o tutorial acima, o resto se não tiver
  39. conhecimento não mecha em nada pois poderá bugar o evento e não daremos suporte:
  40. </description>
  41. <config name="re"><![CDATA[
  42. t = {
  43. a = 32145,
  44. g = 32146,
  45. l = 32147,
  46. u = 32148,
  47. h = 32149,
  48. wv = 32150,
  49. c = 0,
  50. q = "The Massive Team Battle has now been started! Enjoy and have fight well!",
  51. f = 5447,
  52. f_1 = 5448,
  53. f_2 = 5449,
  54. d_1 = {x = 28387, y = 32337, z = 7}, -- red temple
  55. d_2 = {x = 28386, y = 32355, z = 7}, -- blue temple
  56. x = "The massive Team Battles won't start bacause too few people were willing to participate",
  57. w = {x=28435,y=32309,z=4},
  58. lvl = 80,
  59. v = 2,
  60. mn = 1,
  61. m = 200,
  62. o = "The war has seized, the RED TEAM has won the massive Team Battle!",
  63. y = "The war has seized, the BLUE TEAM has won the massive Team Battle!",
  64. i_1 = 2143,
  65. i_2 = 50,
  66. t = 1,
  67. r = 3
  68. }
  69. ]]></config>
  70. <globalevent name="Recognition" interval="8000" event="script"><![CDATA[
  71. domodlib('re')
  72. function onThink(interval, lastExecution, thinkInterval)
  73. if(getGlobalStorageValue(t.a) == 1) then
  74. for _, pid in ipairs(getPlayersOnline()) do
  75. if getPlayerStorageValue(pid, t.f) == 1 then
  76. if(getPlayerStorageValue(pid, t.f_1) == 0) then
  77. doSendAnimatedText(getCreaturePosition(pid), "RED TEAM", TEXTCOLOR_RED)
  78. elseif(getPlayerStorageValue(pid, t.f_1) == 1) then
  79. doSendAnimatedText(getCreaturePosition(pid), "BLUE TEAM", TEXTCOLOR_LIGHTBLUE)
  80. end
  81. end
  82. end
  83. return true
  84. end
  85. return true
  86. end
  87. ]]></globalevent>
  88. <talkaction words="!start" event="script"><![CDATA[
  89. domodlib('re')
  90. function onSay(cid, words, param, channel)
  91. if getPlayerGroupId(cid) > 3 then
  92. setGlobalStorageValue(t.g, 1)
  93. setGlobalStorageValue(t.u, 0)
  94. setGlobalStorageValue(t.l, 0)
  95. setGlobalStorageValue(t.a, 1)
  96. setGlobalStorageValue(t.c, 0)
  97. setGlobalStorageValue(t.wv, 0)
  98. doBroadcastMessage("Attention! Immediately register to the Massive Team Battle, event will start in ".. t.t .." minutes. All players can join to event typing this command: !rush", MESSAGE_STATUS_WARNING)
  99. addEvent(function()
  100. doBroadcastMessage("The Massive Team Battle starts in in 2 minutes. If you want to join, type in !start", MESSAGE_STATUS_WARNING)
  101. end, (t.t - 2) * 1000 * 60)
  102. addEvent(function()
  103. doBroadcastMessage("The Massive Team Battle starts in a minute. If you want to join, type in !start.", MESSAGE_STATUS_WARNING)
  104. end, (t.t - 1) * 1000 * 60)
  105. addEvent(start, t.t * 1000 * 60, cid)
  106. return true
  107. end
  108. return true
  109. end
  110. function results()
  111. if(getGlobalStorageValue(t.a) == 1) then
  112. local red = getGlobalStorageValue(t.l)
  113. local blue = getGlobalStorageValue(t.u)
  114. doBroadcastMessage("Massive Team Battle, results:\nRed Team scored: ".. red .." frags.\nBlue Team scored: ".. blue .." frags.\nMatch is under way to ".. t.v .." frags.", MESSAGE_STATUS_WARNING)
  115. addEvent(results, t.r * 1000 * 60)
  116. end
  117. end
  118. function start(cid)
  119. if(getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.c) >= t.mn) then
  120. doBroadcastMessage(t.q, MESSAGE_STATUS_WARNING)
  121. setGlobalStorageValue(t.wv, 1)
  122. addEvent(results, t.r * 1000 * 60)
  123. for _, pid in ipairs(getPlayersOnline()) do
  124. local myOutfit = getCreatureOutfit(pid)
  125. local red = {lookType = myOutfit.lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
  126. local blue = {lookType = myOutfit.lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
  127. if getPlayerStorageValue(pid, t.f) == 1 then
  128. doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
  129. doCreatureAddMana(pid, getCreatureMaxMana(pid))
  130. if((getPlayerStorageValue(pid, t.g) % 2) == 1) then
  131. doCreatureChangeOutfit(pid, red)
  132. setPlayerStorageValue(pid, t.h, 0)
  133. doTeleportThing(pid, t.d_1)
  134. setPlayerStorageValue(pid, t.f, 1)
  135. setPlayerStorageValue(pid, t.f_1, 0)
  136. setPlayerStorageValue(pid, t.f_2, 1)
  137. doSendMagicEffect(getCreaturePosition(pid), 10)
  138. doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You are in RED TEAM!\nThis battle will continue up to ".. t.v .." frags!")
  139. else
  140. doCreatureChangeOutfit(pid, blue)
  141. doTeleportThing(pid, t.d_2)
  142. setPlayerStorageValue(pid, t.h, 0)
  143. setPlayerStorageValue(pid, t.f, 1)
  144. setPlayerStorageValue(pid, t.f_1, 1)
  145. setPlayerStorageValue(pid, t.f_2, 0)
  146. doSendMagicEffect(getCreaturePosition(pid), 10)
  147. doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You are in BLUE TEAM!\nThis battle will continue up to ".. t.v .." frags!")
  148. end
  149. end
  150. end
  151. elseif(getGlobalStorageValue(t.c) < t.mn) then
  152. doBroadcastMessage(t.x, MESSAGE_STATUS_WARNING)
  153. setGlobalStorageValue(t.a, 0)
  154. for _, pid in ipairs(getPlayersOnline()) do
  155. if getPlayerStorageValue(pid, t.f) == 1 then
  156. setPlayerStorageValue(pid, t.f, -1)
  157. doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
  158. doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
  159. end
  160. end
  161. end
  162. end
  163. ]]></talkaction>
  164. <globalevent name="RushStart" time="00:09" event="script"><![CDATA[
  165. domodlib('re')
  166. function onTime(interval, lastExecution)
  167. setGlobalStorageValue(t.g, 1)
  168. setGlobalStorageValue(t.u, 0)
  169. setGlobalStorageValue(t.l, 0)
  170. setGlobalStorageValue(t.a, 1)
  171. setGlobalStorageValue(t.c, 0)
  172. setGlobalStorageValue(t.wv, 0)
  173. doBroadcastMessage("Attention! Immediately register to Rush Event, event will start for ".. t.t .." minutes. All players can join to event typing this command: !join", MESSAGE_STATUS_WARNING)
  174. addEvent(function()
  175. doBroadcastMessage("Massive team battles starts in 2 minutes. If you want to join, type in the command: !join", MESSAGE_STATUS_WARNING)
  176. end, (t.t - 2) * 1000 * 60)
  177. addEvent(function()
  178. doBroadcastMessage("Massive team battles starts in a minute. If you want to join, type in the command: !join", MESSAGE_STATUS_WARNING)
  179. end, (t.t - 1) * 1000 * 60)
  180. addEvent(start, t.t * 1000 * 60, cid)
  181. end
  182. function results()
  183. if(getGlobalStorageValue(t.a) == 1) then
  184. local red = getGlobalStorageValue(t.l)
  185. local blue = getGlobalStorageValue(t.u)
  186. doBroadcastMessage("Massive team battle, results:\nRed Team scored: ".. red .." frags.\nBlue Team scored: ".. blue .." frags.\nMatch is under way to ".. t.v .." frags.", MESSAGE_STATUS_WARNING)
  187. addEvent(results, t.r * 1000 * 60)
  188. end
  189. end
  190. function start(cid)
  191. if(getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.c) >= t.mn) then
  192. doBroadcastMessage(t.q, MESSAGE_STATUS_WARNING)
  193. setGlobalStorageValue(t.wv, 1)
  194. addEvent(results, t.r * 1000 * 60)
  195. for _, pid in ipairs(getPlayersOnline()) do
  196. local myOutfit = getCreatureOutfit(pid)
  197. local red = {lookType = myOutfit.lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
  198. local blue = {lookType = myOutfit.lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
  199. if getPlayerStorageValue(pid, t.f) == 1 then
  200. doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
  201. doCreatureAddMana(pid, getCreatureMaxMana(pid))
  202. if((getPlayerStorageValue(pid, t.g) % 2) == 1) then
  203. doCreatureChangeOutfit(pid, red)
  204. setPlayerStorageValue(pid, t.h, 0)
  205. doTeleportThing(pid, t.d_1)
  206. setPlayerStorageValue(pid, t.f, 1)
  207. setPlayerStorageValue(pid, t.f_1, 0)
  208. setPlayerStorageValue(pid, t.f_2, 1)
  209. doSendMagicEffect(getCreaturePosition(pid), 10)
  210. doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You are in RED TEAM!\nThis battle will continue up to ".. t.v .." frags!")
  211. else
  212. doCreatureChangeOutfit(pid, blue)
  213. setPlayerStorageValue(pid, t.h, 0)
  214. doTeleportThing(pid, t.d_2)
  215. setPlayerStorageValue(pid, t.f, 1)
  216. setPlayerStorageValue(pid, t.f_1, 1)
  217. setPlayerStorageValue(pid, t.f_2, 0)
  218. doSendMagicEffect(getCreaturePosition(pid), 10)
  219. doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You are in BLUE TEAM!\nThis battle will continue up to ".. t.v .." frags!")
  220. end
  221. end
  222. end
  223. elseif(getGlobalStorageValue(t.c) < t.mn) then
  224. doBroadcastMessage(t.x, MESSAGE_STATUS_WARNING)
  225. setGlobalStorageValue(t.a, 0)
  226. for _, pid in ipairs(getPlayersOnline()) do
  227. if getPlayerStorageValue(pid, t.f) == 1 then
  228. setPlayerStorageValue(pid, t.f, -1)
  229. doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
  230. doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
  231. end
  232. end
  233. end
  234. end
  235. ]]></globalevent>
  236. <talkaction words="!join" event="script"><![CDATA[
  237. domodlib('re')
  238. function onSay(cid, words, param, channel)
  239. if getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.wv) ~= 1 then
  240. if getPlayerLevel(cid) >= t.lvl then
  241. if getPlayerStorageValue(cid, t.f) == -1 then
  242. if getTilePzInfo(getPlayerPosition(cid)) == true then
  243. if getGlobalStorageValue(t.c) < t.m then
  244. setGlobalStorageValue(t.c, getGlobalStorageValue(t.c)+1)
  245. if getGlobalStorageValue(t.c) == t.m then
  246. doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
  247. else
  248. doBroadcastMessage("" .. getPlayerName(cid) .. " has joined the Massive Team Battles Event! Actually we have: " .. getGlobalStorageValue(t.c) .. " players!", 19)
  249. end
  250. setPlayerStorageValue(cid, t.f, 1)
  251. setPlayerStorageValue(cid, t.h, -1)
  252. doTeleportThing(cid, t.w)
  253. doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
  254. setPlayerStorageValue(cid, t.g, getGlobalStorageValue(t.g))
  255. setGlobalStorageValue(t.g, tonumber(getGlobalStorageValue(t.g))+1)
  256. else
  257. doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
  258. return true
  259. end
  260. else
  261. doPlayerSendCancel(cid, "You must be in protection zone to be able to enter the massive team battle.")
  262. return true
  263. end
  264. else
  265. doPlayerSendCancel(cid, "You are already registered in this event.")
  266. return true
  267. end
  268. else
  269. doPlayerSendCancel(cid, "Your level is too low to participate in this event. The minimum required level is 80.")
  270. return true
  271. end
  272. else
  273. doPlayerSendCancel(cid, "At the moment there are no records for this event.")
  274. return true
  275. end
  276. return true
  277. end
  278. ]]></talkaction>
  279. <event type="combat" name="RushCombat" event="script"><![CDATA[
  280. domodlib('re')
  281. function onCombat(cid, target)
  282. if(getGlobalStorageValue(t.a) == 1) then
  283. if isPlayer(cid) and isPlayer(target) then
  284. if getPlayerStorageValue(cid, t.f) == 1 and getPlayerStorageValue(target, t.f) == 1 then
  285. if getPlayerStorageValue(cid, t.f_1) == getPlayerStorageValue(target, t.f_1) then
  286. return doPlayerSendCancel(cid, "Sorry, you cannot attack your own team.") and false
  287. end
  288. end
  289. end
  290. end
  291. return true
  292. end
  293. ]]></event>
  294. <event type="attack" name="RushAttack" event="script"><![CDATA[
  295. domodlib('re')
  296. function onAttack(cid, target)
  297. if(getGlobalStorageValue(t.a) == 1) then
  298. if isPlayer(cid) and isPlayer(target) then
  299. if getPlayerStorageValue(cid, t.f) == 1 and getPlayerStorageValue(target, t.f) == 1 then
  300. if getPlayerStorageValue(cid, t.f_1) == getPlayerStorageValue(target, t.f_1) then
  301. return doPlayerSendCancel(cid, "Sorry, you cannot attack your own team.") and false
  302. end
  303. end
  304. end
  305. end
  306. return true
  307. end
  308. ]]></event>
  309. <event type="preparedeath" name="RushDead" event="script"><![CDATA[
  310. domodlib('re')
  311. function onPrepareDeath(cid, deathList)
  312. if(not isPlayer(cid)) then
  313. return true
  314. end
  315. if getGlobalStorageValue(t.a) == 1 then
  316. local strings = {""}
  317. local j, position, corpse = 1, 1, 0
  318. for _, pid in ipairs(deathList) do
  319. if isCreature(pid) == true then
  320. strings[position] = j == 1 and "" or strings[position] .. ", "
  321. strings[position] = strings[position] .. getCreatureName(pid) .. ""
  322. j = j + 1
  323. else
  324. strings[position] = j == 1 and "" or strings[position] .. ", "
  325. strings[position] = strings[position] .."a field item"
  326. j = j + 1
  327. end
  328. end
  329. for i, str in ipairs(strings) do
  330. if(str:sub(str:len()) ~= ",") then
  331. str = str .. "."
  332. end
  333. desc = "You recognize "
  334. desc = desc .. "" .. getCreatureName(cid) .. ". He was killed by " .. str
  335. end
  336. if(getPlayerSex(cid) == 1) then
  337. corpse = doCreateItem(3058, getCreaturePosition(cid))
  338. else
  339. corpse = doCreateItem(3065, getCreaturePosition(cid))
  340. end
  341. doItemSetAttribute(corpse, "description", desc)
  342. if((getPlayerStorageValue(cid, t.g) % 2) == 1) then
  343. setGlobalStorageValue(t.u, getGlobalStorageValue(t.u)+1)
  344. else
  345. setGlobalStorageValue(t.l, getGlobalStorageValue(t.l)+1)
  346. end
  347. local red = getGlobalStorageValue(t.l)
  348. local blue = getGlobalStorageValue(t.u)
  349. if blue < t.v or red < t.v then
  350. if(isPlayer(cid) == false) then
  351. return true
  352. end
  353. if((getPlayerStorageValue(cid, t.g) % 2) == 1) then
  354. doTeleportThing(cid, t.d_1)
  355. doSendMagicEffect(getCreaturePosition(cid), 10)
  356. doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
  357. doCreatureAddMana(cid, getCreatureMaxMana(cid))
  358. doPlayerRemoveLethalConditions(cid)
  359. if getCreatureSkullType(cid) == SKULL_WHITE then
  360. doCreatureSetSkullType(cid, 0)
  361. end
  362. else
  363. doTeleportThing(cid, t.d_2)
  364. doSendMagicEffect(getCreaturePosition(cid), 10)
  365. doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
  366. doCreatureAddMana(cid, getCreatureMaxMana(cid))
  367. doPlayerRemoveLethalConditions(cid)
  368. if getCreatureSkullType(cid) == SKULL_WHITE then
  369. doCreatureSetSkullType(cid, 0)
  370. end
  371. end
  372. end
  373. if blue >= t.v then
  374. doBroadcastMessage(t.y, MESSAGE_STATUS_WARNING)
  375. setGlobalStorageValue(t.h, 1)
  376. for _, pid in ipairs(getPlayersOnline()) do
  377. if(getPlayerStorageValue(pid, t.f_1) == 1) then
  378. doPlayerAddItem(pid, 2143, 50)
  379. end
  380. end
  381. elseif red >= t.v then
  382. doBroadcastMessage(t.o, MESSAGE_STATUS_WARNING)
  383. setGlobalStorageValue(t.h, 1)
  384. for _, pid in ipairs(getPlayersOnline()) do
  385. if(getPlayerStorageValue(pid, t.f_2) == 1) then
  386. doPlayerAddItem(pid, 2143, 50)
  387. end
  388. end
  389. end
  390. if getGlobalStorageValue(t.h) == 1 then
  391. setGlobalStorageValue(t.a, 0)
  392. setGlobalStorageValue(t.h, 0)
  393. setGlobalStorageValue(t.wv, -1)
  394. setPlayerStorageValue(cid, t.f, -1)
  395. setPlayerStorageValue(cid, t.g, 0)
  396. setPlayerStorageValue(cid, t.l, 0)
  397. setPlayerStorageValue(cid, t.u, 0)
  398. setPlayerStorageValue(cid, t.f_1, -1)
  399. setPlayerStorageValue(cid, t.f_2, -1)
  400. setPlayerStorageValue(cid, t.h, -1)
  401. doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
  402. doSendMagicEffect(getCreaturePosition(cid), 10)
  403. doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
  404. doCreatureAddMana(cid, getCreatureMaxMana(cid))
  405. doPlayerRemoveLethalConditions(cid)
  406. for _, pid in ipairs(getPlayersOnline()) do
  407. if(getPlayerStorageValue(pid, t.f_1) == 1 or getPlayerStorageValue(pid, t.f_2) == 1) then
  408. setPlayerStorageValue(pid, t.f, -1)
  409. doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
  410. doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
  411. setPlayerStorageValue(pid, t.g, 0)
  412. setPlayerStorageValue(pid, t.l, 0)
  413. setPlayerStorageValue(pid, t.u, 0)
  414. setPlayerStorageValue(pid, t.f_1, -1)
  415. setPlayerStorageValue(pid, t.f_2, -1)
  416. setPlayerStorageValue(pid, t.h, -1)
  417. doCreatureAddHealth(pid, getCreatureMaxHealth(pid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
  418. doCreatureAddMana(pid, getCreatureMaxMana(pid))
  419. doPlayerRemoveLethalConditions(pid)
  420. end
  421. end
  422. return false
  423. end
  424. return false
  425. end
  426. return true
  427. end
  428. ]]></event>
  429. <event type="outfit" name="RushOutfit" event="script"><![CDATA[
  430. domodlib('re')
  431. function onOutfit(cid, old, current)
  432. if(getGlobalStorageValue(t.a) == 1) then
  433. if getPlayerGroupId(cid) > 3 then
  434. return true
  435. end
  436. if getPlayerStorageValue(cid, t.h) == 0 then
  437. if getPlayerStorageValue(cid, t.f) > -1 then
  438. doPlayerSendCancel(cid, "You cannot change your outfit during the event.")
  439. return false
  440. end
  441. end
  442. end
  443. return true
  444. end
  445. ]]></event>
  446. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement