HR_Shaft

Flamethrowers Infinite Ammo v1 for Phasor v2

Mar 30th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.30 KB | None | 0 0
  1. --[[ ###  Flamethrowers Infinite Ammo v1  ###]]--
  2. --[[ ###    by H® Shaft for Phasor v2     ###]]--
  3.  
  4. -- gametype MUST have weapons set to generic
  5.  
  6. team_play = false
  7. weapons = {}
  8.  
  9. function GetRequiredVersion()
  10.     return 200
  11. end
  12.  
  13. function OnScriptLoad(process, game, persistent)
  14.     if game == true or game == "PC" then
  15.         GAME = "PC"
  16.         gametype_base = 0x671340
  17.         map_name = readstring(0x698F21)
  18.     else
  19.         GAME = "CE"
  20.         gametype_base = 0x5F5498
  21.         map_name = readstring(0x61D151)
  22.     end
  23.     for i=0,15 do
  24.         if getplayer(i) then
  25.             weapons[i] = {}
  26.         end
  27.     end    
  28.     gametype = readbyte(gametype_base + 0x30)
  29.     if getteamplay() == true then team_play = true else team_play = false end  
  30. end
  31.  
  32. function OnNewGame(map)
  33.     if GAME == "PC" then
  34.         gametype_base = 0x671340
  35.         map_name = readstring(0x698F21)
  36.     elseif GAME == "CE" then
  37.         gametype_base = 0x5F5498
  38.         map_name = readstring(0x61D151)
  39.     end
  40.     for i=0,15 do
  41.         if getplayer(i) then
  42.             weapons[i] = {}
  43.         end
  44.     end
  45.     gametype = readbyte(gametype_base + 0x30)
  46.     if getteamplay() == true then team_play = true else team_play = false end      
  47. end    
  48.    
  49. function getteamplay()
  50.     if readbyte(gametype_base + 0x34) == 1 then
  51.         return true
  52.     else
  53.         return false
  54.     end
  55. end
  56.  
  57. function OnPlayerJoin(player)
  58.     if getplayer(player) then
  59.         weapons[player] = nil
  60.         sendconsoletext(player, "Flamethrowers! Unlimited Ammo!")
  61.     end
  62. end
  63.  
  64. function OnPlayerKill(killer, victim, mode)
  65.     if getplayer(victim) then
  66.         weapons[victim] = nil
  67.     end
  68. end
  69.  
  70. function OnPlayerLeave(player)
  71.     if getplayer(player) then
  72.         weapons[player] = nil
  73.     end
  74. end
  75.  
  76. function OnPlayerSpawn(player, m_objectId)
  77.     if getplayer(player) then
  78.         weapons[player] = nil
  79.         local m_objectId = getplayerobjectid(player)   
  80.         if m_objectId then
  81.             gameweap = registertimer(0, "AssignGameWeapons", player)
  82.         end
  83.     end
  84. end
  85.  
  86. function AssignGameWeapons(id, count, player)
  87.     if getplayer(player) then
  88.         local m_objectId = getplayerobjectid(player)
  89.         local m_object = getobject(m_objectId)
  90.         local clip = 0
  91.         local ammo = 9999
  92.         if m_objectId then
  93.             for i = 0,3 do
  94.                 local weapID = readdword(getobject(m_objectId), 0x2F8 + i*4)
  95.                 if weapID ~= 0xFFFFFFFF then
  96.                     destroyobject(weapID)
  97.                 end
  98.             end
  99.             if m_object then
  100.                 writebyte(m_object + 0x31E, 1)
  101.                 writebyte(m_object + 0x31F, 1) 
  102.             end            
  103.             local m_weaponId = createobject(gettagid("weap", "weapons\\flamethrower\\flamethrower"), 0, 10, false, 0, 0, 0)
  104.             weapons[player] = "weapons\\flamethrower\\flamethrower"
  105.             clip = 100
  106.             assignweapon(player, m_weaponId)
  107.             local m_weapon = getobject(m_weaponId)
  108.             if m_weapon then
  109.                 writeword(m_weapon + 0x2B6, ammo)
  110.                 writeword(m_weapon + 0x2B8, clip)
  111.                 updateammo(m_weaponId)
  112.             end
  113.         end
  114.     end
  115.     return false
  116. end
  117.  
  118. function OnObjectInteraction(player, objId, mapId)
  119.     local Pass = nil
  120.     local name, type = gettaginfo(mapId)
  121.     if type == "weap" then
  122.         if gametype == 1 or gametype == 3 then
  123.             if name == "weapons\\ball\\ball" or name == "weapons\\flag\\flag" then
  124.                 Pass = true
  125.             elseif weapons[player] ~= nil then
  126.                 if name ~= weapons[player] then
  127.                     Pass = false
  128.                 end
  129.             end
  130.         else
  131.             if weapons[player] ~= nil then
  132.                 if name ~= weapons[player] then
  133.                     Pass = false
  134.                 end
  135.             end
  136.         end
  137.     end
  138.     return Pass
  139. end
  140.  
  141. function OnObjectCreationAttempt(mapId, parentId, player)
  142.     if mapId == gettagid("weap", "weapons\\assault rifle\\assault rifle") or
  143.         mapId == gettagid("weap", "weapons\\rocket launcher\\rocket launcher") or
  144.         mapId == gettagid("weap", "weapons\\pistol\\pistol") or
  145.         mapId == gettagid("weap", "weapons\\plasma pistol\\plasma pistol") or
  146.         mapId == gettagid("weap", "weapons\\plasma rifle\\plasma rifle") or
  147.         mapId == gettagid("weap", "weapons\\plasma_cannon\\plasma_cannon") or
  148.         mapId == gettagid("weap", "weapons\\sniper rifle\\sniper rifle") or
  149.         mapId == gettagid("weap", "weapons\\needler\\mp_needler") or
  150.         mapId == gettagid("weap", "weapons\\shotgun\\shotgun") then
  151.         return false
  152.     end
  153. end
  154.  
  155. function OnGameEnd(stage)
  156.     if stage == 1 then
  157.         if gameweap then
  158.             removetimer(gameweap)
  159.             gameweap = nil
  160.         end    
  161.     end    
  162. end
  163.  
  164. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  165. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  166. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment