Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Pro-Racing v1.6 by H® Shaft for Stock PC/CE maps
- -- auto-heal, anti-hog camp, anti-slayer, out-of-bounds, medic, grenade refills, rockethogs spawn first, replacement weapons, betray-karma, splatter damage
- -- Edit 7-20-2016 changelog:
- -- corrected typo in refill chat command changed ..plasma.. to ..plasmas..
- -- guarded against nil in CountReduction
- -- updated isinvehicle function
- --**** START CONFIGURATION ****--
- grenade_delay = 15 -- | amount of time in seconds after game start to give players grenades if delay_grenades is set for the map
- frags = 1 -- | amount of frag grenades players spawn with
- plasmas = 1 -- | amount of frag grenades players spawn with
- eject_time = 3 -- | amount of time in seconds before a gunner/passenger is ejected if no driver. 3 is minimum - 3 to 4 is good for race
- slayer_threshhold = 4 -- | amount of kills on foot which sets the slayer-play threshold (more than this: player is killed, if less than slayer_threshhold + kick_margin)
- betray_threshhold = 3 -- | amount of betrays which sets the team killer threshold
- spawn_penalty = 15 -- | amount of time in seconds to penalize BOTH team killers and Out-of-Bounds players on re-spawn
- kick_margin = 2 -- | amount of kills on foot added to the slayer-play threshold which results in a kick
- slay_forgiveness_rate = 60 -- | amount of time in seconds before a single kill on foot/betray point is forgiven
- hp_limit = 3 -- | amount of times a player may type MEDIC each game to get healed
- nade_refill_limit = 2 -- | amount of times a player may type REFILL each game to get a grenade refill
- replace_sniper = false -- | If set to true, sniper rifles will be replaced with the replacement weapon
- replace_fuelrod = true -- | If set to true, fuel rod gun (FRG) will be replaced with the replacement weapon
- delete_dropped_grenades = true -- | If set to true, and player dies - their grenades will be deleted/destroyed (reduces slayer)
- replacement_weapon = "weapons\\shotgun\\shotgun" -- | weapon tag name which will replace the sniper/FRG see bottom of script for weapons tag list
- -- message to notify players when Anti-Slayer is active:
- anti_slayer_msg = "Anti-Slayer is ACTIVE!: Slayer-Play results in automatic kill/kick by the server."
- --**** END CONFIGURATION ****--
- -- See function LoadDefaults line 674 (near bottom) to set/edit values for:
- -- health_coord, anti_slayer, delay_grenades, grenade_refill and rockethogs_spawn_first, splatter_damage
- -- added splatter_damage to reduce chase-kills - if set to true, a player cannot be run over/killed by an enemy player in a hog
- -- don't edit unless you know what you are doing --
- kills_on_foot = {}
- betrays = {}
- hp_delay = {}
- hp_player = {}
- nade_refills = {}
- players_in_vehicle = {}
- remaining_delay = true
- api_version = "1.9.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_DIE'], "OnPlayerDie")
- register_callback(cb['EVENT_BETRAY'], "OnPlayerBetray")
- register_callback(cb['EVENT_JOIN'], "OnPlayerJoin")
- register_callback(cb['EVENT_LEAVE'], "OnPlayerLeave")
- register_callback(cb['EVENT_OBJECT_SPAWN'], "OnObjectSpawn")
- register_callback(cb['EVENT_DAMAGE_APPLICATION'], "OnDamageApplication")
- register_callback(cb['EVENT_TICK'], "OnEventTick")
- register_callback(cb['EVENT_CHAT'], "OnPlayerChat")
- register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
- if get_var(0, "$gt") ~= "n/a" then
- OnNewGame()
- end
- end
- function OnScriptUnload()
- kills_on_foot = {}
- betrays = {}
- hp_delay = {}
- hp_player = {}
- health_coord = {}
- anti_slayer = {}
- delay_grenades = {}
- grenade_refills = {}
- players_in_vehicle = {}
- replace_camo = {}
- end
- function OnNewGame()
- game_started = true
- map_name = get_var(0,"$map")
- LoadDefaults()
- if rockethogs_spawn_first[map_name] then
- if get_var(0, "$gt") ~= "n/a" then
- SwapHogs()
- end
- end
- for i = 1,16 do
- if player_present(i) then
- kills_on_foot[i] = 0
- betrays[i] = 0
- hp_delay[i] = 0
- hp_player[i] = 0
- nade_refills[i] = 0
- if player_alive(i) then
- execute_command("nades me 0", i)
- end
- end
- end
- if not delay_grenades[map_name] then
- remaining_delay = false
- else
- remaining_delay = true
- updatedelay = timer(grenade_delay * 1000, "UpdateDelay")
- give_everyone_nades = timer(grenade_delay * 1000 + 1000, "GivePlayersGrenades")
- end
- forgivecount = timer(slay_forgiveness_rate * 1000, "CountReduction")
- end
- function OnGameEnd()
- game_started = false
- remaining_delay = true
- if rockethogs_spawn_first[map_name] then
- if get_var(0, "$gt") ~= "n/a" then
- UnSwapHogs()
- end
- end
- for i = 1,16 do
- if player_present(i) then
- kills_on_foot[i] = 0
- betrays[i] = 0
- hp_delay[i] = 0
- hp_player[i] = 0
- nade_refills[i] = 0
- end
- end
- end
- function OnPlayerJoin(PlayerIndex)
- kills_on_foot[PlayerIndex] = 0
- betrays[PlayerIndex] = 0
- hp_delay[PlayerIndex] = 0
- hp_player[PlayerIndex] = 0
- nade_refills[PlayerIndex] = 0
- timedwelcome = timer(8000, "TimedWelcome", PlayerIndex)
- end
- function OnPlayerLeave(PlayerIndex)
- kills_on_foot[PlayerIndex] = nil
- betrays[PlayerIndex] = nil
- hp_delay[PlayerIndex] = nil
- hp_player[PlayerIndex] = nil
- nade_refills[PlayerIndex] = nil
- end
- function UpdateDelay()
- remaining_delay = false
- return false
- end
- function OnPlayerSpawn(PlayerIndex)
- if player_present(PlayerIndex) then
- execute_command("nades me 0", PlayerIndex)
- if game_started then
- if not remaining_delay then
- execute_command("nades me " .. frags .. " 1", PlayerIndex)
- execute_command("nades me " .. plasmas .. " 2", PlayerIndex)
- end
- end
- end
- end
- function OnPlayerChat(PlayerIndex, Message)
- local response = nil
- if Message == nil then
- return true
- end
- local isadmin = nil
- local name = get_var(PlayerIndex,"$name")
- local Message = string.lower(Message)
- if Message ~= nil then
- if (tonumber(get_var(PlayerIndex,"$lvl"))) >= 1 then
- isadmin = true
- else
- isadmin = false
- end
- if (Message == "medic") or (Message == "/medic") then
- if hp_player[PlayerIndex] < hp_limit then
- if game_started then
- if player_alive(PlayerIndex) then
- local obj_health = tonumber(get_var(PlayerIndex, "$hp"))
- if obj_health < 1 then
- hp_player[PlayerIndex] = hp_player[PlayerIndex] + 1
- health = timer(3500, "ApplyHP", PlayerIndex)
- say(PlayerIndex, name.. ": You will be healed. You have " .. hp_limit - hp_player[PlayerIndex] .. " MEDIC calls remaining.")
- say_all(string.format("%s requested a MEDIC (health pack). ", tostring(name)))
- elseif obj_health == 1 then
- say(PlayerIndex, "**OOPS!** You are already at full health!")
- end
- end
- end
- else
- say(PlayerIndex, "You have reached the limit of " .. hp_limit .. " medic calls per game")
- end
- response = false
- end
- if (Message == "coord") then
- local player_object = get_dynamic_player(PlayerIndex)
- local player_static = get_player(PlayerIndex)
- local x,y,z = read_vector3d(player_object + 0x5C)
- local data = string.format("%s,%s,%s,%s", tostring(map_name),tostring(x),tostring(y),tostring(z))
- execute_command("log_note \""..data.."\"")
- say(PlayerIndex, "X: " .. x .. " Y: " .. y .. " Z: " .. z)
- response = false
- end
- if (Message == "nademe") or (Message == "/nademe") or (Message == "nade me") or (Message == "refill") then
- if game_started then
- if (remaining_delay == false) then
- if nade_refills[PlayerIndex] < nade_refill_limit then
- if player_alive(PlayerIndex) then
- nade_refills[PlayerIndex] = nade_refills[PlayerIndex] + 1
- nades = timer(500, "GiveNades", PlayerIndex)
- say(PlayerIndex, "Grenades: " .. plasmas .. " Plasmas, " .. frags .. " Frags. You have " .. nade_refill_limit - nade_refills[PlayerIndex] .. " grenade refills remaining.")
- say_all(string.format("%s requested a grenade REFILL. ", tostring(name)))
- end
- else
- say(PlayerIndex, "You have reached the grenade refill limit of " .. nade_refill_limit .. " per game")
- end
- else
- say(PlayerIndex, "you cannot use this function until the delay has expired.")
- end
- else
- say(PlayerIndex, "Oops! Can't do that until the next game!")
- end
- response = false
- end
- end
- return response
- end
- function CountReduction()
- if game_started then
- for i = 1,16 do
- if player_present(i) then
- if kills_on_foot[i] ~= nil then
- if kills_on_foot[i] > 0 then
- kills_on_foot[i] = kills_on_foot[i] - 1
- end
- end
- if betrays[i] ~= nil then
- if betrays[i] > 0 then
- betrays[i] = betrays[i] - 1
- end
- end
- end
- end
- return true
- else
- return false
- end
- end
- function OnPlayerDie(PlayerIndex, KillerIndex)
- if KillerIndex ~= "-1" then
- local kname = get_var(KillerIndex,"$name")
- if PlayerIndex ~= KillerIndex then
- if get_var(KillerIndex, "$team") ~= get_var(PlayerIndex, "$team") then
- if kills_on_foot[KillerIndex] == nil then kills_on_foot[KillerIndex] = 0 end
- if not isinvehicle(KillerIndex) then
- local Reason = "Slayer-Play"
- kills_on_foot[KillerIndex] = kills_on_foot[KillerIndex] + 1
- local killcount = kills_on_foot[KillerIndex]
- if kills_on_foot[KillerIndex] > slayer_threshhold + kick_margin then
- say_all("**Anti-Slayer** ".. kname .. " is being auto-kicked for Slayer-Play.")
- rprint(KillerIndex, "**Anti-Slayer** " .. kname .. "! Slayer-Play will NOT be tolerated!")
- delayedkick = timer(3000, "DelayedKick", KillerIndex, Reason, killcount)
- elseif kills_on_foot[KillerIndex] > slayer_threshhold then
- say_all("**Anti-Slayer** ".. kname .. " was force-killed for " .. Reason .. ".")
- rprint(KillerIndex, "**Anti-Slayer** " .. kname .. "! Slayer-Play will NOT be tolerated!")
- kill(KillerIndex)
- elseif not isinvehicle(KillerIndex) and kills_on_foot[KillerIndex] <= slayer_threshhold then
- rprint(KillerIndex, "**Anti-Slayer** " .. kname .. "! Caution: Slayer-Play will NOT be tolerated!")
- end
- end
- end
- end
- end
- if delete_dropped_grenades then
- execute_command('nades me 0', PlayerIndex)
- end
- end
- function OnPlayerBetray(PlayerIndex, VictimIndex)
- local pname = get_var(PlayerIndex,"$name")
- local vname = get_var(VictimIndex,"$name")
- local Reason = "Excess Betrayals"
- if betrays[PlayerIndex] == nil then betrays[PlayerIndex] = 0 end
- if betrays[PlayerIndex] >= betray_threshhold then
- say_all("**Anti-Slayer** ".. pname .. " is being auto-kicked for excess betrayals.")
- rprint(PlayerIndex, "**Anti-Slayer** " .. pname .. "! Team-Killing will NOT be tolerated!")
- local killcount = betrays[PlayerIndex]
- delayedkick = timer(3000, "DelayedKick", PlayerIndex, Reason, killcount)
- else
- if player_alive(PlayerIndex) then
- say_all("**Anti-Slayer** ".. pname .. " was force-killed for betraying " .. vname)
- rprint(PlayerIndex, "**Anti-Slayer** " .. pname .. "! Team-Killing will NOT be tolerated!")
- local respawn_time_old = read_dword(get_player(PlayerIndex) + 0x30)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old + 30 * spawn_penalty)
- kill(PlayerIndex)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old)
- end
- end
- end
- function DelayedKick(PlayerIndex, Reason, Count)
- if player_present(PlayerIndex) then
- if Reason == nil then Reason = "Unspecified" end
- if Count == nil then Count = "Unspecified" end
- local namekicked = get_var(PlayerIndex,"$name")
- local str1 = string.format("%s was kicked by Anti-Slayer for %s | %s", tostring(namekicked),tostring(Reason),tostring(Count))
- execute_command("log_note \""..str1.."\"")
- kills_on_foot[PlayerIndex] = nil
- betrays[PlayerIndex] = nil
- hp_delay[PlayerIndex] = nil
- hp_player[PlayerIndex] = nil
- nade_refills[PlayerIndex] = nil
- execute_command("k " .. PlayerIndex .. " " .. Reason)
- end
- end
- function TimedWelcome(PlayerIndex)
- if game_started then
- if player_present(PlayerIndex) then
- if anti_slayer[map_name] then
- rprint(PlayerIndex, anti_slayer_msg)
- end
- end
- end
- return false
- end
- function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
- -- replace sniper rifle with replacement weapon
- if game_started then
- if get_var(0, "$gt") ~= "n/a" then
- if replace_sniper then
- if MapID == get_tag_info("weap", "weapons\\sniper rifle\\sniper rifle") then
- return true, get_tag_info("weap", replacement_weapon)
- end
- end
- end
- end
- -- replace fuel rod gun with replacement weapon
- if game_started then
- if get_var(0, "$gt") ~= "n/a" then
- if replace_fuelrod then
- if MapID == get_tag_info("weap", "weapons\\plasma_cannon\\plasma_cannon") then
- return true, get_tag_info("weap", replacement_weapon)
- end
- end
- end
- end
- -- replace active camo with overshield
- if game_started then
- if get_var(0, "$gt") ~= "n/a" then
- if replace_camo[map_name] then
- if MapID == get_tag_info("eqip", "powerups\\active camouflage") then
- return true, get_tag_info("eqip", "powerups\\over shield")
- end
- end
- end
- end
- -- end
- return true
- end
- function OnEventTick()
- for PlayerIndex = 1,16 do
- if player_alive(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- local name = get_var(PlayerIndex,"$name")
- local obj_health = tonumber(get_var(PlayerIndex, "$hp"))
- if hp_delay[PlayerIndex] == nil then hp_delay[PlayerIndex] = 0 end
- if hp_delay[PlayerIndex] > 0 then hp_delay[PlayerIndex] = hp_delay[PlayerIndex] - 1 end
- local time = os.clock()
- -- ejects hog campers (passengers and gunners) if there is no driver
- if (player_object ~= 0) then
- local player_obj_id = read_dword(get_player(PlayerIndex) + 0x34)
- local vehicleId = read_dword(player_object + 0x11C)
- local m_vehicle = get_object_memory(vehicleId)
- if isinvehicle(PlayerIndex) then
- player_obj_id = vehicleId
- end
- if (m_vehicle ~= 0) then
- if (PlayerIsGunner(PlayerIndex) and VehicleHasDriver(vehicleId) == false) then
- if (players_in_vehicle[PlayerIndex] == nil) then
- players_in_vehicle[PlayerIndex] = time
- elseif (time > (players_in_vehicle[PlayerIndex] + eject_time)) then
- exit_vehicle(PlayerIndex)
- say(PlayerIndex, " |*EJECTED!*| No Driver! Please drive or gun " .. name .. "!")
- players_in_vehicle[PlayerIndex] = nil
- end
- elseif (VehicleHasDriver(vehicleId) == false) then
- if (players_in_vehicle[PlayerIndex] == nil) then
- players_in_vehicle[PlayerIndex] = time
- elseif (time > (players_in_vehicle[PlayerIndex] + eject_time)) then
- exit_vehicle(PlayerIndex)
- say(PlayerIndex, " |*EJECTED!*| No Driver! Please drive or gun " .. name .. "!")
- players_in_vehicle[PlayerIndex] = nil
- end
- else
- players_in_vehicle[PlayerIndex] = nil
- end
- end
- -- walk thru/drive-thru health - first nav of each map
- if health_coord[map_name] ~= nil then
- local drivethru = inSphere(player_obj_id, health_coord[map_name][1], health_coord[map_name][2], health_coord[map_name][3], 2.5)
- local walkthru = inSphere(player_obj_id, health_coord[map_name][1], health_coord[map_name][2], health_coord[map_name][3], 2.5)
- if isinvehicle(PlayerIndex) then
- if drivethru then
- if (hp_delay[PlayerIndex] == 0) then
- if (obj_health < 1) then
- bonushealth = timer(3000, "Bonus_HP", PlayerIndex)
- end
- end
- end
- elseif not isinvehicle(PlayerIndex) then
- if walkthru then
- if (hp_delay[PlayerIndex] == 0) then
- if (obj_health < 1) then
- bonushealth = timer(3000, "Bonus_HP", PlayerIndex)
- end
- end
- end
- end
- end
- -- end drive-thru walk-thru health
- -- Out-of-Bounds -- Sets respawn penalty, warns player then kills them
- local respawn_time_old = read_dword(get_player(PlayerIndex) + 0x30)
- if map_name == "gephyrophobia" then
- local bluebasetop1 = inSphere(player_obj_id, -24.30, -28.16, -1.25, 4)
- local bluebasetop2 = inSphere(player_obj_id, 74.69, -38.07, -1.06, 4)
- local redbasetop1 = inSphere(player_obj_id, 74.76, -112.56, -1.06, 4)
- local redbasetop2 = inSphere(player_obj_id, -27.73, -107.17, -1.25, 4)
- if bluebasetop1 or bluebasetop2 or redbasetop1 or redbasetop2 then
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old + 30 * spawn_penalty)
- kill(PlayerIndex)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old)
- say_all("**Anti-Slayer** " .. name .. " is being force-killed for going Out-of-Bounds.")
- rprint(PlayerIndex, "**Anti-Slayer** " .. name .. "! Going Out-of-Bounds will NOT be tolerated!")
- end
- elseif map_name == "dangercanyon" then
- local topcenterfoot = inSphere(player_obj_id, -0.05, 30.59,0.23, 3)
- local bottommiddle = inSphere(player_obj_id, -0.06, 53.18, -8.44, 3)
- local bluerocket = inSphere(player_obj_id, 26.81, 26.52, 0.18, 3)
- local redrocket = inSphere(player_obj_id, -26.77, 26.45, 0.18, 3)
- -- moves player to bottom center ramp
- if topcenterfoot and not isinvehicle(PlayerIndex) then
- moveobject(player_obj_id, 0.17, 52.84, -8.42)
- end
- if redrocket or bluerocket then
- say_all("**Anti-Slayer** " .. name .. " is being force-killed for going Out-of-Bounds.")
- rprint(PlayerIndex, "**Anti-Slayer** " .. name .. "! Going Out-of-Bounds will NOT be tolerated!")
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old + 30 * spawn_penalty)
- kill(PlayerIndex)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old)
- end
- elseif map_name == "deathisland" then
- local bluebasetop = inSphere(player_obj_id, 24.592, 16.076, 20.983, 6)
- local bluebaseturret = inSphere(player_obj_id, 46.845, -35.882, 14.003, 6)
- local redbasetop = inSphere(player_obj_id, -21.454, -6.950, 22.373, 6)
- local redbaseturret = inSphere(player_obj_id, -68.724, 17.680, 15.322, 6)
- local cementFRG = inSphere(player_obj_id, -30.84, 28.56, 14.27, 3)
- local grassFRG = inSphere(player_obj_id, 13.55, -12.48, 20.75, 3)
- if bluebasetop or redbasetop or cementFRG or grassFRG or bluebaseturret or redbaseturret then
- if not isinvehicle(PlayerIndex) then
- say_all("**Anti-Slayer** " .. name .. " is being force-killed for going Out-of-Bounds.")
- rprint(PlayerIndex, "**Anti-Slayer** " .. name .. "! Going Out-of-Bounds will NOT be tolerated!")
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old + 30 * spawn_penalty)
- kill(PlayerIndex)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old)
- end
- end
- elseif map_name == "icefields" then
- local top_bridge = inSphere(player_obj_id, -30.91, 41.97, 11.10, 2.5)
- if top_bridge and not isinvehicle(PlayerIndex) then
- say_all("**Anti-Slayer** " .. name .. " is being force-killed for going Out-of-Bounds.")
- rprint(PlayerIndex, "**Anti-Slayer** " .. name .. "! Going Out-of-Bounds will NOT be tolerated!")
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old + 30 * spawn_penalty)
- kill(PlayerIndex)
- write_dword(get_player(PlayerIndex) + 0x30, respawn_time_old)
- end
- end
- -- End Out-of-Bounds
- end
- end
- end
- end
- function GivePlayersGrenades()
- if game_started and (remaining_delay == false) then
- for i = 1,16 do
- if player_present(i) then
- if player_alive(i) then
- execute_command("nades me " .. frags .. " 1", i)
- execute_command("nades me " .. plasmas .. " 2", i)
- end
- end
- end
- end
- return false
- end
- function GiveNades(PlayerIndex)
- if game_started then
- if player_present(PlayerIndex) then
- if player_alive(PlayerIndex) then
- execute_command("nades me " .. frags .. " 1", PlayerIndex)
- execute_command("nades me " .. plasmas .. " 2", PlayerIndex)
- end
- end
- end
- return false
- end
- function Bonus_HP(PlayerIndex)
- if game_started then
- if player_alive(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- if player_object ~= 0 then
- local obj_health = tonumber(get_var(PlayerIndex, "$hp"))
- if obj_health < 1 then
- write_float(player_object + 0xE0, 1)
- rprint(PlayerIndex, "Bonus: Your health has been restored.")
- hp_delay[PlayerIndex] = math.floor(30*30)
- end
- end
- end
- end
- return false
- end
- function ApplyHP(PlayerIndex)
- if game_started then
- if player_present(PlayerIndex) then
- if player_alive(PlayerIndex) then
- local name = get_var(PlayerIndex,"$name")
- local player_object = get_dynamic_player(PlayerIndex)
- local obj_health = tonumber(get_var(PlayerIndex, "$hp"))
- if obj_health < 1 then
- write_float(player_object + 0xE0, 1)
- rprint(PlayerIndex, name.. " You were healed!")
- else
- say(PlayerIndex, "Oops! You are already at full health!")
- end
- else
- say(PlayerIndex, "Oops! You are dead, a healthpack won't help you.")
- end
- end
- end
- return false
- end
- function isinvehicle(PlayerIndex) -- edited 7/20/2016
- local player_object = get_dynamic_player(PlayerIndex)
- if player_object ~= 0 then
- local vehicleId = read_dword(player_object + 0x11C)
- if vehicleId == 0xFFFFFFFF then
- return false
- else
- return true
- end
- else
- return false
- end
- end
- function inSphere(ObjectID, X, Y, Z, R)
- if get_object_memory(ObjectID) ~= 0 then
- local object = get_object_memory(ObjectID)
- local x,y,z = read_vector3d(object + 0x5C)
- if (X - x)^2 + (Y - y)^2 + (Z - z)^2 <= R then
- return true
- else
- return false
- end
- end
- end
- function moveobject(ObjectID, x, y, z)
- local object = get_object_memory(ObjectID)
- if get_object_memory(ObjectID) ~= 0 then
- local veh_obj = get_object_memory(read_dword(object + 0x11C))
- write_vector3d((veh_obj ~= 0 and veh_obj or object) + 0x5C, x, y, z)
- end
- end
- function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
- if get_var(0, "$gt") ~= "n/a" then
- if MetaID == splatter_damage then
- if block_splatter[map_name] then
- return true, 0
- end
- end
- end
- end
- function get_tag_info(tagclass,tagname) -- Thanks to 002, return metaid
- local tagarray = read_dword(0x40440000)
- for i=0,read_word(0x4044000C)-1 do
- local tag = tagarray + i * 0x20
- local class = string.reverse(string.sub(read_string(tag),1,4))
- if (class == tagclass) then
- if (read_string(read_dword(tag + 0x10)) == tagname) then
- return read_dword(tag + 0xC)
- end
- end
- end
- return nil
- end
- function SwapDependency(Address,ToTag,ToClass)
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- if (read_dword(tag) == ToClass and read_string(read_dword(tag + 0x10)) == ToTag) then
- write_dword(Address,read_dword(tag + 0xC))
- return
- end
- end
- end
- function SwapHogs() -- rockethogs spawn first
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- local tag_name = read_string(read_dword(tag + 0x10))
- local tag_class = read_dword(tag)
- if(tag_class == 1835103335 and tag_name == "globals\\globals") then
- local tag_data = read_dword(tag + 0x14)
- write_dword(tag_data + 0xa50, 1078313799)
- SwapDependency(tag_data + 0xa58, "vehicles\\rwarthog\\rwarthog", 1986357353)
- write_dword(tag_data + 0xaa0, 1078301885)
- SwapDependency(tag_data + 0xaa8, "vehicles\\warthog\\mp_warthog", 1986357353)
- break
- end
- end
- end
- function UnSwapHogs() -- chainhogs spawn first (normal)
- local tag_address = read_dword(0x40440000)
- local tag_count = read_dword(0x4044000C)
- for i=0,tag_count-1 do
- local tag = tag_address + 0x20 * i
- local tag_name = read_string(read_dword(tag + 0x10))
- local tag_class = read_dword(tag)
- if(tag_class == 1835103335 and tag_name == "globals\\globals") then
- local tag_data = read_dword(tag + 0x14)
- write_dword(tag_data + 0xa50, 1078301885)
- SwapDependency(tag_data + 0xa58, "vehicles\\warthog\\mp_warthog", 1986357353)
- write_dword(tag_data + 0xaa0, 1078313799)
- SwapDependency(tag_data + 0xaa8, "vehicles\\rwarthog\\rwarthog", 1986357353)
- break
- end
- end
- end
- function VehicleHasDriver(VehicleID)
- local vehicle_object = get_object_memory(VehicleID)
- if (vehicle_object == 0) then return false end
- return read_dword(vehicle_object + 0x324) ~= 0xFFFFFFFF
- end
- function PlayerIsGunner(PlayerIndex)
- if (player_present(PlayerIndex) == false) then return false end
- local player_object = get_dynamic_player(PlayerIndex)
- local pid = read_dword(get_player(PlayerIndex) + 0x34)
- local vehicleId = read_dword(player_object + 0x11C)
- if (vehicleId == 0xFFFFFFFF) then return false end
- local obj_id = get_object_memory(vehicleId)
- return read_dword(obj_id + 0x328) == pid
- end
- function LoadDefaults()
- -- if coordinates (x, y, z) are set for the map, players will be healed when they walk/drive thru the coordinates (lap nav)
- health_coord = {
- ["bloodgulch"] = {59.785, -121.995, 0.268},
- ["dangercanyon"] = {-0.800, 40.452, -6.000},
- ["deathisland"] = {1.499, -55.629, 1.645},
- ["gephyrophobia"] = {42.076, -71.727, -12.711},
- ["icefields"] = {-26.061, 32.583, 9.008},
- ["infinity"] = {0.461, -158.781, 13.574},
- ["sidewinder"] = {1.800, 54.512, -2.801},
- ["timberland"] = {17.330, -1.847, -21.034},
- ["hangemhigh"] = {20.244, 12.534, -7.949},
- ["ratrace"] = {-3.937, -8.287, -1.379},
- ["beavercreek"] = {13.633, 13.249, -0.606},
- ["damnation"] = {-0.646, -1.527, 8.201},
- ["boardingaction"] = {16.896, -0.245, -2.280},
- ["carousel"] = {0.898, 10.113, 0.747},
- ["putput"] = {-3.753, -20.851, 0.903},
- ["prisoner"] = {9.959, 4.606, -0.407},
- ["wizard"] = {5.555, -3.075, -2.749}
- }
- -- if set to true, all kills made while on foot will count towards the players slayer_threshhold
- anti_slayer = {
- ["bloodgulch"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["hangemhigh"] = false,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = false,
- ["wizard"] = false
- }
- -- if set to true, when the game starts, grenade counts will be set to zero, until the delay expires
- delay_grenades = {
- ["bloodgulch"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["hangemhigh"] = false,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = false,
- ["wizard"] = false
- }
- -- if set to true, players may type REFILL to get a grenade refill (amounts are set by frags and plasmas at the top)
- grenade_refill = {
- ["bloodgulch"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["hangemhigh"] = false,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = false,
- ["wizard"] = false
- }
- -- if set to true, rocket hogs will spawn first, then chain hogs
- rockethogs_spawn_first = {
- ["bloodgulch"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["hangemhigh"] = false,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = false,
- ["wizard"] = false
- }
- -- if set to true, active camo will be replaced by an overshield
- replace_camo = {
- ["bloodgulch"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["hangemhigh"] = true,
- ["ratrace"] = true,
- ["beavercreek"] = true,
- ["damnation"] = true,
- ["boardingaction"] = true,
- ["carousel"] = true,
- ["putput"] = true,
- ["prisoner"] = true,
- ["wizard"] = true
- }
- -- if set to true, players cannot kill other players by running them over
- block_splatter = {
- ["bloodgulch"] = false,
- ["dangercanyon"] = false,
- ["deathisland"] = false,
- ["gephyrophobia"] = false,
- ["icefields"] = false,
- ["infinity"] = false,
- ["sidewinder"] = false,
- ["timberland"] = false,
- ["hangemhigh"] = false,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = false,
- ["wizard"] = false
- }
- -- metaid of vehicle damage for blocking of splatter_damage
- if block_splatter[map_name] then
- if get_var(0, "$gt") ~= "n/a" then
- splatter_damage = get_tag_info("jpt!", "globals\\vehicle_collision")
- end
- end
- end
- function OnError(Message)
- print(debug.traceback())
- end
- -- WEAPON TAG NAMES: for use with replacement_weapon on line 24 at the top for replacing sniper and/or FRG
- -- "weapons\\assault rifle\\assault rifle" -- Assault Rifle
- -- "weapons\\flamethrower\\flamethrower" -- Flamethrower
- -- "weapons\\gravity rifle\\gravity rifle" -- Gravity Rifle
- -- "weapons\\needler\\mp_needler" -- Needler
- -- "weapons\\pistol\\pistol" -- Pistol
- -- "weapons\\plasma pistol\\plasma pistol" -- Plasma Pistol
- -- "weapons\\plasma rifle\\plasma rifle" -- Plasma Rifle
- -- "weapons\\plasma_cannon\\plasma_cannon" -- Fuel Rod
- -- "weapons\\rocket launcher\\rocket launcher" -- Rocket Launcher
- -- "weapons\\shotgun\\shotgun" -- Shotgun
- -- "weapons\\sniper rifle\\sniper rifle" -- Sniper Rifle
- -- Created by H® Shaft
- -- Visit http://halorace.org
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement