Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Conquest 2.0
- -- The object of the game is to take control of the opponent's base before they take control of yours.
- -- You regain control of your own base by standing in it unopposed and take control from the opposing base by standing in it unopposed.
- -- If at any point one team's control percentage is 0%, the other team wins.
- -- There are also optional special items around the map: an oddball and a flagpole. The oddball is called the Ball of Faith; the flagpole is called the Staff of Influence.
- -- One who holds the Ball of Faith gives extra regeneration to their own base and increases the maximum control percentage of their base while the holder stands in their own control sphere.
- -- One who holds the Staff of Influence takes extra control from the opponent's base while standing in it.
- -- I've written this script intentionally to make it easy for inexperienced scripters to edit and flexible for more experienced scripters to customize.
- -- If any of my comments are confusing, or you have any questions about how the script works, you can PM me (Nuggets) at phasor.proboards.com
- function GetRequiredVersion()
- return 10059
- end
- function OnScriptLoad(processId)
- -- Respawn Time --
- respawn_time = 7 -- Player respawn time in seconds.
- -- Teams Table --
- teams = {} -- Stores attributes about each team's base
- teams[0] = {} -- Team 0 (Red)
- teams[1] = {} -- Team 1 (Blue)
- -- Starting Percentages of Control --
- -- Team: Percent: Description:
- teams[0].start = 75 -- Amount of control the Red Team has over their own base at the beginning of the game.
- teams[1].start = 75 -- Amount of control the Blue Team has over their own base at the beginning of the game.
- -- Maximum Percentages of Control --
- -- Team: Percent: Description:
- teams[0].max = 100 -- Maximum control the Red Team can have over their own base.
- teams[1].max = 100 -- Maximum control the Blue Team can have over their own base.
- -- Sphere of Control Coordinates --
- -- Team: Coordinates: Description:
- teams[0].center = nil -- Centered coordinates of Red Team's control sphere {x, y, z} (use nil to default to centering around the CTF flag spawn).
- teams[1].center = nil -- Centered coordinates of Blue Team's control sphere {x, y, z} (use nil to default to centering around the CTF flag spawn).
- -- Control Sphere Radius --
- -- Team: Radius: Description:
- teams[0].radius = nil -- Radius of control sphere centered at Red Base CTF flag spawn (use nil to default to value of current map as defined below in Control Sphere Radius by Map).
- teams[1].radius = nil -- Radius of control sphere centered at Blue Base CTF flag spawn (use nil to default to value of current map as defined below in Control Sphere Radius by Map).
- -- Team Influence and Faith --
- -- Influence and Faith are values which define how much a team can change a control sphere's percentage by standing inside of it.
- -- Note that by default, these values are not dependent on the amount of players within a control sphere.
- -- If you want additional players to increase (or decrease) influence and faith, see "Presence".
- -- Team: Percent/Second: Description:
- teams[0].influence = 2.00 -- Percent of control per second a Red Team player will take from Blue Base.
- teams[1].influence = 2.00 -- Percent of control per second a Blue Team player will take from Red Base.
- teams[0].faith = 2.00 -- Percent of control per second a Red Team player will add to their own base.
- teams[1].faith = 2.00 -- Percent of control per second a Blue Team player will add to their own base.
- -- Presence --
- -- Team: Bonus: Description:
- teams[0].presence = 0.50 -- Bonus influence or faith applied per additional player of the Red Team within a control sphere (set to 0 if influence and faith should be the same no matter how many players are within a control sphere).
- teams[1].presence = 0.50 -- Bonus influence or faith applied per additional player of the Blue Team within a control sphere (set to 0 if influence and faith should be the same no matter how many players are within a control sphere).
- -- Control Sphere Radius by Map --
- radius = {} -- Stores information regarding control sphere radii of each team depending on the map currently running.
- radius[0] = {} -- Radius of Red Base control spheres.
- radius[1] = {} -- Radius of Blue Base control spheres.
- -- Team: Map: Radius: Description:
- radius[0].beavercreek = 4.00 -- Radius of Red Base control sphere in beavercreek.
- radius[1].beavercreek = 4.00 -- Radius of Blue Base control sphere in beavercreek.
- radius[0].bloodgulch = 5.75 -- Radius of Red Base control sphere in bloodgulch.
- radius[1].bloodgulch = 5.75 -- Radius of Blue Base control sphere in bloodgulch.
- radius[0].boardingaction = 6.00 -- Radius of Red Base control sphere in boardingaction.
- radius[1].boardingaction = 6.00 -- Radius of Blue Base control sphere in boardingaction.
- radius[0].carousel = 4.50 -- Radius of Red Base control sphere in carousel.
- radius[1].carousel = 4.50 -- Radius of Blue Base control sphere in carousel.
- radius[0].chillout = 6.00 -- Radius of Red Base control sphere in chillout.
- radius[1].chillout = 6.00 -- Radius of Blue Base control sphere in chillout.
- radius[0].damnation = 7.00 -- Radius of Red Base control sphere in damnation.
- radius[1].damnation = 7.00 -- Radius of Blue Base control sphere in damnation.
- radius[0].dangercanyon = 6.00 -- Radius of Red Base control sphere in dangercanyon.
- radius[1].dangercanyon = 6.00 -- Radius of Blue Base control sphere in dangercanyon.
- radius[0].deathisland = 10.00 -- Radius of Red Base control sphere in deathisland.
- radius[1].deathisland = 10.00 -- Radius of Blue Base control sphere in deathisland.
- radius[0].gephyrophobia = 10.00 -- Radius of Red Base control sphere in gephyrophobia.
- radius[1].gephyrophobia = 10.00 -- Radius of Blue Base control sphere in gephyrophobia.
- radius[0].hangemhigh = 6.50 -- Radius of Red Base control sphere in hangemhigh.
- radius[1].hangemhigh = 6.50 -- Radius of Blue Base control sphere in hangemhigh.
- radius[0].icefields = 3.50 -- Radius of Red Base control sphere in icefields.
- radius[1].icefields = 3.50 -- Radius of Blue Base control sphere in icefields.
- radius[0].infinity = 6.00 -- Radius of Red Base control sphere in infinity.
- radius[1].infinity = 6.00 -- Radius of Blue Base control sphere in infinity.
- radius[0].longest = 4.00 -- Radius of Red Base control sphere in longest.
- radius[1].longest = 4.00 -- Radius of Blue Base control sphere in longest.
- radius[0].prisoner = 4.00 -- Radius of Red Base control sphere in prisoner.
- radius[1].prisoner = 4.00 -- Radius of Blue Base control sphere in prisoner.
- radius[0].putput = 5.00 -- Radius of Red Base control sphere in putput.
- radius[1].putput = 8.00 -- Radius of Blue Base control sphere in putput.
- radius[0].ratrace = 5.50 -- Radius of Red Base control sphere in ratrace.
- radius[1].ratrace = 5.50 -- Radius of Blue Base control sphere in ratrace.
- radius[0].sidewinder = 14.00 -- Radius of Red Base control sphere in sidewinder.
- radius[1].sidewinder = 14.00 -- Radius of Blue Base control sphere in sidewinder.
- radius[0].timberland = 14.00 -- Radius of Red Base control sphere in timberland.
- radius[1].timberland = 14.00 -- Radius of Blue base control sphere in timberland.
- radius[0].wizard = 5.00 -- Radius of Red Base control sphere in wizard.
- radius[1].wizard = 5.00 -- Radius of Blue Base control sphere in wizard.
- -- Control Sphere Exceptions by Map --
- except = {} -- Creates exceptions to the control sphere using highest and lowest x, y, and z coordinates the sphere can occupy.
- -- Any part of the sphere outside of these coordinates will be considered outside of the sphere.
- -- Use nil if there should be no exception to the sphere in the specific direction.
- except[0] = {} -- Sphere exceptions for the red team.
- except[1] = {} -- Sphere exceptions for the blue team.
- -- Don't edit the code below --
- for k,v in pairs(radius[0]) do
- except[0][k] = {}
- except[1][k] = {}
- end
- -- Don't edit the code above --
- -- Team: Map: Coord High/Low: Coordinate: Description:
- except[0].beavercreek.xlow = 27.20 -- Lowest X coordinate considered to be in the Red Base control sphere in beavercreek.
- except[0].beavercreek.xhigh = 30.50 -- Highest X coordinate considered to be in the Red Base control sphere in beavercreek.
- except[0].beavercreek.ylow = 9.90 -- Lowest Y coordinate considered to be in the Red Base control sphere in beavercreek.
- except[0].beavercreek.yhigh = 17.40 -- Highest Y coordinate considered to be in the Red Base control sphere in beavercreek.
- except[0].beavercreek.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in beavercreek.
- except[0].beavercreek.zhigh = 1.90 -- Highest Z coordinate considered to be in the Red Base control sphere in beavercreek.
- except[1].beavercreek.xlow = -2.70 -- Lowest X coordinate considered to be in the Blue Base control sphere in beavercreek.
- except[1].beavercreek.xhigh = 1.03 -- Highest X coordinate considered to be in the Blue base control sphere in beavercreek.
- except[1].beavercreek.ylow = 9.90 -- Lowest Y coordinate considered to be in the Blue Base control sphere in beavercreek.
- except[1].beavercreek.yhigh = 17.40 -- Highest Y coordinate considered to be in the Blue Base control sphere in beavercreek.
- except[1].beavercreek.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in beavercreek.
- except[1].beavercreek.zhigh = 1.90 -- Highest Z coordinate considered to be in the Blue Base control sphere in beavercreek.
- except[0].bloodgulch.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[0].bloodgulch.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[0].bloodgulch.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[0].bloodgulch.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[0].bloodgulch.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[0].bloodgulch.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in bloodgulch.
- except[1].bloodgulch.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in bloodgulch.
- except[1].bloodgulch.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in bloodgulch.
- except[1].bloodgulch.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in bloodgulch.
- except[1].bloodgulch.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in bloodgulch.
- except[1].bloodgulch.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in bloodgulch.
- except[1].bloodgulch.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in bloodgulch.
- except[0].boardingaction.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in boardingaction.
- except[0].boardingaction.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in boardingaction.
- except[0].boardingaction.ylow = -3.7 -- Lowest Y coordinate considered to be in the Red Base control sphere in boardingaction.
- except[0].boardingaction.yhigh = 4.60 -- Highest Y coordinate considered to be in the Red Base control sphere in boardingaction.
- except[0].boardingaction.zlow = -0.20 -- Lowest Z coordinate considered to be in the Red Base control sphere in boardingaction.
- except[0].boardingaction.zhigh = 2.30 -- Highest Z coordinate considered to be in the Red Base control sphere in boardingaction.
- except[1].boardingaction.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in boardingaction.
- except[1].boardingaction.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in boardingaction.
- except[1].boardingaction.ylow = -4.50 -- Lowest Y coordinate considered to be in the Blue Base control sphere in boardingaction.
- except[1].boardingaction.yhigh = 3.74 -- Highest Y coordinate considered to be in the Blue Base control sphere in boardingaction.
- except[1].boardingaction.zlow = -0.20 -- Lowest Z coordinate considered to be in the Blue Base control sphere in boardingaction.
- except[1].boardingaction.zhigh = 2.30 -- Highest Z coordinate considered to be in the Blue Base control sphere in boardingaction.
- except[0].carousel.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in carousel.
- except[0].carousel.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in carousel.
- except[0].carousel.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in carousel.
- except[0].carousel.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in carousel.
- except[0].carousel.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in carousel.
- except[0].carousel.zhigh = -1.30 -- Highest Z coordinate considered to be in the Red Base control sphere in carousel.
- except[1].carousel.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in carousel.
- except[1].carousel.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in carousel.
- except[1].carousel.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in carousel.
- except[1].carousel.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in carousel.
- except[1].carousel.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in carousel.
- except[1].carousel.zhigh = -1.30 -- Highest Z coordinate considered to be in the Blue Base control sphere in carousel.
- except[0].chillout.xlow = 5.60 -- Lowest X coordinate considered to be in the Red Base control sphere in chillout.
- except[0].chillout.xhigh = 11.20 -- Highest X coordinate considered to be in the Red Base control sphere in chillout.
- except[0].chillout.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in chillout.
- except[0].chillout.yhigh = 1.40 -- Highest Y coordinate considered to be in the Red Base control sphere in chillout.
- except[0].chillout.zlow = 1.80 -- Lowest Z coordinate considered to be in the Red Base control sphere in chillout.
- except[0].chillout.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in chillout.
- except[1].chillout.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in chillout.
- except[1].chillout.xhigh = -2.50 -- Highest X coordinate considered to be in the Blue base control sphere in chillout.
- except[1].chillout.ylow = 2.90 -- Lowest Y coordinate considered to be in the Blue Base control sphere in chillout.
- except[1].chillout.yhigh = 10.90 -- Highest Y coordinate considered to be in the Blue Base control sphere in chillout.
- except[1].chillout.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in chillout.
- except[1].chillout.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in chillout.
- except[0].damnation.xlow = 4.70 -- Lowest X coordinate considered to be in the Red Base control sphere in damnation.
- except[0].damnation.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in damnation.
- except[0].damnation.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in damnation.
- except[0].damnation.yhigh = -7.04 -- Highest Y coordinate considered to be in the Red Base control sphere in damnation.
- except[0].damnation.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in damnation.
- except[0].damnation.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in damnation.
- except[1].damnation.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in damnation.
- except[1].damnation.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in damnation.
- except[1].damnation.ylow = 9.20 -- Lowest Y coordinate considered to be in the Blue Base control sphere in damnation.
- except[1].damnation.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in damnation.
- except[1].damnation.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in damnation.
- except[1].damnation.zhigh = 2.90 -- Highest Z coordinate considered to be in the Blue Base control sphere in damnation.
- except[0].dangercanyon.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[0].dangercanyon.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[0].dangercanyon.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[0].dangercanyon.yhigh = 2.70 -- Highest Y coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[0].dangercanyon.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[0].dangercanyon.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in dangercanyon.
- except[1].dangercanyon.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in dangercanyon.
- except[1].dangercanyon.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in dangercanyon.
- except[1].dangercanyon.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in dangercanyon.
- except[1].dangercanyon.yhigh = 2.70 -- Highest Y coordinate considered to be in the Blue Base control sphere in dangercanyon.
- except[1].dangercanyon.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in dangercanyon.
- except[1].dangercanyon.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in dangercanyon.
- except[0].deathisland.xlow = -27.50 -- Lowest X coordinate considered to be in the Red Base control sphere in deathisland.
- except[0].deathisland.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in deathisland.
- except[0].deathisland.ylow = -10.50 -- Lowest Y coordinate considered to be in the Red Base control sphere in deathisland.
- except[0].deathisland.yhigh = -3.75 -- Highest Y coordinate considered to be in the Red Base control sphere in deathisland.
- except[0].deathisland.zlow = 9.00 -- Lowest Z coordinate considered to be in the Red Base control sphere in deathisland.
- except[0].deathisland.zhigh = 11.10 -- Highest Z coordinate considered to be in the Red Base control sphere in deathisland.
- except[1].deathisland.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in deathisland.
- except[1].deathisland.xhigh = 30.60 -- Highest X coordinate considered to be in the Blue base control sphere in deathisland.
- except[1].deathisland.ylow = 12.80 -- Lowest Y coordinate considered to be in the Blue Base control sphere in deathisland.
- except[1].deathisland.yhigh = 19.30 -- Highest Y coordinate considered to be in the Blue Base control sphere in deathisland.
- except[1].deathisland.zlow = 7.70 -- Lowest Z coordinate considered to be in the Blue Base control sphere in deathisland.
- except[1].deathisland.zhigh = 9.80 -- Highest Z coordinate considered to be in the Blue Base control sphere in deathisland.
- except[0].gephyrophobia.xlow = 22.45 -- Lowest X coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[0].gephyrophobia.xhigh = 31.23 -- Highest X coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[0].gephyrophobia.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[0].gephyrophobia.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[0].gephyrophobia.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[0].gephyrophobia.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in gephyrophobia.
- except[1].gephyrophobia.xlow = 22.45 -- Lowest X coordinate considered to be in the Blue Base control sphere in gephyrophobia.
- except[1].gephyrophobia.xhigh = 31.23 -- Highest X coordinate considered to be in the Blue base control sphere in gephyrophobia.
- except[1].gephyrophobia.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in gephyrophobia.
- except[1].gephyrophobia.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in gephyrophobia.
- except[1].gephyrophobia.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in gephyrophobia.
- except[1].gephyrophobia.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in gephyrophobia.
- except[0].hangemhigh.xlow = 11.50 -- Lowest X coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[0].hangemhigh.xhigh = 17.50 -- Highest X coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[0].hangemhigh.ylow = 7.50 -- Lowest Y coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[0].hangemhigh.yhigh = 11.50 -- Highest Y coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[0].hangemhigh.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[0].hangemhigh.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in hangemhigh.
- except[1].hangemhigh.xlow = 27.20 -- Lowest X coordinate considered to be in the Blue Base control sphere in hangemhigh.
- except[1].hangemhigh.xhigh = 33.60 -- Highest X coordinate considered to be in the Blue base control sphere in hangemhigh.
- except[1].hangemhigh.ylow = -17.79 -- Lowest Y coordinate considered to be in the Blue Base control sphere in hangemhigh.
- except[1].hangemhigh.yhigh = -12.50 -- Highest Y coordinate considered to be in the Blue Base control sphere in hangemhigh.
- except[1].hangemhigh.zlow = -3.5 -- Lowest Z coordinate considered to be in the Blue Base control sphere in hangemhigh.
- except[1].hangemhigh.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in hangemhigh.
- except[0].icefields.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in icefields.
- except[0].icefields.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in icefields.
- except[0].icefields.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in icefields.
- except[0].icefields.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in icefields.
- except[0].icefields.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in icefields.
- except[0].icefields.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in icefields.
- except[1].icefields.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in icefields.
- except[1].icefields.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in icefields.
- except[1].icefields.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in icefields.
- except[1].icefields.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in icefields.
- except[1].icefields.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in icefields.
- except[1].icefields.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in icefields.
- except[0].infinity.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in infinity.
- except[0].infinity.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in infinity.
- except[0].infinity.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in infinity.
- except[0].infinity.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in infinity.
- except[0].infinity.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in infinity.
- except[0].infinity.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in infinity.
- except[1].infinity.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in infinity.
- except[1].infinity.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in infinity.
- except[1].infinity.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in infinity.
- except[1].infinity.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in infinity.
- except[1].infinity.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in infinity.
- except[1].infinity.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in infinity.
- except[0].longest.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in longest.
- except[0].longest.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in longest.
- except[0].longest.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in longest.
- except[0].longest.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in longest.
- except[0].longest.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in longest.
- except[0].longest.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in longest.
- except[1].longest.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in longest.
- except[1].longest.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in longest.
- except[1].longest.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in longest.
- except[1].longest.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in longest.
- except[1].longest.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in longest.
- except[1].longest.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in longest.
- except[0].prisoner.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in prisoner.
- except[0].prisoner.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in prisoner.
- except[0].prisoner.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in prisoner.
- except[0].prisoner.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in prisoner.
- except[0].prisoner.zlow = 5.00 -- Lowest Z coordinate considered to be in the Red Base control sphere in prisoner.
- except[0].prisoner.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in prisoner.
- except[1].prisoner.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in prisoner.
- except[1].prisoner.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in prisoner.
- except[1].prisoner.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in prisoner.
- except[1].prisoner.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in prisoner.
- except[1].prisoner.zlow = 5.00 -- Lowest Z coordinate considered to be in the Blue Base control sphere in prisoner.
- except[1].prisoner.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in prisoner.
- except[0].putput.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in putput.
- except[0].putput.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in putput.
- except[0].putput.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in putput.
- except[0].putput.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in putput.
- except[0].putput.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in putput.
- except[0].putput.zhigh = 1.90 -- Highest Z coordinate considered to be in the Red Base control sphere in putput.
- except[1].putput.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in putput.
- except[1].putput.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in putput.
- except[1].putput.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in putput.
- except[1].putput.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in putput.
- except[1].putput.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in putput.
- except[1].putput.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in putput.
- except[0].ratrace.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in ratrace.
- except[0].ratrace.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in ratrace.
- except[0].ratrace.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in ratrace.
- except[0].ratrace.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in ratrace.
- except[0].ratrace.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in ratrace.
- except[0].ratrace.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in ratrace.
- except[1].ratrace.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in ratrace.
- except[1].ratrace.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in ratrace.
- except[1].ratrace.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in ratrace.
- except[1].ratrace.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in ratrace.
- except[1].ratrace.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in ratrace.
- except[1].ratrace.zhigh = -1.60 -- Highest Z coordinate considered to be in the Blue Base control sphere in ratrace.
- except[0].sidewinder.xlow = -34.65 -- Lowest X coordinate considered to be in the Red Base control sphere in sidewinder.
- except[0].sidewinder.xhigh = -29.51 -- Highest X coordinate considered to be in the Red Base control sphere in sidewinder.
- except[0].sidewinder.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in sidewinder.
- except[0].sidewinder.yhigh = -29.7 -- Highest Y coordinate considered to be in the Red Base control sphere in sidewinder.
- except[0].sidewinder.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in sidewinder.
- except[0].sidewinder.zhigh = -2.48 -- Highest Z coordinate considered to be in the Red Base control sphere in sidewinder.
- except[1].sidewinder.xlow = 27.75 -- Lowest X coordinate considered to be in the Blue Base control sphere in sidewinder.
- except[1].sidewinder.xhigh = 32.93 -- Highest X coordinate considered to be in the Blue base control sphere in sidewinder.
- except[1].sidewinder.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in sidewinder.
- except[1].sidewinder.yhigh = -34.5 -- Highest Y coordinate considered to be in the Blue Base control sphere in sidewinder.
- except[1].sidewinder.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in sidewinder.
- except[1].sidewinder.zhigh = -2.78 -- Highest Z coordinate considered to be in the Blue Base control sphere in sidewinder.
- except[0].timberland.xlow = 14.70 -- Lowest X coordinate considered to be in the Red Base control sphere in timberland.
- except[0].timberland.xhigh = 19.90 -- Highest X coordinate considered to be in the Red Base control sphere in timberland.
- except[0].timberland.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in timberland.
- except[0].timberland.yhigh = -49.15 -- Highest Y coordinate considered to be in the Red Base control sphere in timberland.
- except[0].timberland.zlow = nil -- Lowest Z coordinate considered to be in the Red Base control sphere in timberland.
- except[0].timberland.zhigh = -16.90 -- Highest Z coordinate considered to be in the Red Base control sphere in timberland.
- except[1].timberland.xlow = -18.96 -- Lowest X coordinate considered to be in the Blue Base control sphere in timberland.
- except[1].timberland.xhigh = -13.76 -- Highest X coordinate considered to be in the Blue base control sphere in timberland.
- except[1].timberland.ylow = 48.70 -- Lowest Y coordinate considered to be in the Blue Base control sphere in timberland.
- except[1].timberland.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in timberland.
- except[1].timberland.zlow = nil -- Lowest Z coordinate considered to be in the Blue Base control sphere in timberland.
- except[1].timberland.zhigh = -16.90 -- Highest Z coordinate considered to be in the Blue Base control sphere in timberland.
- except[0].wizard.xlow = nil -- Lowest X coordinate considered to be in the Red Base control sphere in wizard.
- except[0].wizard.xhigh = nil -- Highest X coordinate considered to be in the Red Base control sphere in wizard.
- except[0].wizard.ylow = nil -- Lowest Y coordinate considered to be in the Red Base control sphere in wizard.
- except[0].wizard.yhigh = nil -- Highest Y coordinate considered to be in the Red Base control sphere in wizard.
- except[0].wizard.zlow = -3.15 -- Lowest Z coordinate considered to be in the Red Base control sphere in wizard.
- except[0].wizard.zhigh = nil -- Highest Z coordinate considered to be in the Red Base control sphere in wizard.
- except[1].wizard.xlow = nil -- Lowest X coordinate considered to be in the Blue Base control sphere in wizard.
- except[1].wizard.xhigh = nil -- Highest X coordinate considered to be in the Blue base control sphere in wizard.
- except[1].wizard.ylow = nil -- Lowest Y coordinate considered to be in the Blue Base control sphere in wizard.
- except[1].wizard.yhigh = nil -- Highest Y coordinate considered to be in the Blue Base control sphere in wizard.
- except[1].wizard.zlow = -3.15 -- Lowest Z coordinate considered to be in the Blue Base control sphere in wizard.
- except[1].wizard.zhigh = nil -- Highest Z coordinate considered to be in the Blue Base control sphere in wizard.
- -- Optional Gametype Modifiers --
- -- Modifier: Boolean: Description:
- ball_of_faith = true -- One who holds the Ball of Faith (an oddball) will regenerate extra control percentage and increase maximum control while standing in their own control sphere.
- staff_of_influence = true -- One who holds the Staff of Influence (a flagstaff) will take extra control percentage while standing in the opposing team's control sphere.
- -- Ball of Faith --
- -- The following only apply if ball_of_faith = true.
- ball = {}
- -- Attribute: Value: Description:
- ball.bonus = 2.00 -- Bonus faith applied to the player holding the Ball of Faith.
- ball.max_bonus = 50.00 -- Bonus maximum control a team can have over their own base when a team member holds the Ball of Faith in their own control sphere.
- ball.spawn_delay = 0.00 -- Amount of time (in seconds) before the Ball of Faith appears on the map.
- ball.respawn = 20.0 -- Amount of time (in seconds) before the Ball of Faith respawns (use math.inf for no respawn).
- -- Staff of Influence --
- -- The following only apply if staff_of_influence = true.
- staff = {}
- -- Attribute: Value: Description:
- staff.bonus = 2.50 -- Bonus influence applied to the player holding the Staff of Influence.
- staff.spawn_delay = 0.00 -- Amount of time (in seconds) before the Staff of Influence appears on the map.
- staff.respawn = 20.0 -- Amount of time (in seconds) before the Staff of Influence respawns (use math.inf for no respawn).
- -- Ball and Staff Spawn Options --
- shared_spawns = false -- If true, the Ball of Faith and Staff of Influence can spawn in the same place. If false, they cannot.
- -- Ball of Faith Spawnpoints --
- ball.spawns = {} -- Spawnpoints of Ball of Faith depending on the current map
- -- Allows for multiple spawn points (if multiple spawnpoints are specified, they will be chosen at random at the beginning of each game).
- -- Map: {{x1, y1, z1}, {x2, y2, z2} ... etc}
- ball.spawns.beavercreek = { {15.38, 5.23, 4.05},
- {14.13, 20.95, 3.37}
- }
- ball.spawns.bloodgulch = { {60.5, -150.5, 6.28},
- {70.09, -88.32, 5.64}
- }
- ball.spawns.boardingaction = { {15.85, 12.82, 7.72},
- {4.13, -12.78, 7.72}
- }
- ball.spawns.carousel = { {7.41, -7.58, 0.86},
- {-8.07, 8.10, 0.86}
- }
- ball.spawns.chillout = { {9.82, 2.67, 0.5},
- {-1.63, 11.08, 4.67}
- }
- ball.spawns.damnation = { {-7.76, 7.28, 3.90},
- {-12.17, -6.04, 3.51}
- }
- ball.spawns.dangercanyon = { {-10.78, 44.82, 0.63},
- {10.35, 44.2, 0.63}
- }
- ball.spawns.deathisland = { {-34.73, 50.47, 18.76},
- {16.97, -32.19, 3.91}
- }
- ball.spawns.gephyrophobia = { {39.41, -67.38, -12.21},
- {14.06, -76.64, -12.21}
- }
- ball.spawns.hangemhigh = { {21.04, -6.24, -3.63},
- {20.46, -2.45, -8.75}
- }
- ball.spawns.icefields = { {-17.13, 34.29, 1.18},
- {-35.86, 30.51, 1.18}
- }
- ball.spawns.infinity = { {-15.37, -46.22, 28.97},
- {18.86, -81.41, 28.67}
- }
- ball.spawns.longest = { {-6.86, -10.53, 2.56},
- {5.06, -18.55, 2.56}
- }
- ball.spawns.prisoner = { {9.19, -5.09, 3.69},
- {-11.03, 5.01, 1.89}
- }
- ball.spawns.putput = { {-5.29, -22.25, 1.4},
- {13.62, -32.25, 3.33}
- }
- ball.spawns.ratrace = { {16.22, -19.57, -0.66},
- {-2.24, -12.94, 0.72}
- }
- ball.spawns.sidewinder = { {-1.49, 56.58, -2.54},
- {6.6, 57.18, -2.36}
- }
- ball.spawns.timberland = { {5.8, 5.6, -18.84},
- {-3.64, -6.4, -18.51}
- }
- ball.spawns.wizard = { {7.95, 7.95, -2.25},
- {-7.95, -7.95, -2.25}
- }
- -- Staff of Influence Spawnpoints --
- staff.spawns = {} -- Spawnpoints of Staff of Influence depending on the current map
- -- Allows for multiple spawn points (if multiple spawnpoints are specified, they will be chosen at random at the beginning of each game).
- -- Map: {{x1, y1, z1}, {x2, y2, z2} ... etc}
- staff.spawns.beavercreek = {{15.38, 5.23, 4.05},
- {14.13, 20.95, 3.37}
- }
- staff.spawns.bloodgulch = {{60.5, -150.5, 6.28},
- {70.09, -88.32, 5.64}
- }
- staff.spawns.boardingaction = {{15.85, 12.82, 7.72},
- {4.13, -12.78, 7.72}
- }
- staff.spawns.carousel = {{7.41, -7.58, 0.86},
- {-8.07, 8.10, 0.86}
- }
- staff.spawns.chillout = {{9.82, 2.67, 0.5},
- {-1.63, 11.08, 4.67}
- }
- staff.spawns.damnation = {{-7.76, 7.28, 3.90},
- {-12.17, -6.04, 3.51}
- }
- staff.spawns.dangercanyon = {{-10.78, 44.82, 0.63},
- {10.35, 44.2, 0.63}
- }
- staff.spawns.deathisland = {{-34.73, 50.47, 18.76},
- {16.97, -32.19, 3.91}
- }
- staff.spawns.gephyrophobia = {{39.41, -67.38, -12.21},
- {14.06, -76.64, -12.21}
- }
- staff.spawns.hangemhigh = {{21.04, -6.24, -3.63},
- {20.46, -2.45, -8.75}
- }
- staff.spawns.icefields = {{-17.13, 34.29, 1.18},
- {-35.86, 30.51, 1.18}
- }
- staff.spawns.infinity = {{-15.37, -46.22, 28.97},
- {18.86, -81.41, 28.67}
- }
- staff.spawns.longest = {{-6.86, -10.53, 2.56},
- {5.06, -18.55, 2.56}
- }
- staff.spawns.prisoner = {{9.19, -5.09, 3.69},
- {-11.03, 5.01, 1.89}
- }
- staff.spawns.putput = {{-5.29, -22.25, 1.4},
- {13.62, -32.25, 3.33}
- }
- staff.spawns.ratrace = {{16.22, -19.57, -0.66},
- {-2.24, -12.94, 0.72}
- }
- staff.spawns.sidewinder = { {-1.49, 56.58, -2.54},
- {6.6, 57.18, -2.36}
- }
- staff.spawns.timberland = {{5.8, 5.6, -18.84},
- {-3.64, -6.4, -18.51}
- }
- staff.spawns.wizard = {{7.95, 7.95, -2.25},
- {-7.95, -7.95, -2.25}
- }
- -- **Do not edit the following code unless you know what you're doing** --
- game_end = false
- vehicle_fix = false
- flag_respawn_addr = 0x488A7E
- writedword(flag_respawn_addr, 0, 0xFFFFFFFF)
- writedword(0x671340, 0x48, respawn_time * 30)
- flags = {}
- players = {}
- teams[0].rate = 0
- teams[1].rate = 0
- teams[0].prefix = ""
- teams[1].prefix = ""
- teams[0].control = teams[0].start
- teams[1].control = teams[1].start
- teams[0].previous_max = teams[0].max
- teams[1].previous_max = teams[1].max
- registertimer(10, "ControlRate")
- registertimer(1000, "CreationDelay")
- registertimer(500, "VehicleFix")
- end
- function CreationDelay(id, count)
- teams[0].radius = teams[0].radius or radius[0][this_map]
- teams[1].radius = teams[1].radius or radius[1][this_map]
- controlsphere(0, teams[0].radius, table.unpack(teams[0].center))
- controlsphere(1, teams[1].radius, table.unpack(teams[1].center))
- if ball_of_faith then
- if #ball.spawns[this_map] > 0 then
- local mapId = gettagid("weap", "weapons\\ball\\ball")
- local rand = getrandomnumber(1, #ball.spawns[this_map] + 1)
- ball.x = ball.spawns[this_map][rand][1]
- ball.y = ball.spawns[this_map][rand][2]
- ball.z = ball.spawns[this_map][rand][3]
- ball.objId = createobject(mapId, 0, ball.respawn, true, ball.x, ball.y, ball.z)
- ball.respawn_remain = ball.respawn
- if not shared_spawns then
- for k,t in ipairs(staff.spawns[this_map]) do
- if t[1] == ball.x and t[2] == ball.y and t[3] == ball.z then
- table.remove(staff.spawns[this_map], k)
- break
- end
- end
- end
- else
- hprintf("There are no Ball of Faith spawn points for " .. this_map)
- end
- end
- local ctf_globals = 0x639B98
- for i = 0,1 do
- ctf_flag_coords_pointer = readdword(ctf_globals + i * 4, 0x0)
- writefloat(ctf_flag_coords_pointer, 0)
- writefloat(ctf_flag_coords_pointer + 4, 0)
- writefloat(ctf_flag_coords_pointer + 8, -1000)
- end
- if staff_of_influence then
- if #staff.spawns[this_map] > 0 then
- local mapId = gettagid("weap", "weapons\\flag\\flag")
- local rand = getrandomnumber(1, #staff.spawns[this_map] + 1)
- staff.x = staff.spawns[this_map][rand][1]
- staff.y = staff.spawns[this_map][rand][2]
- staff.z = staff.spawns[this_map][rand][3]
- staff.objId = createobject(mapId, 0, staff.respawn, true, staff.x, staff.y, staff.z)
- staff.respawn_remain = staff.respawn
- else
- hprintf("There are no Staff of Influence spawn points for " .. this_map)
- end
- end
- registertimer(10, "SphereMonitor")
- if ball_of_faith or staff_of_influence then
- registertimer(10, "BallStaff")
- end
- return false
- end
- function newplayer(player)
- local hash = gethash(player)
- local team = getteam(player)
- players[hash] = players[hash] or {}
- players[hash].team = team
- players[hash].influence = teams[team].influence
- players[hash].faith = teams[team].faith
- players[hash].presence = teams[team].presence
- end
- spheres = {}
- spheres.__index = spheres
- cur_ticks = getticks()
- function ControlRate(id, count)
- teams[0].control = math.min(teams[0].max, teams[0].control + teams[0].rate / 1000 * (getticks() - cur_ticks))
- teams[1].control = math.min(teams[1].max, teams[1].control + teams[1].rate / 1000 * (getticks() - cur_ticks))
- cur_ticks = getticks()
- local game_over = false
- if teams[0].control <= 0 then
- teams[0].control = 0
- say("Blue Team wins!")
- svcmd("sv_map_next")
- game_over = true
- elseif teams[1].control <= 0 then
- teams[1].control = 0
- say("Red Team wins!")
- svcmd("sv_map_next")
- game_over = true
- end
- for hash,_ in pairs(players) do
- players[hash].redmessage:append(teams[0].prefix .. "Red Base Control: " .. math.round(teams[0].control, 2) .. "%")
- players[hash].bluemessage:append(teams[1].prefix .. "Blue Base Control: " .. math.round(teams[1].control, 2) .. "%")
- end
- return not game_over
- end
- function SphereMonitor(id, count)
- local red = {}
- local blue = {}
- for i = 0,15 do
- local m_player = getplayer(i)
- if m_player then
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- if m_object then
- for x = 0,1 do
- if insphere(objId, teams[x].sphere) then
- if x == 0 then
- table.insert(red, i)
- else
- table.insert(blue, i)
- end
- end
- end
- end
- end
- end
- local red_own, red_opp, red_p
- for _,player in ipairs(red) do
- local team = getteam(player)
- if team == 0 then
- red_own = true
- else
- red_opp = true
- end
- end
- if teams[1].berserk then
- if red_own then
- red_p = true
- end
- red_own = false
- end
- if #red == 0 then
- teams[0].rate = 0
- teams[0].prefix = ""
- elseif red_own and red_opp then
- teams[0].rate = 0
- teams[0].prefix = "* "
- elseif red_own then
- local max_player, key
- local max_faith = -math.inf
- for k,player in ipairs(red) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- if players[hash].faith >= max_faith then
- max_player = player
- max_faith = players[hash].faith
- key = k
- end
- end
- end
- table.remove(red, key)
- local sum = max_faith
- for _,player in ipairs(red) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- sum = sum + players[hash].presence
- end
- end
- teams[0].rate = sum
- teams[0].prefix = "+ "
- elseif red_opp then
- local max_player, key
- local max_influence = -math.inf
- for k,player in ipairs(red) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- if players[hash].influence >= max_influence then
- max_player = player
- max_influence = players[hash].influence
- key = k
- end
- end
- end
- table.remove(red, key)
- local sum = max_influence
- for _,player in ipairs(red) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- sum = sum + players[hash].presence
- end
- end
- if teams[1].berserk then
- if red_p then
- teams[0].prefix = "* - "
- teams[0].rate = -sum + staff.bonus
- else
- teams[0].prefix = "- "
- teams[0].rate = -sum
- end
- else
- teams[0].prefix = "- "
- teams[0].rate = -sum
- end
- end
- local blue_own, blue_opp, blue_p
- for _,player in ipairs(blue) do
- local team = getteam(player)
- if team == 1 then
- blue_own = true
- else
- blue_opp = true
- end
- end
- if teams[0].berserk then
- if blue_own then
- blue_p = true
- end
- blue_own = false
- end
- if #blue == 0 then
- teams[1].rate = 0
- teams[1].prefix = ""
- elseif blue_own and blue_opp then
- teams[1].rate = 0
- teams[1].prefix = "* "
- elseif blue_own then
- local max_player, key
- local max_faith = -math.inf
- for k,player in ipairs(blue) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- if players[hash].faith >= max_faith then
- max_player = player
- max_faith = players[hash].faith
- key = k
- end
- end
- end
- table.remove(blue, key)
- local sum = max_faith
- for _,player in ipairs(blue) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- sum = sum + players[hash].presence
- end
- end
- teams[1].rate = sum
- teams[1].prefix = "+ "
- elseif blue_opp then
- local max_player, key
- local max_influence = -math.inf
- for k,player in ipairs(blue) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- if players[hash].influence >= max_influence then
- max_player = player
- max_influence = players[hash].influence
- key = k
- end
- end
- end
- table.remove(blue, key)
- local sum = max_influence
- for _,player in ipairs(blue) do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- sum = sum + players[hash].presence
- end
- end
- if teams[0].berserk then
- if blue_p then
- teams[1].prefix = "* - "
- teams[1].rate = -sum + staff.bonus
- else
- teams[1].prefix = "- "
- teams[1].rate = -sum
- end
- else
- teams[1].prefix = "- "
- teams[1].rate = -sum
- end
- end
- return true
- end
- function controlsphere(team, radius, x, y, z)
- spheres[team] = {}
- spheres[team].radius = radius
- spheres[team].x = x
- spheres[team].y = y
- spheres[team].z = z
- spheres[team].team = team
- spheres[team].players = {}
- setmetatable(spheres[team], spheres)
- teams[team].sphere = spheres[team]
- return spheres[team]
- end
- function insphere(objId, sphere)
- local m_object = getobject(objId)
- if m_object then
- local vehiId = readdword(m_object, 0x11C)
- local m_vehicle = getobject(vehiId)
- if m_vehicle then
- objId = vehiId
- end
- local x, y, z = getobjectcoords(objId)
- local dist = math.sqrt((x - sphere.x) ^ 2 + (y - sphere.y) ^ 2 + (z - sphere.z) ^ 2)
- if dist <= sphere.radius then
- if x > (except[sphere.team][this_map].xlow or -math.inf) and x < (except[sphere.team][this_map].xhigh or math.inf) and y > (except[sphere.team][this_map].ylow or -math.inf) and y < (except[sphere.team][this_map].yhigh or math.inf) and z > (except[sphere.team][this_map].zlow or -math.inf) and z < (except[sphere.team][this_map].zhigh or math.inf) then
- return true
- end
- end
- end
- return false
- end
- function hashtoplayer(hash)
- for i = 0,15 do
- local m_player = getplayer(i)
- if m_player then
- if gethash(i) == hash then return i end
- end
- end
- end
- console = {}
- console.__index = console
- registertimer(100, "ConsoleTimer")
- cur_ticks = getticks()
- phasor_sendconsoletext = sendconsoletext
- math.inf = 1 / 0
- function sendconsoletext(player, text, time, align, func)
- console[player] = console[player] or {}
- local id = nextindex(player)
- console[player][id] = {}
- console[player][id].p = player
- console[player][id].id = id
- console[player][id].msg = text
- console[player][id].t = time or 5
- console[player][id].r = time or 5
- console[player][id].f = func
- console[player][id].a = align or "left"
- setmetatable(console[player][id], console)
- return console[player][id]
- end
- function nextindex(player)
- local max = 0
- for k,v in pairs(console[player]) do
- if k > max then
- max = k
- end
- end
- return max + 1
- end
- function getmessages(player)
- return console[player]
- end
- function console:append(text, time_reset)
- local player = self.p
- if getplayer(player) then
- local id = self.id
- if console[player] then
- if console[player][id] then
- console[player][id].msg = text
- if time_reset == true or time_reset == nil then
- console[player][id].r = console[player][id].t
- end
- end
- end
- end
- end
- function console:message()
- return self.msg
- end
- function console:player()
- return self.p
- end
- function console:time()
- return self.t
- end
- function console:remaining()
- return self.r
- end
- function console:index()
- return self.id
- end
- function console:func()
- return self.f
- end
- function console:alignment()
- return self.a
- end
- function console:delete()
- console[self.p][self.id] = nil
- end
- function console:pause(duration)
- duration = duration or 5
- console[self.p][self.id].pa = duration
- end
- function console:paused()
- return self.pa
- end
- function ConsoleTimer(id, count)
- for player,t in opairs(console) do
- if type(t) == "table" and player ~= "__index" then
- for id,t2 in opairs(t) do
- if console[player][id].pa then
- console[player][id].pa = console[player][id].pa - (getticks() - cur_ticks) / 1000
- if console[player][id].pa <= 0 then
- console[player][id].pa = nil
- end
- else
- console[player][id].r = console[player][id].r - (getticks() - cur_ticks) / 1000
- if console[player][id].r <= 0 then
- console[player][id] = nil
- end
- end
- if console[player][id] then
- if console[player][id].f then
- if not console[player][id].f(player) then
- console[player][id] = nil
- end
- end
- end
- end
- end
- end
- for player,t in opairs(console) do
- if type(t) == "table" and player ~= "__index" then
- if getplayer(player) then
- if table.len(t) > 0 then
- local paused = 0
- for id,t2 in pairs(t) do
- if console[player][id].pa then
- paused = paused + 1
- end
- end
- if paused < table.len(t) then
- local str = ""
- for i = 0,30 do
- str = str .. "\n "
- end
- phasor_sendconsoletext(player, str)
- for id,t2 in opairs(t) do
- if console[player][id].a == "left" then
- phasor_sendconsoletext(player, console[player][id].msg)
- elseif console[player][id].a == "right" then
- phasor_sendconsoletext(player, consolerightalign(console[player][id].msg))
- end
- end
- end
- end
- else
- console[player] = nil
- end
- end
- end
- cur_ticks = getticks()
- return true
- end
- -- Console text length limit = 78
- function consolerightalign(text)
- local len = string.len(text)
- for i = len + 1, 78 do
- text = " " .. text
- end
- return text
- end
- function math.round(input, precision)
- return math.floor(input * (10 ^ precision) + 0.5) / (10 ^ precision)
- end
- function table.len(t)
- local count = 0
- for k,v in pairs(t) do
- count = count + 1
- end
- return count
- end
- function table.find(t, val)
- for k,v in pairs(t) do
- if v == val then
- return k
- end
- end
- end
- function table.max(t)
- local max = -math.inf
- local key
- for k,v in pairs(t) do
- if type(v) == "number" then
- if v > max then
- key = k
- max = v
- end
- end
- end
- return key, max
- end
- function opairs(t)
- local keys = {}
- for k,v in pairs(t) do
- table.insert(keys, k)
- end
- table.sort(keys,
- function(a,b)
- if type(a) == "number" and type(b) == "number" then
- return a < b
- end
- an = string.lower(tostring(a))
- bn = string.lower(tostring(b))
- if an ~= bn then
- return an < bn
- else
- return tostring(a) < tostring(b)
- end
- end)
- local count = 1
- return function()
- if table.unpack(keys) then
- local key = keys[count]
- local value = t[key]
- count = count + 1
- return key,value
- end
- end
- end
- --[[
- function OnScriptUnload()
- end
- --]]
- function OnNewGame(map)
- this_map = map
- end
- function OnGameEnd(stage)
- if stage == 2 then
- game_end = true
- end
- end
- function OnServerChat(player, type, message)
- if message == "#help" then
- privatesay(player, "Goal: Take control of the opposing team's base while maintaining control of your own.")
- privatesay(player, "Standing in your own base replenishes your team's control while standing in your opponent's takes their control.")
- privatesay(player, "Each base is located near the CTF flag spawn.")
- end
- if message == "coords" then
- local m_player = getplayer(player)
- if m_player then
- local objId = readdword(m_player, 0x34)
- local x, y, z = getobjectcoords(objId)
- hprintf("X: " .. x .. " | Y: " .. y .. " | Z: " .. z)
- end
- end
- end
- function OnServerCommand(player, command)
- local messages = getmessages(player)
- if messages then
- for k,obj in ipairs(messages) do
- obj:pause(2)
- end
- end
- end
- --[[
- function OnBanCheck(hash, ip)
- --return true
- end
- --]]
- function OnPlayerJoin(player)
- newplayer(player)
- local hash = gethash(player)
- players[hash].redmessage = sendconsoletext(player, "Red Base Control: " .. math.round(teams[0].control, 2) .. "%", math.inf, "left", notgameover)
- players[hash].bluemessage = sendconsoletext(player, "Blue Base Control: " .. math.round(teams[1].control, 2) .. "%", math.inf, "left", notgameover)
- end
- function notgameover()
- return not game_end
- end
- --[[
- function OnPlayerLeave(player)
- end
- --]]
- --[[
- function OnPlayerKill(killer, victim, mode)
- end
- --]]
- --[[
- function OnKillMultiplier(player, multiplier)
- end
- --]]
- --[[
- function OnPlayerSpawn(player)
- end
- --]]
- --[[
- function OnPlayerSpawnEnd(player)
- end
- --]]
- --[[
- function OnWeaponAssignment(player, objId, slot, weapId)
- --return mapid
- end
- --]]
- --[[
- function OnObjectCreationAttempt(mapId, parentId, player)
- --return true
- end
- --]]
- function OnObjectCreation(objId)
- local m_object = getobject(objId)
- local mapId = readdword(m_object)
- local tagname, tagtype = gettaginfo(mapId)
- if tagtype == "weap" and tagname == "weapons\\flag\\flag" then
- local team = readbyte(m_object, 0xB8)
- if teams[team] then
- if not teams[team].center then
- teams[team].center = {getobjectcoords(objId)}
- end
- if #flags < 2 then
- table.insert(flags, objId)
- end
- end
- end
- -- Add vehicle rotation (take from Createobject script)
- if not vehicle_fix then
- if tagtype == "vehi" then
- local x, y, z = getobjectcoords(objId)
- local yaw = getobjectorientation(objId)
- registertimer(500, "VehicleCreationDelay", {objId, yaw, x, y, z})
- end
- end
- if rotate_vehicle then
- rotateobject(objId, rotate_vehicle)
- end
- end
- function VehicleFix(id, count)
- vehicle_fix = true
- return false
- end
- function VehicleCreationDelay(id, count, coords)
- local objId, yaw, x, y, z = table.unpack(coords)
- local m_object = getobject(objId)
- local mapId = readdword(m_object)
- destroyobject(objId)
- rotate_vehicle = yaw
- createobject(mapId, 0, 30000, true, x, y, z)
- rotate_vehicle = nil
- return false
- end
- function getobjectorientation(objId)
- local m_object = getobject(objId)
- local x_vector = readfloat(m_object, 0x74)
- return math.acos(x_vector)
- end
- function rotateobject(objId, orientation)
- local m_object = getobject(objId)
- if m_object then
- local x_comp = math.cos(orientation)
- local y_comp = math.sin(orientation)
- writebit(m_object, 0x10, 2, 0)
- writefloat(m_object, 0x74, x_comp)
- writefloat(m_object, 0x78, y_comp)
- end
- end
- function OnObjectInteraction(player, objId, mapId)
- if table.find(flags, objId) then
- return false
- end
- local tagname, tagtype = gettaginfo(mapId)
- local hash = gethash(player)
- if players[hash].ball then
- if tagtype == "weap" and tagname == "weapons\\flag\\flag" then
- return false
- end
- end
- if players[hash].staff then
- if tagtype == "weap" and tagname == "weapons\\ball\\ball" then
- return false
- end
- end
- end
- --[[
- function OnTeamDecision(team)
- --return team
- end
- --]]
- --[[
- function OnTeamChange(player, old_team, new_team, voluntary)
- --return true
- end
- --]]
- --[[
- function OnDamageLookup(receiver, causer, tagdata, mapId)
- -- 0x1D0
- -- 0x1D4
- -- 0x1D8
- end
- --]]
- --[[
- function OnVehicleEntry(player, m_vehiId, seat, mapId, voluntary)
- --return true
- end
- --]]
- --[[
- function OnVehicleEject(player, voluntary)
- --return true
- end
- --]]
- --[[
- function OnClientUpdate(player)
- end
- --]]
- function BallStaff(id, count)
- local ball_hash, ball_team, staff_hash, staff_team
- for player = 0,15 do
- local m_player = getplayer(player)
- if m_player then
- local hash = gethash(player)
- local team = getteam(player)
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- if m_object then
- for i = 0,3 do
- local weapId = readdword(m_object, 0x2F8 + (i * 4))
- local m_weapon = getobject(weapId)
- if m_weapon then
- local mapId = readdword(m_weapon)
- local tagname, tagtype = gettaginfo(mapId)
- if tagtype == "weap" then
- if tagname == "weapons\\ball\\ball" then
- if not players[hash].ball then
- players[hash].faith = players[hash].faith + ball.bonus
- players[hash].ball = true
- end
- ball_hash = hash
- ball_team = team
- elseif tagname == "weapons\\flag\\flag" then
- if not players[hash].staff then
- players[hash].influence = players[hash].influence + staff.bonus
- players[hash].staff = true
- end
- staff_hash = hash
- staff_team = team
- end
- end
- end
- end
- end
- end
- end
- if ball_hash and ball_team then
- local player = hashtoplayer(ball_hash)
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- if m_object then
- if insphere(objId, teams[ball_team].sphere) then
- teams[ball_team].max = teams[ball_team].previous_max + ball.max_bonus
- else
- teams[ball_team].max = math.max(teams[ball_team].control, teams[ball_team].previous_max)
- end
- end
- ball.respawn_remain = ball.respawn
- else
- for i = 0,1 do
- teams[i].max = math.max(teams[i].control, teams[i].previous_max)
- end
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- local team = getteam(i)
- players[hash].faith = teams[team].faith
- players[hash].ball = nil
- end
- end
- -- Respawn Stuff --
- --[[
- if ball_of_faith then
- ball.respawn_remain = ball.respawn_remain - (getticks() - cur_ticks) / 15
- if ball.respawn_remain <= 0 then
- destroyobject(ball.objId)
- local mapId = gettagid("weap", "weapons\\ball\\ball")
- ball.objId = createobject(mapId, 0, ball.respawn, true, ball.x, ball.y, ball.z)
- ball.respawn_remain = ball.respawn
- end
- end
- --]]
- end
- if staff_hash and staff_team then
- local player = hashtoplayer(staff_hash)
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- if m_object then
- if insphere(objId, teams[1 - staff_team].sphere) then
- teams[staff_team].berserk = true
- else
- teams[staff_team].berserk = false
- end
- end
- else
- for i = 0,1 do
- teams[i].berserk = false
- end
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- local team = getteam(i)
- players[hash].influence = teams[team].influence
- players[hash].staff = nil
- end
- end
- -- Respawn Stuff --
- --[[
- if staff_of_influence then
- staff.respawn_remain = staff.respawn_remain - (getticks() - cur_ticks) / 15
- if staff.respawn_remain <= 0 then
- destroyobject(staff.objId)
- local mapId = gettagid("weap", "weapons\\flag\\flag")
- ball.objId = createobject(mapId, 0, staff.respawn, true, staff.x, staff.y, staff.z)
- staff.respawn_remain = staff.respawn
- end
- end
- --]]
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement