Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Death Messages V5 for stock PC/CE maps for SAPP
- -- by H® Shaft
- -- V5 Changelog: added teamkiller kill, and fixed melee, suicide was fixed, added show team switch variable, changed metaid method
- -- Script will show how players were killed/died: Normal death messages are blocked (no chat spam), examples :
- -- "H® Shaft was blasted by sehé°°'s banshee plasma cannon."
- -- "H® Shaft was blown-up by sehé°°'s's frag grenade."
- -- "H® Shaft was shot by Btcc22's sniper rifle."
- -- "H® Shaft was melee'd by Btcc22!"
- -- Will tell Killer and Victim if they were killed by Headshot (pistol and sniper only) "BOOM! You were headshot! by H® Shaft"
- -- Will show when a player died by: Falling, by Vehicle or Team Change, will not show if killed by the server
- -- Will show player their combination kills, and announce to everyone your sprees: "H® Shaft is on a Killing Spree!"
- -- Allows server admins to turn fall damage on/off PER map: see LoadDefaults() true, fall damage is on, false it is off (line 434)
- -- specify the amount of damage done by melee: 0 = disable melee kill, 1 = normal, 2 = double, 3 = triple, 4 = quadruple
- melee_damage = 2
- -- specify the amount of damage done by melee or backtap: 0 = disable backtap kill, 1 = normal, 2 = double, 3 = triple, 4 = quadruple
- backtap_damage = 4 -- note: this is disabled/commented out on lines 327-330
- -- Should a team killer be killed? (true = they will be killed, false they will not be killed)
- team_kill_karma = true
- -- message shown to team killer
- tk_message = "PLEASE DON'T KILL OR ATTACK YOUR OWN TEAM!"
- -- should team-switch message be shown? true = show message, false = don't show (set to false if using another script which shows team-switch)
- show_teamswitch = true
- -- don't edit --
- team_play = false
- last_damage = {}
- head_shot = {}
- back_tap = {}
- killed_by_nothing = {}
- api_version = "1.9.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_PRESPAWN'], "OnPlayerPreSpawn")
- register_callback(cb['EVENT_DAMAGE_APPLICATION'], "OnDamageApplication")
- register_callback(cb['EVENT_DIE'], "OnPlayerDie")
- register_callback(cb['EVENT_KILL'], "OnPlayerKill")
- register_callback(cb['EVENT_TEAM_SWITCH'], "OnTeamSwitch")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_LEAVE'], "OnPlayerLeave")
- -- suppress halo's death messages
- disable_killmsg_addr = sig_scan("8B42348A8C28D500000084C9") + 3
- original_code_1 = read_dword(disable_killmsg_addr)
- safe_write(true)
- write_dword(disable_killmsg_addr, 0x03EB01B1)
- safe_write(false)
- -- if a game is already running when loaded, do this
- if get_var(0, "$gt") ~= "n/a" then
- game_started = true
- team_play = getteamplay()
- LoadDefaults()
- map_name = get_var(1,"$map")
- for i=1,16 do
- if player_present(i) then
- last_damage[i] = 0
- killed_by_nothing[i] = false
- head_shot[i] = false
- back_tap[i] = false
- end
- end
- end
- end
- function OnScriptUnload()
- safe_write(true)
- write_dword(disable_killmsg_addr, original_code_1)
- safe_write(false)
- killed_by_nothing = {}
- last_damage = {}
- head_shot = {}
- back_tap = {}
- end
- function OnPlayerPreSpawn(PlayerIndex)
- last_damage[PlayerIndex] = 0
- head_shot[PlayerIndex] = false
- back_tap[PlayerIndex] = false
- end
- function OnNewGame()
- game_started = true
- team_play = getteamplay()
- map_name = get_var(1,"$map")
- if get_var(0, "$gt") ~= "n/a" then
- LoadDefaults()
- end
- for i=1,16 do
- if player_present(i) then
- last_damage[i] = 0
- killed_by_nothing[i] = false
- head_shot[i] = false
- back_tap[i] = false
- end
- end
- end
- function OnPlayerLeave(PlayerIndex)
- last_damage[PlayerIndex] = nil
- killed_by_nothing[PlayerIndex] = nil
- head_shot[PlayerIndex] = nil
- back_tap[PlayerIndex] = nil
- end
- function OnGameEnd()
- game_started = false
- for i=1,16 do
- if player_present(i) then
- last_damage[i] = 0
- killed_by_nothing[i] = false
- head_shot[i] = false
- back_tap[i] = false
- end
- end
- end
- function OnPlayerDie(PlayerIndex, KillerIndex)
- -- Killer Index is: -- falling = -1, server = -1, team-switch = -1, vehicle = 0, other players = 1 or greater
- if game_started then
- local vname = get_var(PlayerIndex, "$name")
- local vteam = get_var(PlayerIndex, "$team")
- local killer = tonumber(KillerIndex)
- if (killer == -1) then -- killer is the server
- if last_damage[PlayerIndex] == 0 then
- killed_by_nothing[PlayerIndex] = true
- rprint(PlayerIndex, vname.. " - You were killed by the server.")
- elseif last_damage[PlayerIndex] == falling_damage or last_damage[PlayerIndex] == distance_damage then
- say_all(vname.. " fell and died.")
- last_damage[PlayerIndex] = 0
- killed_by_nothing[PlayerIndex] = false
- end
- elseif (killer == 0) then -- killer is a vehicle
- if last_damage[PlayerIndex] == veh_damage then
- say_all(vname.. " was killed by a vehicle.")
- last_damage[PlayerIndex] = 0
- end
- elseif (killer == nil) then -- killer is unknown/glitch
- if last_damage[PlayerIndex] == 0 then
- say_all(vname.. " was killed by the guardians.")
- end
- elseif (killer > 0) then -- killer is a player
- local kname = get_var(KillerIndex, "$name")
- local kteam = get_var(KillerIndex, "$team")
- -- set default in case of glitch or reload
- if kname == nil then kname = "the server" end
- if kteam == nil then kteam = "yellow" end
- if PlayerIndex == killer then -- suicide - killer was self
- execute_command('say * "$name committed suicide."', PlayerIndex)
- elseif (team_play and (kteam == vteam) and (PlayerIndex ~= KillerIndex)) then -- teamkill/betray
- say_all(vname.. " was betrayed by " .. kname .. ".")
- rprint(KillerIndex, tk_message)
- if team_kill_karma then
- kill(KillerIndex)
- rprint(KillerIndex, "Karma is a bitch!")
- end
- elseif PlayerIndex ~= KillerIndex then -- killed by another player
- if last_damage[PlayerIndex] == veh_damage then -- killed by a vehicle
- if isinvehicle(KillerIndex) then
- say_all(vname.. " was run over by " .. kname .. ".")
- else
- say_all(vname.. " was killed by a vehicle.")
- end
- elseif last_damage[PlayerIndex] == banshee_bolt then
- say_all(vname.. " was shot by " .. kname .. "'s banshee guns. ")
- elseif last_damage[PlayerIndex] == banshee_explode then
- say_all(vname.. " was blasted by " .. kname .. "'s banshee plasma cannon. ")
- elseif last_damage[PlayerIndex] == turret_bolt then
- say_all(vname.. " was shot by " .. kname .. "'s turret. ")
- elseif last_damage[PlayerIndex] == ghost_bolt then
- say_all(vname.. " was shot by " .. kname .. "'s ghost guns. ")
- elseif last_damage[PlayerIndex] == tank_shell then
- say_all(vname.. " was blasted by " .. kname .. "'s tank shell. ")
- elseif last_damage[PlayerIndex] == tank_bullet then
- say_all(vname.. " was shot by " .. kname .. "'s tank guns. ")
- elseif last_damage[PlayerIndex] == chain_bullet then
- say_all(vname.. " was shot by " .. kname .. "'s chain gun. ")
- elseif last_damage[PlayerIndex] == assault_bullet then
- say_all(vname.. " was shot by " .. kname .. "'s assault rifle. ")
- elseif last_damage[PlayerIndex] == flame_explode then
- say_all(vname.. " was toasted by " .. kname .. "'s flame-thrower. ")
- elseif last_damage[PlayerIndex] == frag_explode then
- say_all(vname.. " was blown-up by " .. kname .. "'s frag grenade. ")
- elseif last_damage[PlayerIndex] == needle_detonate then
- say_all(vname.. " was shot by " .. kname .. "'s needler. ")
- elseif last_damage[PlayerIndex] == needle_explode then
- say_all(vname.. " was shot by " .. kname .. "'s needler. ")
- elseif last_damage[PlayerIndex] == needle_impact then
- say_all(vname.. " was shot by " .. kname .. "'s needler. ")
- elseif last_damage[PlayerIndex] == pistol_bullet then
- say_all(vname.. " was shot by " .. kname .. "'s pistol. ")
- if head_shot[PlayerIndex] then -- only the pistol and sniper actually cause fatal headshots
- rprint(PlayerIndex, "BOOM! You were headshot! by " .. kname)
- rprint(KillerIndex, "BOOM! headshot!")
- head_shot[PlayerIndex] = false
- end
- elseif last_damage[PlayerIndex] == plasma_attach then
- say_all(vname.. " was stickied by " .. kname .. "'s plasma grenade! ")
- elseif last_damage[PlayerIndex] == plasma_explode then
- say_all(vname.. " was blown-up by " .. kname .. "'s plasma grenade. ")
- elseif last_damage[PlayerIndex] == ppistol_bolt then
- say_all(vname.. " was shot by " .. kname .. "'s plasma pistol. ")
- elseif last_damage[PlayerIndex] == ppistol_charged then
- say_all(vname.. " was shot by " .. kname .. "'s plasma pistol. ")
- elseif last_damage[PlayerIndex] == prifle_bolt then
- say_all(vname.. " was shot by " .. kname .. "'s plasma rifle. ")
- elseif last_damage[PlayerIndex] == pcannon_explode then
- say_all(vname.. " was shot by " .. kname .. "'s plasma cannon. ")
- elseif last_damage[PlayerIndex] == rocket_explode then
- -- rocket warthog and rocket launcher use the same projectile, this will show different message for each
- if isinvehicle(KillerIndex) then
- say_all(vname.. " was blown-up by " .. kname .. "'s warthog rocket. ")
- else
- say_all(vname.. " was blown-up by " .. kname .. "'s rocket. ")
- end
- elseif last_damage[PlayerIndex] == shotgun_pellet then
- say_all(vname.. " was shot by " .. kname .. "'s shotgun. ")
- elseif last_damage[PlayerIndex] == sniper_bullet then
- say_all(vname.. " was shot by " .. kname .. "'s sniper rifle. ")
- if head_shot[PlayerIndex] then -- only the pistol and sniper actually cause fatal headshots
- rprint(PlayerIndex, "BOOM! You were headshot! by " .. kname)
- rprint(KillerIndex, "BOOM! headshot!")
- head_shot[PlayerIndex] = false
- end
- elseif last_damage[PlayerIndex] == assault_melee or
- last_damage[PlayerIndex] == assault_melee or
- last_damage[PlayerIndex] == ball_melee or
- last_damage[PlayerIndex] == flag_melee or
- last_damage[PlayerIndex] == flame_melee or
- last_damage[PlayerIndex] == needle_melee or
- last_damage[PlayerIndex] == pistol_melee or
- last_damage[PlayerIndex] == ppistol_melee or
- last_damage[PlayerIndex] == prifle_melee or
- last_damage[PlayerIndex] == pcannon_melee or
- last_damage[PlayerIndex] == rocket_melee or
- last_damage[PlayerIndex] == shotgun_melee or
- last_damage[PlayerIndex] == sniper_melee then
- say_all(vname.. " was melee'd by " .. kname .. "!")
- if back_tap[PlayerIndex] then -- backtap: melee from behind/top (rarely registers, if ever)
- rprint(PlayerIndex, "BOOM! You were bitch-slapped by " .. kname)
- rprint(KillerIndex, "BOOM! Bitch-slap!")
- back_tap[PlayerIndex] = false
- end
- -- if damage type was not recorded then
- elseif last_damage[PlayerIndex] == 0 then
- say_all(vname.. " was killed by " .. kname .. ".")
- end
- else
- -- if killer was none of the above, blame the guardians
- say_all(vname.. " was killed by the guardians. ")
- end
- end
- last_damage[PlayerIndex] = 0
- head_shot[PlayerIndex] = false
- back_tap[PlayerIndex] = false
- end
- end
- function OnTeamSwitch(PlayerIndex)
- if game_started then
- if team_play then
- if (killed_by_nothing[PlayerIndex] == true) then
- if show_teamswitch then
- say_all(get_var(PlayerIndex,"$name") .. " switched to the " .. get_var(PlayerIndex,"$team") .. " team.")
- end
- killed_by_nothing[PlayerIndex] = false
- end
- end
- end
- end
- function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
- if game_started then
- -- record players last damage
- last_damage[PlayerIndex] = MetaID
- -- if damage was to the head, record it
- if (HitString == "head") then
- head_shot[PlayerIndex] = true
- end
- -- melee damage? if so, apply modified amount
- if MetaID == assault_melee or
- MetaID == assault_melee or
- MetaID == ball_melee or
- MetaID == flag_melee or
- MetaID == flame_melee or
- MetaID == needle_melee or
- MetaID == pistol_melee or
- MetaID == ppistol_melee or
- MetaID == prifle_melee or
- MetaID == pcannon_melee or
- MetaID == rocket_melee or
- MetaID == shotgun_melee or
- MetaID == sniper_melee then
- return true, Damage * melee_damage
- end
- -- if player dies from falling (too far) or from fall impact (distance), and fall damage is OFF, block all damage
- if MetaID == falling_damage then
- last_damage[PlayerIndex] = falling_damage
- if not fall_damage[map_name] then
- return true, 0
- end
- elseif MetaID == distance_damage then
- last_damage[PlayerIndex] = distance_damage
- if not fall_damage[map_name] then
- return true, 0
- end
- end
- -- disabled for now/commented out
- -- backtap - (melee'd from behind) - this function *rarely* works with phasor, this function was taken from phasor
- --if Backtap then
- --back_tap[PlayerIndex] = true
- --return true, Damage * backtap_damage
- --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 OnPlayerKill(PlayerIndex, VictimIndex)
- local combo = tonumber(get_var(PlayerIndex, "$combo"))
- local spree = tonumber(get_var(PlayerIndex, "$streak"))
- local Name = get_var(PlayerIndex, "$name")
- if combo == 2 then
- rprint(PlayerIndex, "|r" .. "Double Kill!")
- elseif combo == 3 then
- rprint(PlayerIndex, "|r" .. "Triple Kill!")
- elseif combo == 4 then
- rprint(PlayerIndex, "|r" .. "Overkill!")
- elseif combo == 5 then
- rprint(PlayerIndex, "|r" .. "Killtacular!")
- elseif combo == 6 then
- rprint(PlayerIndex, "|r" .. "Killtrocity!")
- elseif combo == 7 then
- rprint(PlayerIndex, "|r" .. "Killimanjaro!")
- elseif combo == 8 then
- rprint(PlayerIndex, "|r" .. "Killtastrophe!")
- elseif combo == 9 then
- rprint(PlayerIndex, "|r" .. "Killpocalypse!")
- elseif combo == 10 then
- rprint(PlayerIndex, "|r" .. "Killionaire!")
- end
- if spree == 5 then
- AnnounceSpree(Name, "is on a Killing Spree!")
- elseif spree == 10 then
- AnnounceSpree(Name, "is in a Killing Frenzy!")
- elseif spree == 15 then
- AnnounceSpree(Name, "just got a Running Riot!")
- elseif spree == 20 then
- AnnounceSpree(Name, "is on a Rampage!")
- elseif spree == 25 then
- AnnounceSpree(Name, "is Untouchable!")
- elseif spree == 30 then
- AnnounceSpree(Name, "is Inconceivable!")
- elseif spree == 35 then
- AnnounceSpree(Name, "is Unfrigginbelievable!")
- elseif spree == 40 then
- AnnounceSpree(Name, "is running AMOK!")
- elseif spree >= 50 then
- AnnounceSpree(Name, "is going BESERK!")
- end
- end
- function AnnounceSpree(Name, Message)
- for i = 1,16 do
- if player_present(i) then
- rprint(i, "|r" .. "" .. Name .. " " .. Message)
- end
- end
- end
- function isinvehicle(PlayerIndex)
- local player_object = get_dynamic_player(PlayerIndex)
- local vehicleId = read_dword(player_object + 0x11C)
- if vehicleId == 0xFFFFFFFF then
- return false
- else
- return true
- end
- end
- function getteamplay()
- if get_var(0,"$ffa") == "0" then
- return true
- else
- return false
- end
- end
- function LoadDefaults()
- -- turn fall damage on (true) or off (false) for each map,
- -- note: damnation & gephyrophobia players can get stuck on bottom if it's turned off (set to false)
- fall_damage = {
- ["beavercreek"] = true,
- ["bloodgulch"] = true,
- ["boardingaction"] = true,
- ["carousel"] = true,
- ["chillout"] = true,
- ["damnation"] = true,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["hangemhigh"] = true,
- ["icefields"] = true,
- ["infinity"] = true,
- ["longest"] = true,
- ["prisoner"] = true,
- ["putput"] = true,
- ["ratrace"] = true,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["wizard"] = true
- }
- if game_started then
- if get_var(0, "$gt") ~= "n/a" then
- falling_damage = get_tag_info("jpt!", "globals\\falling")
- distance_damage = get_tag_info("jpt!", "globals\\distance")
- veh_damage = get_tag_info("jpt!", "globals\\vehicle_collision")
- banshee_bolt = get_tag_info("jpt!", "vehicles\\banshee\\banshee bolt")
- banshee_explode = get_tag_info("jpt!", "vehicles\\banshee\\mp_fuel rod explosion")
- turret_bolt = get_tag_info("jpt!", "vehicles\\c gun turret\\mp bolt")
- ghost_bolt = get_tag_info("jpt!", "vehicles\\ghost\\ghost bolt")
- tank_shell = get_tag_info("jpt!", "vehicles\\scorpion\\shell explosion")
- tank_bullet = get_tag_info("jpt!", "vehicles\\scorpion\\bullet")
- chain_bullet = get_tag_info("jpt!", "vehicles\\warthog\\bullet")
- assault_bullet = get_tag_info("jpt!", "weapons\\assault rifle\\bullet")
- assault_melee = get_tag_info("jpt!", "weapons\\assault rifle\\melee")
- ball_melee = get_tag_info("jpt!", "weapons\\ball\\melee")
- flag_melee = get_tag_info("jpt!", "weapons\\flag\\melee")
- flame_explode = get_tag_info("jpt!", "weapons\\flamethrower\\explosion")
- flame_melee = get_tag_info("jpt!", "weapons\\flamethrower\\melee")
- frag_explode = get_tag_info("jpt!", "weapons\\frag grenade\\explosion")
- needle_detonate = get_tag_info("jpt!", "weapons\\needler\\detonation damage")
- needle_explode = get_tag_info("jpt!", "weapons\\needler\\explosion")
- needle_impact = get_tag_info("jpt!", "weapons\\needler\\impact damage")
- needle_melee = get_tag_info("jpt!", "weapons\\needler\\melee")
- pistol_bullet = get_tag_info("jpt!", "weapons\\pistol\\bullet")
- pistol_melee = get_tag_info("jpt!", "weapons\\pistol\\melee")
- plasma_attach = get_tag_info("jpt!", "weapons\\plasma grenade\\attached")
- plasma_explode = get_tag_info("jpt!", "weapons\\plasma grenade\\explosion")
- ppistol_bolt = get_tag_info("jpt!", "weapons\\plasma pistol\\bolt")
- ppistol_charged = get_tag_info("jpt!", "weapons\\plasma rifle\\charged bolt")
- ppistol_melee = get_tag_info("jpt!", "weapons\\plasma pistol\\melee")
- prifle_bolt = get_tag_info("jpt!", "weapons\\plasma rifle\\bolt")
- prifle_melee = get_tag_info("jpt!", "weapons\\plasma rifle\\melee")
- pcannon_explode = get_tag_info("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion")
- pcannon_melee = get_tag_info("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_melee")
- rocket_explode = get_tag_info("jpt!", "weapons\\rocket launcher\\explosion")
- rocket_melee = get_tag_info("jpt!", "weapons\\rocket launcher\\melee")
- shotgun_pellet = get_tag_info("jpt!", "weapons\\shotgun\\pellet")
- shotgun_melee = get_tag_info("jpt!", "weapons\\shotgun\\melee")
- sniper_bullet = get_tag_info("jpt!", "weapons\\sniper rifle\\sniper bullet")
- sniper_melee = get_tag_info("jpt!", "weapons\\sniper rifle\\melee")
- end
- end
- end
- function OnError(Message)
- print(debug.traceback())
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement