--[[ ### Death-Kill Messages V4 ###]]-- --[[ ### by H® Shaft, AelitePrime ###]]-- --[[ ### for Phasor v2 ###]]-- -- Updated better code. Added additional string generators for melee kills. last_damage = {} team_change = {} function GetRequiredVersion() return 200 end function OnScriptLoad(process, game, persistent) for i=0,15 do if getplayer(i) then team_change[i] = false end end last_damage = {} team_change = {} end function OnNewGame(map) for i=0,15 do if getplayer(i) then team_change[i] = false end end last_damage = {} team_change = {} end function OnGameEnd(stage) if stage == 1 then if announce then removetimer(announce) announce = nil end end end function OnPlayerJoin(player) if getplayer(player) then team_change[player] = false end end function OnDamageApplication(receiving, causing, tagid, hit, backtap) if receiving then local r_object = getobject(receiving) if r_object then local receiver = objectaddrtoplayer(r_object) if receiver then local r_hash = gethash(receiver) local tagname,tagtype = gettaginfo(tagid) last_damage[r_hash] = tagname end end end end function OnPlayerSpawnEnd(player, m_objectId) if getplayer(player) then local hash = gethash(player) last_damage[hash] = nil team_change[player] = false end end function OnPlayerKill(killer, victim, mode) local response = false if mode == 0 then -- player was killed by the server response = false local killedmsg = generatekilltype(killslang) if getplayer(victim) then say(getname(victim) .. " was killed by the server script or an admin. ") end elseif mode == 1 then -- player was killed by falling or team-change response = false if getplayer(victim) then local vhash = gethash(victim) if not team_change[victim] then response = false if last_damage[vhash] == "globals\\distance" or last_damage[vhash] == "globals\\falling" then say(getname(victim) .. " fell and died. ") end else response = false say(getname(victim) .. " changed teams.") team_change[victim] = false end end elseif mode == 2 then -- player was killed by the guardians response = false if getplayer(victim) then say(getname(victim) .. " was killed by the guardians. ") end elseif mode == 3 then -- player was killed by vehicle response = false if getplayer(victim) then local vhash = gethash(victim) say(getname(victim) .. " was killed by a vehicle. ") end elseif mode == 4 then -- player was killed by another player, killer is not always valid, victim is always valid response = false local killedmsg = generatekilltype(killslang) if getplayer(victim) then local vhash = gethash(victim) if last_damage[vhash] then if getplayer(killer) ~= nil then if string.find(last_damage[vhash], "melee") then say(getname(killer) .. " " .. generatehitslang(hit) .. " " .. getname(victim) .. " upside the " .. generateheadslang(head) .. "!") elseif last_damage[vhash] == "globals\\distance" or last_damage[vhash] == "globals\\falling" then say(getname(victim) .. " fell and died. ") elseif last_damage[vhash] == "globals\\vehicle_collision" then say(getname(killer) .. " ran over " .. getname(victim)) elseif string.find(last_damage[vhash], "banshee") then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a banshee. ") elseif last_damage[vhash] == "vehicles\\c gun turret\\mp bolt" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with the covenant turret. ") elseif last_damage[vhash] == "vehicles\\ghost\\ghost bolt" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with the ghost plasma guns. ") elseif last_damage[vhash] == "vehicles\\scorpion\\bullet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with the scorpion guns. ") elseif last_damage[vhash] == "vehicles\\scorpion\\shell explosion" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with the scorpion cannon. ") elseif last_damage[vhash] == "vehicles\\warthog\\bullet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a warthog chain-gun. ") elseif last_damage[vhash] == "weapons\\assault rifle\\bullet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with an assault rifle. ") elseif last_damage[vhash] == "weapons\\flamethrower\\burning" or last_damage[vhash] == "weapons\\flamethrower\\explosion" or last_damage[vhash] == "weapons\\flamethrower\\impact damage" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a flame-thrower. ") elseif last_damage[vhash] == "weapons\\frag grenade\\explosion" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a frag grenade. ") elseif last_damage[vhash] == "weapons\\needler\\detonation damage" or last_damage[vhash] == "weapons\\needler\\explosion" or last_damage[vhash] == "weapons\\needler\\impact damage" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a needler. ") elseif last_damage[vhash] == "weapons\\pistol\\bullet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a pistol. ") elseif last_damage[vhash] == "weapons\\plasma grenade\\attached" or last_damage[vhash] == "weapons\\plasma grenade\\explosion" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a plasma grenade. ") elseif last_damage[vhash] == "weapons\\plasma pistol\\bolt" or last_damage[vhash] == "weapons\\plasma rifle\\charged bolt" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a plasma pistol. ") elseif last_damage[vhash] == "weapons\\plasma rifle\\bolt" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a plasma rifle. ") elseif last_damage[vhash] == "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion" or last_damage[vhash] == "weapons\\plasma_cannon\\impact damage" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a fuel-rod gun. ") elseif last_damage[vhash] == "weapons\\rocket launcher\\explosion" then if isinvehicle(killer) then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a warthog rocket. ") else say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a rocket launcher. ") end elseif last_damage[vhash] == "weapons\\shotgun\\pellet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a shotgun. ") elseif last_damage[vhash] == "weapons\\sniper rifle\\sniper bullet" then say(getname(killer) .. " " .. killedmsg .. " " .. getname(victim) .. " with a sniper rifle. ") end end end end elseif mode == 5 then -- player was killed by teammate response = true if getplayer(killer) then privatesay(killer, " -- DON'T BETRAY! --") end elseif mode == 6 then --suicides response = false if getplayer(victim) then local vhash = gethash(victim) if last_damage[vhash] then if last_damage[vhash] == "weapons\\frag grenade\\explosion" or last_damage[vhash] == "weapons\\plasma grenade\\attached" or last_damage[vhash] == "weapons\\plasma grenade\\explosion" then say(getname(victim) .. " desperately attempted to replace the grenade pin. ") end end say(getname(victim) .. " committed suicide.") end end return response end function OnTeamChange(player, old_team, new_team, relevant) if getplayer(player) then team_change[player] = true end return nil end function generatekilltype(killslang) local killcount = #killtype local rand_type = getrandomnumber(1, killcount+1) local kill_type = string.format("%s", killtype[rand_type]) if kill_type then return kill_type else return "killed" end end function generateheadslang(head) local headcount = #headslang local rand_type = getrandomnumber(1, headcount+1) local head_type = string.format("%s", headslang[rand_type]) if head_type then return head_type else return "head" end end function generatehitslang(hit) local hitcount = #hitslang local rand_type = getrandomnumber(1, hitcount+1) local hit_type = string.format("%s", hitslang[rand_type]) if hit_type then return hit_type else return "hit" end end killtype = {"destroyed", "fubarred", "disemboweled", "violated", "eviscerated", "assassinated", "slaughtered", "exterminated", "murdered", "mutilated", "eradicated", "executed", "snuffed", "eliminated", "liquidated", "dominated", "castrated", "dirt-napped", "ghosted", "hosed", "smeared", "flatlined", "vaporized", "de-boned"} headslang = {"noggin", "melon", "head", "dome", "noodle", "brain-pan", "cranium", "skull", "bean"} hitslang = {"smacked", "punched", "whacked", "clocked", "thumped", "slugged", "cuffed", "walloped", "throttled", "pimp-slapped", "hammered", "bopped", "beat", "slapped"} -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard. -- Visit http://halorace.org/forum/index.php?topic=514.0 or -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts