Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Assault Rifle Infinite Ammo v1 ###]]--
- --[[ ### by Hยฎ Shaft for Phasor v2 ###]]--
- -- gametype MUST have weapons set to generic
- team_play = false
- weapons = {}
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- gametype_base = 0x671340
- map_name = readstring(0x698F21)
- else
- GAME = "CE"
- gametype_base = 0x5F5498
- map_name = readstring(0x61D151)
- end
- for i=0,15 do
- if getplayer(i) then
- weapons[i] = {}
- end
- end
- gametype = readbyte(gametype_base + 0x30)
- if getteamplay() == true then team_play = true else team_play = false end
- end
- function OnNewGame(map)
- if GAME == "PC" then
- gametype_base = 0x671340
- map_name = readstring(0x698F21)
- elseif GAME == "CE" then
- gametype_base = 0x5F5498
- map_name = readstring(0x61D151)
- end
- for i=0,15 do
- if getplayer(i) then
- weapons[i] = {}
- end
- end
- gametype = readbyte(gametype_base + 0x30)
- if getteamplay() == true then team_play = true else team_play = false end
- end
- function getteamplay()
- if readbyte(gametype_base + 0x34) == 1 then
- return true
- else
- return false
- end
- end
- function OnPlayerJoin(player)
- if getplayer(player) then
- weapons[player] = nil
- sendconsoletext(player, "Assault Rifle! Unlimited Ammo!")
- end
- end
- function OnPlayerKill(killer, victim, mode)
- if getplayer(victim) then
- weapons[victim] = nil
- end
- end
- function OnPlayerLeave(player)
- if getplayer(player) then
- weapons[player] = nil
- end
- end
- function OnPlayerSpawn(player, m_objectId)
- if getplayer(player) then
- weapons[player] = nil
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- gameweap = registertimer(0, "AssignGameWeapons", player)
- end
- end
- end
- function AssignGameWeapons(id, count, player)
- if getplayer(player) then
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- local clip = 0
- local ammo = 9999
- if m_objectId then
- for i = 0,3 do
- local weapID = readdword(getobject(m_objectId), 0x2F8 + i*4)
- if weapID ~= 0xFFFFFFFF then
- destroyobject(weapID)
- end
- end
- if m_object then
- writebyte(m_object + 0x31E, 1)
- writebyte(m_object + 0x31F, 1)
- end
- local m_weaponId = createobject(gettagid("weap", "weapons\\assault rifle\\assault rifle"), 0, 10, false, 0, 0, 0)
- weapons[player] = "weapons\\assault rifle\\assault rifle"
- clip = 60
- assignweapon(player, m_weaponId)
- local m_weapon = getobject(m_weaponId)
- if m_weapon then
- writeword(m_weapon + 0x2B6, ammo)
- writeword(m_weapon + 0x2B8, clip)
- updateammo(m_weaponId)
- end
- end
- end
- return false
- end
- function OnObjectInteraction(player, objId, mapId)
- local Pass = nil
- local name, type = gettaginfo(mapId)
- if type == "weap" then
- if gametype == 1 or gametype == 3 then
- if name == "weapons\\ball\\ball" or name == "weapons\\flag\\flag" then
- Pass = true
- elseif weapons[player] ~= nil then
- if name ~= weapons[player] then
- Pass = false
- end
- end
- else
- if weapons[player] ~= nil then
- if name ~= weapons[player] then
- Pass = false
- end
- end
- end
- end
- return Pass
- end
- function OnObjectCreationAttempt(mapId, parentId, player)
- if mapId == gettagid("weap", "weapons\\pistol\\pistol") or
- mapId == gettagid("weap", "weapons\\rocket launcher\\rocket launcher") or
- mapId == gettagid("weap", "weapons\\flamethrower\\flamethrower") or
- mapId == gettagid("weap", "weapons\\plasma pistol\\plasma pistol") or
- mapId == gettagid("weap", "weapons\\plasma rifle\\plasma rifle") or
- mapId == gettagid("weap", "weapons\\plasma_cannon\\plasma_cannon") or
- mapId == gettagid("weap", "weapons\\sniper rifle\\sniper rifle") or
- mapId == gettagid("weap", "weapons\\needler\\mp_needler") or
- mapId == gettagid("weap", "weapons\\shotgun\\shotgun") then
- return false
- end
- end
- function OnGameEnd(stage)
- if stage == 1 then
- if gameweap then
- removetimer(gameweap)
- gameweap = nil
- end
- end
- end
- -- 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