Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 22nd, 2012  |  syntax: Lua  |  size: 2.27 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --[[
  2. ######################################################
  3. ######################################################
  4. ####            City War System                                           ####
  5. ####            Author: Maxwell Denisson(MaXwEllDeN)  ####
  6. ####            Version: 1.0                                              ####
  7. ######################################################
  8. ######################################################
  9. ]]
  10. local CW =_CITY_WAR_
  11.  
  12. function onStatsChange(cid, attacker, type, combat, value)
  13.    if (type == STATSCHANGE_HEALTHGAIN) then
  14.                 return true
  15.    end
  16.  
  17.    if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) and (getCreatureHealth(cid)-value <= 0) then
  18.       if isPlayer(cid) and isCreature(attacker) then
  19.                 doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  20.                 doCreatureAddMana(cid, getCreatureMaxMana(cid))
  21.  
  22.                 if ((getPlayerStorageValue(cid, 317253) - 1 ) > -1) then
  23.                         setPlayerStorageValue(cid, 317253, getPlayerStorageValue(cid, 317253) - 1)
  24.                 end
  25.  
  26.                 setPlayerStorageValue(attacker, 317253, getPlayerStorageValue(attacker, 317253) + 1)
  27.                 doSendAnimatedText(getThingPos(cid), "Owned!", math.random(200))
  28.                 doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
  29.                 return false
  30.       end
  31.    end
  32.    return true
  33. end
  34.  
  35. function onLogout(cid)
  36.  
  37.    local team = getPlayerStorageValue(cid, CW.Sto_teams)
  38.  
  39.    if (team > 0) then
  40.       setGlobalStorageValue(team, getGlobalStorageValue(team)-1)
  41.       setPlayerStorageValue(cid, CW.Sto_teams, -1)
  42.  
  43.       doRemoveCondition(cid, CONDITION_OUTFIT)
  44.       doPlayerSetTown(cid, getPlayerStorageValue(cid, 41753))
  45.       doTeleportThing(cid, getTownTemplePosition(getPlayerStorageValue(cid, 41753)))
  46.    end
  47.    return true
  48. end
  49.  
  50. function onCombat(cid, target)
  51.  
  52.    if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) then
  53.       local team = getPlayerStorageValue(cid, CW.Sto_teams)
  54.       if (team == getPlayerStorageValue(target, CW.Sto_teams)) then
  55.          return false
  56.       end
  57.    end
  58.    return true
  59. end
  60.  
  61. function onAttack(cid, target)
  62.  
  63.    if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) then
  64.       local team = getPlayerStorageValue(cid, CW.Sto_teams)
  65.       if (team == getPlayerStorageValue(target, CW.Sto_teams)) then
  66.          doPlayerSendCancel(cid, "Você não pode atacar alguém que é do mesmo time que o seu!")
  67.          return false
  68.       end
  69.    end
  70.    return true
  71. end
clone this paste RAW Paste Data