LUA 196
V1+ One in the Chamber (1sk) 1.02 By xdedeone on 26th February 2019 07:45:15 PM
  1. -- OneintheChamber 1.02
  2.  
  3. --[[ Autokill on rejoin ]]--
  4.  
  5.         kill_on_rejoin = false
  6.  
  7.         -- If you don't want players to be killed when they rejoin, even if the game has limited lives, delete this block of code.
  8.                 local gametype_base = 0x671340
  9.                 local lives = readbyte(gametype_base, 0x50)
  10.  
  11.                 if lives > 0 then
  12.                         kill_on_rejoin = true
  13.                 end
  14.  
  15. --[[ Welcome Message ]]--
  16.  
  17.         welcome_message = "One in the Chamber"
  18.  
  19. --[[ Functions ]]--
  20.  
  21. function GetRequiredVersion()
  22.  
  23.         return 10057
  24. end
  25.  
  26. function OnScriptLoad(process)
  27.  
  28.        
  29. end
  30.  
  31. function OnScriptUnload()
  32.  
  33.  
  34. end
  35.  
  36. function OnNewGame(map)
  37.  
  38.  
  39. end
  40.  
  41. function OnGameEnd(mode)
  42.  
  43.  
  44. end
  45.  
  46. function OnServerChat(player, chattype, message)
  47.  
  48.         return 1
  49. end
  50.  
  51. function OnServerCommand(player, command)
  52.  
  53.         return 1
  54. end
  55.  
  56. function OnTeamDecision(team)
  57.  
  58.         return team
  59. end
  60.  
  61. --[[ Rejoining Tables ]]--
  62.  
  63.         hashes = {}
  64.         dq = {}
  65.  
  66. function OnPlayerJoin(player, team)
  67.  
  68.         if kill_on_rejoin then
  69.                 local hash = gethash(player)
  70.                 if hashes[hash] then
  71.                         say(getname(player) .. " has been disqualified for rejoining this round!")
  72.                         dq[hash] = true
  73.                 else
  74.                         privatesay(player, welcome_message)
  75.                         hashes[hash] = true
  76.                 end
  77.         end
  78. end
  79.  
  80. function OnPlayerLeave(player, team)
  81.  
  82.  
  83. end
  84.  
  85. function OnPlayerKill(killer, victim, mode)
  86.  
  87.         if mode == 4 then
  88.                 addOneBullet(killer)
  89.         end
  90. end
  91.  
  92. function addOneBullet(player)
  93.  
  94.         local m_player = getplayer(player)
  95.         if m_player then
  96.                 local m_objId = readdword(m_player, 0x34)
  97.                 local m_object = getobject(m_objId)
  98.                 if m_object then
  99.                         local m_weapId = readdword(m_object, 0x118)
  100.                         local m_weapon = getobject(m_weapId)
  101.                         if m_weapon then
  102.                                 local ammo = readdword(m_weapon, 0x2B6)
  103.                                 writedword(m_weapon, 0x2B6, ammo + 1)
  104.                                 updateammo(m_weapId)
  105.                         end
  106.                 end
  107.         end
  108. end
  109.  
  110. function OnKillMultiplier(player, multiplier)
  111.  
  112.  
  113. end
  114.  
  115. function OnPlayerSpawn(player, m_objId)
  116.  
  117.         local m_object = getobject(m_objId)
  118.         if m_object then
  119.                 writebyte(m_object, 0x31E, 0)
  120.                 writebyte(m_object, 0x31F, 0)
  121.         end
  122. end
  123.  
  124. function OnPlayerSpawnEnd(player, m_objId)
  125.  
  126.         local hash = gethash(player)
  127.         if dq[hash] then
  128.                 kill(player)
  129.         end
  130.        
  131.         local m_object = getobject(m_objId)
  132.         if m_object then
  133.                 registertimer(10, "WeaponTimer", player, m_object)
  134.         end
  135. end
  136.  
  137. function WeaponTimer(id, count, player, m_object)
  138.  
  139.         local weap
  140.         local gametype_base = 0x671340
  141.         local weapons = readbyte(gametype_base, 0x5C) -- Confirmed. (Normal = 0) (Pistols = 1) (Rifles = 2) (Plasma Weapons = 3) (Sniper = 4) (No Sniping = 5) (Rocket Launchers = 6) (Shotguns = 7) (Short Range = 8) (Human = 9) (Convenant = 10) (Classic = 11) (Heavy Weapons = 12)
  142.         if weapons == 0 or weapons == 11 then
  143.                 weap = "weapons\\pistol\\pistol"
  144.         else
  145.                 weap = "weapons\\sniper rifle\\sniper rifle"
  146.         end
  147.        
  148.         for i = 0, 3 do
  149.                 local m_weapId = readdword(m_object, 0x2F8 + i * 4)
  150.                 if getobject(m_weapId) then
  151.                         destroyobject(m_weapId)
  152.                 end
  153.         end
  154.        
  155.         local weapon = createobject("weap", weap, 0, 30, false, 0, 0, 0)
  156.         local m_weapon = getobject(weapon)
  157.         assignweapon(player, weapon)
  158.         writedword(m_weapon, 0x2B6, 0)
  159.         writedword(m_weapon, 0x2B8, 1)
  160.         writefloat(m_weapon, 0x240, 0.99)
  161.         updateammo(weapon)
  162.        
  163.         return 0
  164. end
  165.  
  166. function OnTeamChange(relevant, player, cur_team, dest_team)
  167.  
  168.         return 1
  169. end
  170.  
  171. function OnObjectCreation(m_objId, player, tagName)
  172.  
  173.  
  174. end
  175.  
  176. function OnObjectInteraction(player, m_objId, tagType, tagName)
  177.  
  178.         if tagType == "weap" then
  179.                 return 0
  180.         elseif tagType == "eqip" then
  181.                 if string.find(tagName, "grenade") then
  182.                         return 0
  183.                 end
  184.         end
  185.        
  186.         return 1
  187. end
  188.  
  189. function OnWeaponAssignment(player, m_objId, slot, tagName)
  190.                        
  191.         return 0
  192. end
  193.  
  194. function OnWeaponReload(player, m_weapId)
  195.  
  196.         return 1
  197. end
  198.  
  199. function OnDamageLookup(receiver, causer, tagData, tagName)
  200.  
  201.         if string.find(tagName, "bullet") then
  202.                 writefloat(tagData, 0x1D0, 500)
  203.                 writefloat(tagData, 0x1D4, 500)
  204.                 writefloat(tagData, 0x1D8, 500)
  205.         end
  206. end
  207.  
  208. function OnVehicleEntry(relevant, player, m_vehicleId, tagName, seat)
  209.  
  210.         return 1
  211. end
  212.  
  213. function OnVehicleEject(player, forced)
  214.  
  215.         return 1
  216. end
  217.  
  218. function OnClientUpdate(player, m_objId)
  219.  
  220.  
  221. end

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.