Advertisement
HR_Shaft

Shotgun-Melee-Only 1.0 for Phasor v2

Oct 11th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.26 KB | None | 0 0
  1. --[[ ###  Shotgun-Melee-Only  ### ]]--
  2. --[[ ###      by H® Shaft     ### ]]--
  3. --[[ ###    for Phasor v2     ### ]]--
  4.  
  5. -- Note: gametype weapons need to be set to: normal & generic, and infinite grenades turned off
  6.  
  7. -- don't edit --
  8. team_play = false
  9.  
  10. function GetRequiredVersion()
  11.     return 200
  12. end
  13.  
  14. function OnScriptLoad(process, game, persistent)
  15.     if game == true or game == "PC" then
  16.         GAME = "PC"
  17.         gametype_base = 0x671340
  18.     else
  19.         GAME = "CE"
  20.         gametype_base = 0x5F5498
  21.     end
  22.     Team_Play = readbyte(gametype_base + 0x34) 
  23.     if Team_Play == 1 then
  24.         team_play = true
  25.     else
  26.         team_play = false
  27.     end
  28. end
  29.  
  30. function OnNewGame(map)
  31.     if GAME == "PC" then
  32.         gametype_base = 0x671340
  33.     elseif GAME == "CE" then
  34.         gametype_base = 0x5F5498
  35.     end
  36.     Team_Play = readbyte(gametype_base + 0x34)  
  37.     if Team_Play == 1 then
  38.         team_play = true
  39.     else
  40.         team_play = false
  41.     end
  42. end
  43.  
  44. function OnPlayerJoin(player)
  45.     welcomemsg = registertimer(6000, "timedwelcome", player)
  46. end
  47.  
  48. function OnPlayerSpawn(player, m_objectId)
  49.     if getobject(m_objectId) then
  50.         registertimer(50, "AssignShotty", player)
  51.     end
  52. end
  53.  
  54. function AssignShotty(id, count, player)
  55.     if getplayerobjectid(player) then
  56.         local m_objectId = getplayerobjectid(player)
  57.         local m_object = getobject(m_objectId)
  58.         for i = 0,3 do
  59.             local weapID = readdword(getobject(m_objectId), 0x2F8 + i*4)
  60.             if weapID ~= 0xFFFFFFFF then
  61.                 destroyobject(weapID)
  62.             end
  63.         end
  64.         if m_object then
  65.             writebyte(m_object, 0x31E, 0)
  66.             writebyte(m_object, 0x31F, 0)
  67.         end    
  68.         local shotty = "weapons\\shotgun\\shotgun"
  69.         local tag = gettagid("weap", shotty)
  70.         local shotgun = createobject(tag, 0, 30, false, 0, 0, 0)
  71.         local m_weapon = getobject(shotgun)    
  72.         assignweapon(player, shotgun)
  73.         if m_weapon then
  74.             writeword(m_weapon + 0x2B6, 0)
  75.             writeword(m_weapon + 0x2B8, 0)
  76.             updateammo(shotgun)
  77.         end
  78.     end
  79. end
  80.  
  81. function timedwelcome(id, count, player)
  82.     if count == 1 then
  83.         if getplayer(player) then
  84.             privatesay(player, "Kill your enemies by melee!")
  85.         end
  86.     end
  87.     return true
  88. end
  89.  
  90. function OnGameEnd(stage)
  91.     if stage == 1 then
  92.         if welcomemsg then
  93.             removetimer(welcomemsg)
  94.             welcomemsg = nil
  95.         end
  96.     end
  97. end
  98.  
  99. function OnDamageLookup(receiving, causing, mapId)
  100.     local tagname, tagtype = gettaginfo(mapId)
  101.     if causing and receiving then
  102.         local c_object = getobject(causing)
  103.         local r_object = getobject(receiving)
  104.         local melee = string.find(tagname, "melee")
  105.         if c_object and r_object then
  106.             local causer = objectaddrtoplayer(c_object)
  107.             local receiver = objectaddrtoplayer(r_object)
  108.             if causer and receiver then
  109.                 local c_team = getteam(causer)
  110.                 local r_team = getteam(receiver)
  111.                 if melee then odl_multiplier(500) end
  112.                 if team_play and c_team == r_team and causer ~= receiver then
  113.                     return false
  114.                 end
  115.             end    
  116.         end
  117.     end    
  118.     return nil
  119. end
  120.    
  121. function OnObjectCreationAttempt(mapId, parentId, player)
  122.     if mapId == gettagid("eqip", "weapons\\frag grenade\\frag grenade") then
  123.         return false
  124.     end
  125.     if mapId == gettagid("eqip", "weapons\\plasma grenade\\plasma grenade") then
  126.         return false
  127.     end
  128. end
  129.  
  130. function OnObjectInteraction(player, objId, mapId)
  131.     local Pass = nil
  132.     local name, type = gettaginfo(mapId)
  133.     if type == "weap" then
  134.         if name == "weapons\\assault rifle\\assault rifle" or
  135.             name == "weapons\\ball\\ball" or
  136.             name == "weapons\\flag\\flag" or
  137.             name == "weapons\\flamethrower\\flamethrower" or
  138.             name == "weapons\\needler\\mp_needler" or
  139.             name == "weapons\\pistol\\pistol" or
  140.             name == "weapons\\plasma pistol\\plasma pistol" or
  141.             name == "weapons\\plasma rifle\\plasma rifle" or
  142.             name == "weapons\\plasma_cannon\\plasma_cannon" or
  143.             name == "weapons\\rocket launcher\\rocket launcher" or
  144.             name == "weapons\\shotgun\\shotgun" or
  145.             name == "weapons\\sniper rifle\\sniper rifle" then
  146.         Pass = false
  147.         end
  148.     end
  149.     if type == "eqip" then
  150.         if name == "weapons\\frag grenade\\frag grenade" or name == "weapons\\plasma grenade\\plasma grenade" then
  151.             Pass = false
  152.         end
  153.     end
  154.     return Pass
  155. end
  156.  
  157. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  158. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  159. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement