adrianoswatt

PrivateWar Sys CreatureScripts

May 17th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. local cfg = _PRIVATE_WAR_SYSTEM_CONFIG
  2. function onPrepareDeath(cid, deathList, mostDamageKiller)
  3.     if isPlayer(cid) then
  4.         team = getPlayerStorageValue(cid, cfg.gbet_sto)
  5.         lib = cfg.teamConfig[team]
  6.         if lib then
  7.             killer = deathList[1]
  8.             if not isPlayer(killer) then
  9.                 if isPlayer(getCreatureMaster(killer)) then
  10.                     killer = getCreatureMaster(killer)
  11.                 else
  12.                     return true
  13.                 end
  14.             end
  15.             ksto = getPlayerStorageValue(killer, cfg.gbet_sto)
  16.             klib = cfg.teamConfig[ksto]
  17.             if klib then
  18.                 life = getCreatureMaxHealth(cid)
  19.                 doCreatureAddHealth(cid, life, 0, 0, true)  -- Change to: doCreatureAddHealth(cid, life, true)
  20.                 --[[ Continuin' The Actions ]]--
  21.                 tkills = getGlobalStorageValue(klib.gsto_kills)
  22.                 kill_total = getGlobalStorageValue(cfg.gbet_sto)
  23.                 if (tkills + 1) >= kill_total then
  24.                     --[[ Event is Over ]]--
  25.                     doPrivWarEnd(cid, ksto, true)
  26.                 else
  27.                     setGlobalStorageValue(klib.gsto_kills, (tkills+1))
  28.                     doSendAnimatedText(getThingPos(cid), "[ "..(tkills+1).." / "..kill_total.." ]", COLOR_WHITE)
  29.                     doBroadcastPrivWar(killer, cid, ksto)
  30.                     doTeleportThing(cid, lib.basePos)
  31.                     print(''..getCreatureName(cid)..' ['..lib.tname..' Team] was been killed by '..getCreatureName(killer)..' ['..klib.tname..' Team].')
  32.                 end            
  33.                 return false
  34.             else
  35.                 return true
  36.             end
  37.         else
  38.             return true
  39.         end
  40.     end
  41. end
  42.  
  43. function onCombat(cid, target)
  44.     if isPlayer(cid) and isPlayer(target) then
  45.         cidsto, tarsto = getPlayerStorageValue(cid, cfg.gbet_sto), getPlayerStorageValue(target, cfg.gbet_sto)
  46.         if cidsto > 0 and tarsto > 0 then
  47.             if cidsto == tarsto then
  48.                 doPlayerSendCancel(cid, "You can't do dat.")
  49.                 return false
  50.             end
  51.         end
  52.     end
  53.     return true
  54. end
Advertisement
Add Comment
Please, Sign In to add comment