Advertisement
magdycapone

Mods / team battle

Jan 16th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 19.06 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mod name="Team Event" version="2.0" author="Damadgerz" contact="support@lualand.net" enabled="yes">
  3. <description>
  4.  
  5. Full auto Team BattleEvent(v2.0) for 0.4 :
  6.  
  7. 1- I currently rescripted this event from scratch again.
  8.  
  9. 2- This version is much more better than the one before, it is more cleaner, clearer and with more options.
  10.  
  11. 3- This version was tested on 0.4 latest one 4626, should work on lower rev too.
  12.  
  13. 4- Removed the npc part it is now based on tp creation.
  14.  
  15. 5- More silent boradcasting for in event progress and no spam, I hope!
  16.  
  17. 6- you now get the options to show event stats on cancel msg area and (to / not to) show left players with names each x interval.
  18.  
  19. 8- Team balancer have been added to only balance count in both teams.
  20.  
  21. 9- Added a countdown option before fight starts.
  22.  
  23. 10- Now starts on a defined time every day
  24.  
  25. </description>
  26.  
  27. <config name="teamSetting"><![CDATA[
  28. --[[Local Config]]--
  29.  
  30. --//storages
  31.  
  32. inBlue = 9900
  33. inRed = 9901
  34. joiner = 9907
  35.  
  36. blueKills = 9902
  37. redKills = 9903
  38.  
  39. eventRecruiting = 9904
  40. eventStarted = 9905
  41. eventTime = 9906
  42.  
  43. itemToGet = 9908
  44. countItemToGet = 9909
  45.  
  46. nextExecute = 9910
  47.  
  48. blueCount = 9911
  49. redCount = 9912
  50.  
  51. --// Positions
  52.  
  53. teleporterPosition = {x = 32384, y = 31908, z = 7} --Place where the event tp will be created
  54.  
  55. waitRoomPlace = {x = 32349, y = 32225, z = 3} --Place of the waitnig room (the place ppl will wait for team to be full)
  56.  
  57. waitRoomDimensions = { --Enter the start pos[top left sqm] and end pos[bottom right sqm] of waitnig room here
  58. startPos = {x = 32344, y = 32218, z = 3},
  59. endPos = {x = 32355, y = 32232, z = 3}
  60. }
  61.  
  62.  
  63. eventPlaceDimensions = { --Enter the start pos[top left sqm] and end pos[bottom right sqm] of event place here
  64. startPos = {x = 31291, y = 32331, z = 7},
  65. endPos = {x = 31483, y = 32482, z = 7}
  66. }
  67. blueTeamPos = {x = 31449, y = 32408, z = 7}
  68. redTeamPos = {x = 31326, y = 32408, z = 7}
  69.  
  70.  
  71. --// General settings
  72.  
  73. recruitTime = 3 -- Time in minutes to gather players to event, will broadcast event started each min
  74.  
  75. minimumPlayersJoins = 4 --If the number of layer joined is less than that then event would be cancelled
  76.  
  77. balanceTeams = true -- This will balance number of players in both teams the extra player will be kicked out of event
  78.  
  79.  
  80. removeTeleportOnEventEnd = false -- if you want to remove the tp when the event finish set it to true, normally tp will just be diabled
  81.  
  82. eventMaxTime = 20 -- Time in minutes, this is the max time event will be running. After checks are caried winner is declared
  83.  
  84. showEventSats = true -- This is like a timer that is always there about event stats (time,oponents left, teammates left). It appears in the cancel messages place.
  85.  
  86. sendLeftPlayers = true -- Well this will send to all alive players the names& numebr of the oponents left each interval defined down
  87. intervalToSendLeftPlayers = 11 -- interval(in seconds) to sendLeftPlayers , must be more than 10 sec
  88.  
  89.  
  90. countDownOnStart = true -- Well this occurs when players are teleported to their places in the arena , so if this is true it start to count down to the joined players then when count down finish they can start killing each other(event really begins)
  91.  
  92. countDownFrom = 10 -- Starts count down from this number when event start, if above is set true
  93.  
  94. minJoinLevel = 100 -- minimm lvl that can join event
  95.  
  96. rewards = { --Example [%] = { {itemid/name, count} ,..........} count isnt more than 100
  97.  
  98. [65] = { {10136,1} , {"10136",1} },
  99. [25] = { {"10136",1} , {10136,1} },
  100. [10] = { {"10136",1} , {"10136",1} }
  101. }
  102.  
  103. --[[ Note : make sure if you edited % that sum should be equal to 100, you can add more % elements to suit your needs also more items if you want in each %
  104. [65],[25],[10] -> is the % of this item to be found the rest is clear ,items in each % and it will be chosen randomly]]--
  105.  
  106.  
  107. ]]></config>
  108. <lib name="teamFunctions"><![CDATA[
  109. domodlib('teamSetting')
  110.  
  111. --[[Conditions don't touch]]--
  112. local bmale = createConditionObject(CONDITION_OUTFIT)
  113. setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)
  114. addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
  115.  
  116. local bfemale = createConditionObject(CONDITION_OUTFIT)
  117. setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)
  118. addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
  119.  
  120. local rmale = createConditionObject(CONDITION_OUTFIT)
  121. setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)
  122. addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
  123.  
  124. local rfemale = createConditionObject(CONDITION_OUTFIT)
  125. setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)
  126. addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
  127.  
  128. local infight = createConditionObject(CONDITION_INFIGHT,-1)
  129. --[[Local Config]]--
  130.  
  131. --[[Functions]]--
  132.  
  133. -- General info
  134. function isFightOn()
  135. return getStorage(eventStarted) > 0
  136. end
  137. function isRecruitOn()
  138. return getStorage(eventRecruiting) > 0
  139. end
  140. function getMinJoinLevel()
  141. return minJoinLevel
  142. end
  143. function getJoiners()
  144. joiners = {}
  145. for _,cid in ipairs(getPlayersOnline()) do
  146. if isJoiner(cid) then
  147. if isInRecruitArea(cid) or isInFightArea(cid) then
  148. table.insert(joiners,cid)
  149. end
  150. end
  151. end
  152. return joiners
  153. end
  154.  
  155. function getLeftMembersNames(team)
  156. str = "Oponents left("..#team..") :"
  157. left = ""
  158. for k,cid in ipairs(team) do left = (left ..""..(k == 1 and "" or ", ")..""..getCreatureName(cid).."["..getPlayerLevel(cid).."]" ) end
  159. str = str .." " .. (left == "" and "none" or left).. "."
  160. return str
  161. end
  162. function disPlayEventStats()
  163. if not showEventSats then return false end
  164. if getStorage(eventTime) - os.time() <= 0 then return false end
  165.  
  166. left = os.date("%M:%S",(getStorage(eventTime) - os.time()))
  167. for _,cid in ipairs(getJoiners()) do
  168. oponentsLeft = isBlue(cid) and #getRedMembers() or #getBlueMembers()
  169. teamMatesLeft = isBlue(cid) and math.max(0,#getBlueMembers()-1) or math.max(0,#getRedMembers()-1)
  170. doPlayerSendCancel(cid,"Time left: ".. left.." || Oponents left: "..oponentsLeft.."/"..oponentCount(cid).." || Team-mates left: "..teamMatesLeft.."/".. math.max(0,matesCount(cid)-1))
  171. end
  172.  
  173. end
  174.  
  175. function doSendLeftPlayers()
  176. if not sendLeftPlayers then return false end
  177. if intervalToSendLeftPlayers <= 10 then return false end
  178. for _,cid in ipairs(getJoiners()) do
  179. doPlayerSendTextMessage(cid,MESSAGE_TYPES["orange"],getLeftMembersNames(isRed(cid) and getBlueMembers() or getRedMembers()))
  180. end
  181. end
  182.  
  183. function getBlueMembers()
  184. members = {}
  185. for _,cid in ipairs(getPlayersOnline()) do
  186. if isBlue(cid) then
  187. table.insert(members,cid)
  188. end
  189. end
  190. return members
  191. end
  192. function getRedMembers()
  193. members = {}
  194. for _,cid in ipairs(getPlayersOnline()) do
  195. if isRed(cid) then
  196. table.insert(members,cid)
  197. end
  198. end
  199. return members
  200. end
  201.  
  202.  
  203. -- starting fight
  204.  
  205. function startRecruiting()
  206. doSetStorage(eventRecruiting,1)
  207. end
  208. function startEvent()
  209. doSetStorage(eventRecruiting,-1)
  210.  
  211. if removeTeleportOnEventEnd then
  212. tp = getTileItemById(teleporterPosition,1387).uid
  213. if tp > 0 then doRemoveItem(tp) end
  214. end
  215.  
  216. if not balanceTeams() then
  217. resetEvent()
  218. return false
  219. end
  220. for _,cid in ipairs(getBlueMembers()) do
  221. doTeleportThing(cid,blueTeamPos,false)
  222. doSendMagicEffect(getThingPos(cid),10)
  223. end
  224. setBlueCount(#getBlueMembers())
  225. for _,cid in ipairs(getRedMembers()) do
  226. doTeleportThing(cid,redTeamPos,false)
  227. doSendMagicEffect(getThingPos(cid),10)
  228. end
  229. setRedCount(#getRedMembers())
  230. startCountDown()
  231. return true
  232. end
  233.  
  234. function setBlueCount(count)
  235. doSetStorage(blueCount,-1)
  236. doSetStorage(blueCount,count)
  237. end
  238. function oponentCount(cid)
  239. return isBlue(cid) and getStorage(redCount) or getStorage(blueCount)
  240. end
  241. function matesCount(cid)
  242. return isBlue(cid) and getStorage(blueCount) or getStorage(redCount)
  243. end
  244.  
  245. function setRedCount(count)
  246. doSetStorage(redCount,-1)
  247. doSetStorage(redCount,count)
  248. end
  249. function balanceTeams()
  250. members = getJoiners()
  251. if #members < minimumPlayersJoins then
  252. doBroadcastMessage("Team-Battle event was cancelled as only ".. #members .. " players joined.")
  253. return false
  254. end
  255. if (math.mod(#members,2) ~= 0) then
  256. kicked = members[#members]
  257. clearTeamEventStorages(kicked)
  258. doPlayerSendTextMessage(kicked,MESSAGE_TYPES["info"],"Sorry, you have been kicked out of event for balancing both teams.")
  259. end
  260. count = 1
  261. for _,cid in ipairs(getJoiners()) do
  262. if (math.mod(count,2) ~= 0) then
  263. addToBlue(cid)
  264. else
  265. addToRed(cid)
  266. end
  267. count = count + 1
  268. end
  269. return true
  270. end
  271. function startCountDown()
  272. if(countDownOnStart) then
  273. for _,cid in ipairs(getJoiners()) do
  274. doCreatureSetNoMove(cid,true)
  275. for i = 0,countDownFrom do
  276. addEvent(doPlayerSendTextMessage,i*1000, cid, MESSAGE_TYPES["info"], (i == 0 and countDownFrom or countDownFrom-i) )
  277. end
  278. end
  279. addEvent(startFight,(countDownFrom+1)*1000)
  280. else
  281. startFight()
  282. end
  283. end
  284. function startFight()
  285. doSetStorage(eventStarted,1)
  286. for _,cid in ipairs(getJoiners()) do
  287. doCreatureSetNoMove(cid,false)
  288. doPlayerSendTextMessage(cid,MESSAGE_TYPES["warning"],"Fight Starts!")
  289. end
  290. addEvent(endTeamEvent,eventMaxTime*60*1000,"maxTime")
  291. doSetStorage(eventTime,os.time()+eventMaxTime*60)
  292. end
  293.  
  294. function teleportToWaitRoom(cid)
  295. doTeleportThing(cid,waitRoomPlace)
  296. doSendMagicEffect(waitRoomPlace,10)
  297. if getPlayerGroupId(cid) < 4 then
  298. addToJoiners(cid)
  299. end
  300. doPlayerSendTextMessage(cid,MESSAGE_TYPES["blue"],"Please be patient till the event starts and don't logout.")
  301. return true
  302. end
  303.  
  304.  
  305.  
  306. -- Modifing teams & checking member states
  307. function isBlue(cid)
  308. return (getPlayerStorageValue(cid,inBlue) > 0)
  309. end
  310. function isRed(cid)
  311. return (getPlayerStorageValue(cid,inRed) > 0)
  312. end
  313. function isJoiner(cid)
  314. return (getPlayerStorageValue(cid,joiner) > 0)
  315. end
  316. function addToBlue(cid)
  317. setPlayerStorageValue(cid,inBlue,1)
  318. doAddCondition(cid, (getPlayerSex(cid) == 1) and bmale or bfemale)
  319. doAddCondition(cid,infight)
  320. end
  321. function addToRed(cid)
  322. setPlayerStorageValue(cid,inRed,1)
  323. doAddCondition(cid, (getPlayerSex(cid) == 1) and rmale or rfemale)
  324. doAddCondition(cid,infight)
  325. end
  326. function addToJoiners(cid)
  327. setPlayerStorageValue(cid,joiner,1)
  328. end
  329. function removeFromBlue(cid)
  330. setPlayerStorageValue(cid,inBlue,-1)
  331. end
  332. function removeFromRed(cid)
  333. setPlayerStorageValue(cid,inRed,-1)
  334. end
  335. function removeFromjoiners(cid)
  336. setPlayerStorageValue(cid,joiner,-1)
  337. end
  338. function isInRecruitArea(cid)
  339. return isInRange(getThingPos(cid),waitRoomDimensions.startPos,waitRoomDimensions.endPos)
  340. end
  341. function isInFightArea(cid)
  342. return isInRange(getThingPos(cid),eventPlaceDimensions.startPos,eventPlaceDimensions.endPos)
  343. end
  344. function clearTeamEventStorages(cid)
  345. if isInRecruitArea(cid) or isInFightArea(cid) then
  346. doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
  347. doSendMagicEffect(getThingPos(cid),10)
  348. end
  349.  
  350. if isFightOn() then
  351. if isJoiner(cid) then
  352. if isBlue(cid) then
  353. addRedKills()
  354. elseif isRed(cid) then
  355. addBlueKills()
  356. end
  357. doPlayerSendTextMessage(cid,MESSAGE_TYPES["orange"],"You have died in Team-Battle Event.")
  358. end
  359. end
  360.  
  361. removeFromjoiners(cid)
  362. removeFromBlue(cid)
  363. removeFromRed(cid)
  364. doRemoveConditions(cid, false)
  365.  
  366. end
  367. function haveUnrecivedReward(cid)
  368. return getPlayerStorageValue(cid,itemToGet) > 0 and getPlayerStorageValue(cid,countItemToGet) > 0
  369. end
  370. function recieveLateReward(cid)
  371. if haveUnrecivedReward(cid) then
  372. if not doPlayerAddItem(cid,getPlayerStorageValue(cid,itemToGet),getPlayerStorageValue(cid,countItemToGet),false) then
  373. msg = "You need to free some space then relog to take your reward."
  374. doPlayerSendTextMessage(cid,MESSAGE_TYPES["warning"],msg)
  375. else
  376. setPlayerStorageValue(cid,itemToGet,-1)
  377. setPlayerStorageValue(cid,countItemToGet,-1)
  378. doPlayerSendTextMessage(cid,MESSAGE_TYPES["info"],"You have recieved your reward.")
  379. end
  380. end
  381. end
  382.  
  383. -- Win or lose
  384. function thereIsAWinner()
  385. if redWon() or blueWon() then
  386. return true
  387. end
  388. return false
  389. end
  390. function blueWon()
  391. return( (#getBlueMembers() > 0 ) and ( #getRedMembers() == 0) )
  392. end
  393. function redWon()
  394. return( (#getRedMembers() > 0) and (#getBlueMembers() == 0) )
  395. end
  396. function isDraw()
  397. return #getBlueMembers() == #getRedMembers()
  398. end
  399. function getWinner()
  400. if #getBlueMembers() > #getRedMembers() then
  401. return {getBlueMembers(),getRedMembers(),"Blue team won."}
  402. elseif #getRedMembers() > #getBlueMembers() then
  403. return {getRedMembers(),getBlueMembers(),"Red team won."}
  404. else
  405. return { {},{},"it was a draw."}
  406. end
  407. end
  408.  
  409.  
  410. -- Adding kills
  411. function addBlueKills()
  412. doSetStorage(blueKills, math.max(1,getStorage(blueKills)+1))
  413. end
  414. function addRedKills()
  415. doSetStorage(redKills, math.max(1,getStorage(redKills)+1))
  416. end
  417.  
  418. -- Ending event
  419.  
  420. function endTeamEvent(type)
  421. if isFightOn() then
  422. doSetStorage(eventStarted,-1)
  423. doBroadcastMessage("Team-Battle event ended and "..getWinner()[3])
  424. if not isDraw() then
  425. win(getWinner()[1],type)
  426. lose(getWinner()[2],type)
  427. else
  428. draw()
  429. end
  430. end
  431. addEvent(resetEvent,2 * 1000) --- tp player to home remove all storages and reset event global storages
  432. end
  433.  
  434. function getPercent()
  435. rand= math.random(1,100)
  436. prev = 0
  437. chosenItem = 0
  438. for k, v in pairs(rewards) do
  439. if rand > prev and rand <= k+prev then
  440. chosenItem = k
  441. break
  442. else
  443. prev = k+prev
  444. end
  445. end
  446. return chosenItem
  447. end
  448.  
  449. function generateReward(cid)
  450. percent = getPercent()
  451. if percent == 0 then
  452. print("Error in the reward item. Please inform Doggynub.")
  453. return true
  454. end
  455.  
  456. randomizer = rewards[percent][math.random(1,#rewards[percent])]
  457. item = not tonumber(randomizer[1]) and getItemIdByName(randomizer[1]) or randomizer[1]
  458. count = isItemStackable(item) and math.min(randomizer[2],100) or 1
  459. if item == nil or item == 0 then
  460. print("Error in the item format. Please inform Doggynub.")
  461. return true
  462. end
  463.  
  464. msg = "You have won ".. (count == 1 and "a" or count) .." " .. getItemNameById(item) .. "" .. (count == 1 and "" or "s").."."
  465.  
  466. if not doPlayerAddItem(cid,item,count,false) then
  467. msg = msg.. "You need to free some space then relog to take your reward."
  468. setPlayerStorageValue(cid,itemToGet,item)
  469. setPlayerStorageValue(cid,countItemToGet,count)
  470. end
  471.  
  472. doPlayerSendTextMessage(cid,MESSAGE_TYPES["white"],msg)
  473.  
  474. end
  475.  
  476.  
  477.  
  478. function generateStatsMessage(cid, type, stats)
  479. msg = {
  480. ["KO"] = { ["win"] = "Event ended. Your team have won by killing all oponent's team members. You will recieve your reward shortly, check incoming messages.",
  481. ["lose"] = "Event ended. Your team have lost as the Oponent team killed all your team's members."
  482. },
  483. ["maxTime"] = {
  484. ["win"] = "Event max-time finished and your team have won. You will recieve your reward shortly, check incoming messages.",
  485. ["lose"] = "Event max-time finished and your team have lost.",
  486. ["draw"] = "Event max-time finished and it is a draw.(no team won)"
  487. }
  488. }
  489. doPlayerSendTextMessage(cid,MESSAGE_TYPES["info"],msg[type][stats])
  490.  
  491. end
  492. function win(winners,type)
  493. for _,cid in ipairs(winners) do
  494. generateStatsMessage(cid, type, "win")
  495. generateReward(cid)
  496. end
  497. end
  498. function lose(losers,type)
  499. for _,cid in ipairs(losers) do
  500. generateStatsMessage(cid, type, "lose")
  501. end
  502. end
  503. function draw()
  504. for _,cid in ipairs(getJoiners()) do
  505. generateStatsMessage(cid, "maxTime", "draw")
  506. end
  507. end
  508.  
  509. function resetEvent()
  510. doSetStorage(eventRecruiting,-1)
  511. doSetStorage(nextExecute,-1)
  512. doSetStorage(eventStarted,-1)
  513. doSetStorage(eventTime,-1)
  514. doSetStorage(blueKills,-1)
  515. doSetStorage(redKills,-1)
  516. for _,cid in ipairs(getPlayersOnline()) do
  517. if isBlue(cid) or isRed(cid) or isJoiner(cid) then
  518. clearTeamEventStorages(cid)
  519. end
  520. end
  521. end
  522.  
  523.  
  524. ]]></lib>
  525. <event type="login" name="teambattleLogin" event="script"><![CDATA[
  526. domodlib('teamFunctions')
  527.  
  528. function onLogin(cid)
  529. clearTeamEventStorages(cid)
  530. recieveLateReward(cid)
  531.  
  532. registerCreatureEvent(cid, "teamEventStats")
  533. registerCreatureEvent(cid, "teambattleLogout")
  534. registerCreatureEvent(cid, "teambattleCombat")
  535. return true
  536. end
  537. ]]></event>
  538. <event type="combat" name="teambattleCombat" event="script"><![CDATA[
  539. domodlib('teamFunctions')
  540.  
  541. function onCombat(cid, target)
  542. if isFightOn() then
  543. if isBlue(cid) and isBlue(target) then
  544. return false
  545. end
  546. if isRed(cid) and isRed(target) then
  547. return false
  548. end
  549. end
  550. return true
  551. end
  552.  
  553. ]]></event>
  554. <event type="logout" name="teambattleLogout" event="script"><![CDATA[
  555. domodlib('teamFunctions')
  556.  
  557. function onLogout(cid)
  558. clearTeamEventStorages(cid)
  559. if thereIsAWinner() then
  560. endTeamEvent("KO")
  561. end
  562. return true
  563. end
  564.  
  565. ]]></event>
  566. <event type="statschange" name="teamEventStats" event="script"><![CDATA[
  567. domodlib('teamFunctions')
  568.  
  569. corpse_ids = {
  570. [0] = 3065, -- female
  571. [1] = 3058 -- male
  572. }
  573. function onStatsChange(cid, attacker, type, combat, value)
  574. if combat == COMBAT_HEALING then
  575. return true
  576. end
  577. if getCreatureHealth(cid) > value then
  578. return true
  579. end
  580.  
  581. if isInFightArea(cid) and isFightOn() then
  582. if isBlue(cid) or isRed(cid) then
  583. corpse = doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid))
  584. doCreateItem(2016, 2, getThingPos(cid))
  585. clearTeamEventStorages(cid)
  586. doItemSetAttribute(corpse, "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[Team-Event kill]")
  587. doCreatureAddHealth(cid,getCreatureMaxHealth(cid))
  588. if thereIsAWinner() then
  589. endTeamEvent("KO")
  590. end
  591.  
  592. return false
  593.  
  594. end
  595.  
  596. end
  597.  
  598. return true
  599. end
  600. ]]></event>
  601.  
  602. <globalevent name = "teamBattleStart" time="12:58:00" event="script"><![CDATA[
  603. domodlib('teamFunctions')
  604.  
  605. function onTime()
  606. resetEvent()
  607. if getTileItemById(teleporterPosition,1387).uid < 1 then
  608. tp = doCreateItem(1387,1,teleporterPosition)
  609. doItemSetAttribute(tp, "aid", 9990)
  610. end
  611.  
  612. startRecruiting()
  613. for i = 0, recruitTime-1 do
  614. addEvent(doBroadcastMessage, i * 60* 1000,"Team-Battle event is Open recruting players by entering event tp From depot thais event room. Fight begins in "..(i == 0 and recruitTime or recruitTime-i).." minutes.",MESSAGE_TYPES["warning"])
  615. end
  616.  
  617. addEvent(startEvent, recruitTime * 60 * 1000)
  618.  
  619. return true
  620. end
  621.  
  622.  
  623. ]]></globalevent>
  624.  
  625. <globalevent name = "teamBattletime" interval="1" event="script"><![CDATA[
  626. domodlib('teamFunctions')
  627.  
  628. function onThink()
  629. if isFightOn() then
  630. disPlayEventStats()
  631.  
  632. if getStorage(nextExecute) == -1 or getStorage(nextExecute) <= os.time() then
  633. doSendLeftPlayers()
  634. doSetStorage(nextExecute,os.time()+intervalToSendLeftPlayers)
  635. end
  636. end
  637. return true
  638. end
  639.  
  640. ]]></globalevent>
  641. <movevent type="StepIn" actionid="9990" event="script"><![CDATA[
  642. domodlib('teamFunctions')
  643.  
  644. function onStepIn(cid, item, position, fromPosition)
  645. if not isRecruitOn() then
  646. doPlayerSendTextMessage(cid,MESSAGE_TYPES["orange"],"Team Battle Event isn't currently opened.")
  647. doTeleportThing(cid,fromPosition)
  648. doSendMagicEffect(fromPosition,2)
  649. return true
  650. end
  651. if getPlayerLevel(cid) < getMinJoinLevel() then
  652. doPlayerSendTextMessage(cid,MESSAGE_TYPES["orange"],"Only players of level ".. getMinJoinLevel().. "+ can join this event.")
  653. doTeleportThing(cid,fromPosition)
  654. return true
  655. end
  656. teleportToWaitRoom(cid)
  657. return true
  658. end
  659.  
  660.  
  661.  
  662.  
  663. ]]> </movevent>
  664. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement