--[[ ###################################################### ###################################################### #### City War System #### #### Author: Maxwell Denisson(MaXwEllDeN) #### #### Version: 1.0 #### ###################################################### ###################################################### ]] local CW =_CITY_WAR_ function onStatsChange(cid, attacker, type, combat, value) if (type == STATSCHANGE_HEALTHGAIN) then return true end if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) and (getCreatureHealth(cid)-value <= 0) then if isPlayer(cid) and isCreature(attacker) then doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) if ((getPlayerStorageValue(cid, 317253) - 1 ) > -1) then setPlayerStorageValue(cid, 317253, getPlayerStorageValue(cid, 317253) - 1) end setPlayerStorageValue(attacker, 317253, getPlayerStorageValue(attacker, 317253) + 1) doSendAnimatedText(getThingPos(cid), "Owned!", math.random(200)) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) return false end end return true end function onLogout(cid) local team = getPlayerStorageValue(cid, CW.Sto_teams) if (team > 0) then setGlobalStorageValue(team, getGlobalStorageValue(team)-1) setPlayerStorageValue(cid, CW.Sto_teams, -1) doRemoveCondition(cid, CONDITION_OUTFIT) doPlayerSetTown(cid, getPlayerStorageValue(cid, 41753)) doTeleportThing(cid, getTownTemplePosition(getPlayerStorageValue(cid, 41753))) end return true end function onCombat(cid, target) if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) then local team = getPlayerStorageValue(cid, CW.Sto_teams) if (team == getPlayerStorageValue(target, CW.Sto_teams)) then return false end end return true end function onAttack(cid, target) if (getPlayerStorageValue(cid, CW.Sto_teams) > 0) then local team = getPlayerStorageValue(cid, CW.Sto_teams) if (team == getPlayerStorageValue(target, CW.Sto_teams)) then doPlayerSendCancel(cid, "Você não pode atacar alguém que é do mesmo time que o seu!") return false end end return true end