Guest User

Untitled

a guest
Jan 29th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. function onLogin(player)
  2.     player:registerEvent("battledeath")
  3.     if Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then
  4.         Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
  5.         Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
  6.         Game.setStorageValue(_Lib_Battle_Info.storage_count, 0)
  7.     end
  8.     if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
  9.         player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1)
  10.         player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1)
  11.         player:teleportTo(player:getTown():getTemplePosition())
  12.     end
  13.     return true
  14. end
  15.  
  16. function onPrepareDeath(creature, lastHitKiller, mostDamageKiller)
  17.     if creature:isPlayer() and creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or creature:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
  18.         local MyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage
  19.         local EnemyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamTwo.storage or _Lib_Battle_Info.TeamOne.storage
  20.         Game.setStorageValue(MyTeam, (Game.getStorageValue(MyTeam)-1))
  21.         creature:sendTextMessage(MESSAGE_INFO_DESCR, "[BattleField] You are dead.")
  22.         creature:setStorageValue(MyTeam, -1)
  23.         creature:removeCondition(CONDITION_OUTFIT)
  24.         if Game.getStorageValue(MyTeam) == 0 then
  25.             getWinnersBattle(EnemyTeam)
  26.         else
  27.             doBroadCastBattle(23, "[BattleField] " .. _Lib_Battle_Info.TeamOne.name .. " " .. Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) .. " VS " .. Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage) .. " " .._Lib_Battle_Info.TeamTwo.name)
  28.         end
  29.     end
  30.     return true
  31. end
Advertisement
Add Comment
Please, Sign In to add comment