Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Death Messages for stock PC/CE maps for SAPP
- -- by H® Shaft
- -- 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 382)
- -- don't edit --
- game_started = false
- 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")
- 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 get_var(0, "$gt") ~= "n/a" then
- game_started = true
- team_play = getteamplay()
- GetMetaIDs()
- 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
- map_name = get_var(1,"$map")
- team_play = getteamplay()
- GetMetaIDs()
- LoadDefaults()
- 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] = false
- 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 == true) then
- local vname = get_var(PlayerIndex, "$name")
- local vteam = get_var(PlayerIndex, "$team")
- local killer = tonumber(KillerIndex)
- if (killer == -1) then
- if last_damage[PlayerIndex] == 0 then
- killed_by_nothing[PlayerIndex] = true
- 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
- if last_damage[PlayerIndex] == veh_damage then
- say_all(vname.. " was killed by a vehicle.")
- last_damage[PlayerIndex] = 0
- end
- elseif (killer == nil) then
- if last_damage[PlayerIndex] == 0 then
- say_all(vname.. " was killed by the guardians.")
- end
- elseif (killer > 0) then
- local kname = get_var(KillerIndex, "$name")
- local kteam = get_var(KillerIndex, "$team")
- if PlayerIndex ~= KillerIndex then
- if last_damage[PlayerIndex] == veh_damage then
- 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 headshots
- say(PlayerIndex, "BOOM! You were headshot! by " .. kname)
- say(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
- 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 headshots
- say(PlayerIndex, "BOOM! You were headshot! by " .. kname)
- say(KillerIndex, "BOOM! headshot!")
- head_shot[PlayerIndex] = false
- end
- elseif back_tap[PlayerIndex] then
- say_all(vname.. " was melee'd by " .. kname .. "!")
- back_tap[PlayerIndex] = false
- elseif last_damage[PlayerIndex] == 0 then
- say_all(vname.. " was killed by " .. kname .. ".")
- end
- elseif PlayerIndex == KillerIndex then
- say_all(vname.. " committed suicide, derp.")
- if not team_play then
- if read_dword(get_player(PlayerIndex) + 0xC0) > 0 then
- write_dword(get_player(PlayerIndex) + 0xC0, 0)
- end
- end
- elseif kteam == vteam and PlayerIndex ~= KillerIndex then
- if team_play then
- say_all(vname.. " was betrayed by " .. kname .. ".")
- end
- else
- 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 == true) then
- if team_play then
- if (killed_by_nothing[PlayerIndex] == true) then
- say_all(get_var(PlayerIndex,"$name") .. " switched to the " .. get_var(PlayerIndex,"$team") .. " team.")
- killed_by_nothing[PlayerIndex] = false
- end
- end
- end
- end
- function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
- if (game_started == true) then
- local melee_damage = Damage * 2
- if (HitString == "head") then
- head_shot[PlayerIndex] = true
- end
- if (Backtap == true) then
- back_tap[PlayerIndex] = true
- return true, melee_damage
- end
- 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
- last_damage[PlayerIndex] = MetaID
- end
- end
- function GetMetaIDs()
- falling_damage = read_dword(lookup_tag("jpt!", "globals\\falling") + 12)
- distance_damage = read_dword(lookup_tag("jpt!", "globals\\distance") + 12)
- veh_damage = read_dword(lookup_tag("jpt!", "globals\\vehicle_collision") + 12)
- banshee_bolt = read_dword(lookup_tag("jpt!", "vehicles\\banshee\\banshee bolt") + 12)
- banshee_explode = read_dword(lookup_tag("jpt!", "vehicles\\banshee\\mp_fuel rod explosion") + 12)
- turret_bolt = read_dword(lookup_tag("jpt!", "vehicles\\c gun turret\\mp bolt") + 12)
- ghost_bolt = read_dword(lookup_tag("jpt!", "vehicles\\ghost\\ghost bolt") + 12)
- tank_shell = read_dword(lookup_tag("jpt!", "vehicles\\scorpion\\shell explosion") + 12)
- tank_bullet = read_dword(lookup_tag("jpt!", "vehicles\\scorpion\\bullet") + 12)
- chain_bullet = read_dword(lookup_tag("jpt!", "vehicles\\warthog\\bullet") + 12)
- assault_bullet = read_dword(lookup_tag("jpt!", "weapons\\assault rifle\\bullet") + 12)
- assault_melee = read_dword(lookup_tag("jpt!", "weapons\\assault rifle\\melee") + 12)
- ball_melee = read_dword(lookup_tag("jpt!", "weapons\\ball\\melee") + 12)
- flag_melee = read_dword(lookup_tag("jpt!", "weapons\\flag\\melee") + 12)
- flame_explode = read_dword(lookup_tag("jpt!", "weapons\\flamethrower\\explosion") + 12)
- flame_melee = read_dword(lookup_tag("jpt!", "weapons\\flamethrower\\melee") + 12)
- frag_explode = read_dword(lookup_tag("jpt!", "weapons\\frag grenade\\explosion") + 12)
- needle_detonate = read_dword(lookup_tag("jpt!", "weapons\\needler\\detonation damage") + 12)
- needle_explode = read_dword(lookup_tag("jpt!", "weapons\\needler\\explosion") + 12)
- needle_impact = read_dword(lookup_tag("jpt!", "weapons\\needler\\impact damage") + 12)
- needle_melee = read_dword(lookup_tag("jpt!", "weapons\\needler\\melee") + 12)
- pistol_bullet = read_dword(lookup_tag("jpt!", "weapons\\pistol\\bullet") + 12)
- pistol_melee = read_dword(lookup_tag("jpt!", "weapons\\pistol\\melee") + 12)
- plasma_attach = read_dword(lookup_tag("jpt!", "weapons\\plasma grenade\\attached") + 12)
- plasma_explode = read_dword(lookup_tag("jpt!", "weapons\\plasma grenade\\explosion") + 12)
- ppistol_bolt = read_dword(lookup_tag("jpt!", "weapons\\plasma pistol\\bolt") + 12)
- ppistol_charged = read_dword(lookup_tag("jpt!", "weapons\\plasma rifle\\charged bolt") + 12)
- ppistol_melee = read_dword(lookup_tag("jpt!", "weapons\\plasma pistol\\melee") + 12)
- prifle_bolt = read_dword(lookup_tag("jpt!", "weapons\\plasma rifle\\bolt") + 12)
- prifle_melee = read_dword(lookup_tag("jpt!", "weapons\\plasma rifle\\melee") + 12)
- pcannon_explode = read_dword(lookup_tag("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion") + 12)
- pcannon_melee = read_dword(lookup_tag("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_melee") + 12)
- rocket_explode = read_dword(lookup_tag("jpt!", "weapons\\rocket launcher\\explosion") + 12)
- rocket_melee = read_dword(lookup_tag("jpt!", "weapons\\rocket launcher\\melee") + 12)
- shotgun_pellet = read_dword(lookup_tag("jpt!", "weapons\\shotgun\\pellet") + 12)
- shotgun_melee = read_dword(lookup_tag("jpt!", "weapons\\shotgun\\melee") + 12)
- sniper_bullet = read_dword(lookup_tag("jpt!", "weapons\\sniper rifle\\sniper bullet") + 12)
- sniper_melee = read_dword(lookup_tag("jpt!", "weapons\\sniper rifle\\melee") + 12)
- 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
- 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
- }
- 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