Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Super Melee v1 ###]]--
- --[[ ### by H® Shaft for Phasor v2 ###]]--
- -- Creates a super melee that damages enemies in or out of vehicles. Just press your melee key (F).
- -- Plus, it improves gameplay for CTF flag carriers allowing them to defend/attack vehicles.
- -- don't edit --
- melee = {}
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- LoadTags()
- end
- function OnDamageLookup(receiving, causing, tagid)
- local tagname, tagtype = gettaginfo(tagid)
- local melee = string.find(tagname, "melee")
- if receiving then
- local r_player = objectidtoplayer(receiving)
- elseif causing then
- local c_player = objectidtoplayer(causing)
- end
- if receiving and (causing == receiving) and tagid == rocket_expl_id then
- return false
- elseif receiving and causing and (receiving ~= causing) and tagid == rocket_expl_id then
- if c_player and r_player then
- if getteam(c_player) == getteam(r_player) then
- return false
- else
- odl_multiplier(2)
- end
- end
- elseif receiving and causing and (receiving ~= causing) and melee then
- if c_player and r_player then
- if getteam(c_player) == getteam(r_player) then
- return false
- else
- odl_multiplier(5)
- end
- end
- end
- return nil
- end
- function OnClientUpdate(player)
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local m_object = getobject(m_objectId)
- local supermelee = readbyte(m_object + 0x2A4)
- if supermelee == 7 then
- writebyte(m_object + 0x2A4, 0)
- local x,y,z = getobjectcoords(m_objectId)
- melee[player] = registertimer(0, "SuperMelee", {player, x, y, z})
- end
- end
- end
- function SuperMelee(id, count, arg)
- local player = arg[1]
- local x,y,z = arg[2], arg[3], arg[4]
- if count == 1 then
- if player and x and y and z then
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local grunt = generategrunt(grunt)
- local supermelee = createobject(rocket_id, m_objectId, 0, false, x, y, z+3)
- local m_melee = getobject(supermelee)
- writefloat(m_melee + 0x70, -5)
- sendconsoletext(player, grunt)
- end
- end
- end
- return false
- end
- function OnGameEnd(stage)
- if stage == 1 then
- for i=0,15 do
- if getplayer(i) then
- if melee[i] then
- removetimer(melee[i])
- melee[i] = nil
- end
- end
- end
- end
- end
- function LoadTags()
- rocket_expl_id = gettagid("jpt!", "weapons\\rocket launcher\\explosion")
- rocket_id = gettagid("proj", "weapons\\rocket launcher\\rocket")
- end
- function generategrunt(grunt)
- local gruntcount = #grunt
- local rand_grunt = getrandomnumber(1, gruntcount+1)
- local grunt_type = string.format("%s", grunt[rand_grunt])
- if grunt_type then
- return grunt_type
- else
- return nil
- end
- end
- grunt = {"Uhn!", "Hiyah!", "Umph!", "Doh!", "Fuuuh!", "Efff!", "Nuh!", "Arrg!", "Ack!", "Boing!", "Thwack!"}
- -- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement