Advertisement
HR_Shaft

Dodgeball for SAPP

May 29th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 39.47 KB | None | 0 0
  1. -- Dodgeball    
  2. -- For Stock Halo PC/CE Maps, recommended for small indoor maps with 4 or more players
  3. -- by H® Shaft
  4.  
  5. -- Dodgeball:
  6. -- Designed for TEAM games only!
  7. -- Throw a plasma grenade at the enemy, it explodes/kills them immediately then puts them on the killers team.  
  8. -- The round is won when all players are on the same team, and repeats for 3 rounds (editable: see 'max_rounds' below)
  9. -- The only ways to kill enemies are with Plasma Grenades (Stickies) and Melee
  10. -- When you kill an enemy, you will be given 2 more Stickies (plasma nades)
  11. -- When you are killed, you will spawn where you died (editable: see 'spawn_death_coords' below)
  12. -- At spawn, players are given a shotgun with no ammo, 2 sticky nades, and cannot pickup any other weapons.
  13.  
  14. -- Gametype should be TEAM PLAY, Weapons to Normal/Generic, infinite grenades to NO, Auto team balance to YES, Friendly Fire set to OFF
  15. -- Premade gametype, works with Halo PC and CE: Link: https://www.mediafire.com/?xgrixdwiwwjt8x2
  16.  
  17. -- Multiply plasma grenade damaged by this amount (should be greater than 0, 1 for no change, 2 for instant death, no need to go higher)
  18. damage_multiplier = 2
  19.  
  20. -- Join Message
  21. join_message = "Welcome to DODGEBALL! Type HELP for more info."
  22.  
  23. -- grenade quantities (for infinite sticky nades should be left at: frags 0, plasma 99)
  24. frag_count = 0
  25. plasma_count = 2
  26.  
  27. -- time (in seconds) the last man will be invulnerable
  28. invulnerable_duration = 10
  29.  
  30. -- respawn where you were killed by enemy? (for bloodier games)  true = spawn where you die, false = let halo handle it
  31. spawn_death_coords = true   -- disabled for Gephyrophobia, Damnation to prevent respawning mid-air
  32.  
  33. -- number of rounds on each map, minimum of 1, dont use 0 or negative numbers
  34. max_rounds = 3
  35.  
  36. -- message shown to team killer
  37. tk_message = "DON'T KILL OR ATTACK YOUR OWN TEAM!!"
  38.  
  39. -- Anounce to all when a player switches teams?  Set to false if other scripts already announce this to reduce chat-spam
  40. announce_team_switch = false
  41.  
  42.  
  43. -- don't edit --
  44. api_version = "1.9.0.0"
  45. game_started = false
  46. team_play = false
  47. lastman = 0
  48. cur_round = 1
  49. temp = {}
  50. last_damage = {}
  51. killed_by_nothing = {}
  52. team_score = {}
  53.  
  54. function OnScriptLoad()
  55.     register_callback(cb['EVENT_GAME_START'], "OnNewGame")
  56.     register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
  57.     register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
  58.     register_callback(cb['EVENT_OBJECT_SPAWN'], "OnObjectSpawn")   
  59.     register_callback(cb['EVENT_DAMAGE_APPLICATION'], "OnDamageApplication")
  60.     register_callback(cb['EVENT_DIE'], "OnPlayerDie")
  61.     register_callback(cb['EVENT_JOIN'], "OnPlayerJoin")
  62.     register_callback(cb['EVENT_LEAVE'], "OnPlayerLeave")
  63.     register_callback(cb['EVENT_TEAM_SWITCH'], "OnTeamSwitch")
  64.     register_callback(cb['EVENT_CHAT'], "OnPlayerChat")
  65.     if get_var(0, "$gt") ~= "n/a" then 
  66.         OnNewGame()
  67.         game_ticks = 0
  68.         team_score["red"] = 0
  69.         team_score["blue"] = 0     
  70.     end
  71.     execute_command("block_tc 1")
  72.     execute_command("msg_prefix \"*DODGEBALL*    \"")  
  73. end
  74.  
  75. function OnScriptUnload()
  76.     temp = {}
  77.     last_damage = {}
  78.     killed_by_nothing = {}
  79.     execute_command("msg_prefix \"** SAPP ** \"")
  80.     execute_command("enable_object weapons\\shotgun\\shotgun")
  81. end
  82.  
  83. function OnNewGame()
  84.     team_score["red"] = 0
  85.     team_score["blue"] = 0
  86.     BalanceTeams()
  87.     game_ticks = 0
  88.     map_name = get_var(0,"$map")
  89.     team_play = getteamplay()
  90.    
  91.     -- check compatibility
  92.     if not team_play then
  93.         local MODE = get_var(0,"$mode")
  94.         local str1 = string.format("Dodgeball script NOT compatible with FFA gametypes, %s is NOT a team game!", tostring(MODE))
  95.         execute_command("log_note \""..str1.."\"")
  96.         cprint(str1)
  97.         execute_command("sv_map_next")
  98.         for i=1,16 do
  99.             if player_present(i) then
  100.                 say(i, str1)
  101.             end
  102.         end
  103.     end    
  104.    
  105.     for i=1,16 do
  106.         if player_present(i) then
  107.             last_damage[i] = 0
  108.             temp[i] = {}
  109.             killed_by_nothing[i] = false
  110.         end
  111.     end
  112.     execute_command("disable_object weapons\\shotgun\\shotgun")
  113.     GetMetaIDs()
  114.     game_started = true
  115.     cur_round = 1
  116.     timer(1000, "NewRound")
  117.     timer(60000, "ShowScores")
  118. end
  119.  
  120. function OnGameEnd()
  121.     game_started = false
  122.     timer(5000, "EndTimer")
  123.     for i=1,16 do
  124.         if player_present(i) then
  125.             last_damage[i] = 0
  126.             temp[i] = {}
  127.             killed_by_nothing[i] = false
  128.         end
  129.     end    
  130. end
  131.  
  132. function EndTimer()
  133.     if get_var(0, "$pn") ~= "0" then
  134.         -- set default scores to zero if nil
  135.         if team_score["red"] == nil then team_score["red"] = 0 end
  136.         if team_score["blue"] == nil then team_score["blue"] = 0 end
  137.         local insult = GenerateInsult(noun)
  138.         -- announce winner - if there is one
  139.         for i=1,16 do
  140.             if player_present(i) then      
  141.                 -- red
  142.                 if team_score["red"] > team_score["blue"] then
  143.                     rprint(i, "\n")
  144.                     rprint(i, "\n")
  145.                     rprint(i, "\n")
  146.                     rprint(i, "\n")
  147.                     rprint(i, "\n")
  148.                     rprint(i, "\n")
  149.                     rprint(i, "\n")
  150.                     rprint(i, "\n")
  151.                     rprint(i, "\n")
  152.                     rprint(i, "\n")
  153.                     rprint(i, "\n")
  154.                     rprint(i, "\n")
  155.                     rprint(i, "\n")
  156.                     rprint(i, "\n")
  157.                     rprint(i, "\n")
  158.                     rprint(i, "\n")
  159.                     rprint(i, "\n")
  160.                     rprint(i, "\n")
  161.                     rprint(i, "\n")
  162.                     rprint(i, "|cRED team wins the game!")
  163.                     rprint(i, "\n")
  164.                     rprint(i, "\n")                    
  165.                 -- blue    
  166.                 elseif team_score["blue"] > team_score["red"] then
  167.                     rprint(i, "\n")
  168.                     rprint(i, "\n")
  169.                     rprint(i, "\n")
  170.                     rprint(i, "\n")
  171.                     rprint(i, "\n")
  172.                     rprint(i, "\n")
  173.                     rprint(i, "\n")
  174.                     rprint(i, "\n")
  175.                     rprint(i, "\n")
  176.                     rprint(i, "\n")
  177.                     rprint(i, "\n")
  178.                     rprint(i, "\n")
  179.                     rprint(i, "\n")
  180.                     rprint(i, "\n")
  181.                     rprint(i, "\n")
  182.                     rprint(i, "\n")
  183.                     rprint(i, "\n")
  184.                     rprint(i, "\n")
  185.                     rprint(i, "\n")        
  186.                     rprint(i, "|cBLUE team wins the game!")
  187.                     rprint(i, "\n")
  188.                     rprint(i, "\n")                    
  189.                 -- stalemate   
  190.                 elseif team_score["red"] == team_score["blue"] then
  191.                     rprint(i, "\n")
  192.                     rprint(i, "\n")
  193.                     rprint(i, "\n")
  194.                     rprint(i, "\n")
  195.                     rprint(i, "\n")
  196.                     rprint(i, "\n")
  197.                     rprint(i, "\n")
  198.                     rprint(i, "\n")
  199.                     rprint(i, "\n")
  200.                     rprint(i, "\n")
  201.                     rprint(i, "\n")
  202.                     rprint(i, "\n")
  203.                     rprint(i, "\n")
  204.                     rprint(i, "\n")
  205.                     rprint(i, "\n")
  206.                     rprint(i, "\n")
  207.                     rprint(i, "\n")    
  208.                     rprint(i, "|cSTALEMATE!")      
  209.                     if insult ~= nil then rprint(i,"|cStalemate?! What a bunch of " .. insult .. "s!") end
  210.                     rprint(i, "\n")
  211.                     rprint(i, "\n")
  212.                     rprint(i, "\n")                    
  213.                 end
  214.             end
  215.         end    
  216.     end
  217.     return false
  218. end
  219.  
  220. function OnPlayerJoin(PlayerIndex)
  221.     if game_ticks > 8 and get_var(0, "$pn") == "1" then
  222.         if not game_started then game_started = true end
  223.         execute_command("sv_map_reset")
  224.     end
  225.     killed_by_nothing[PlayerIndex] = false
  226.     last_damage[PlayerIndex] = 0
  227.     temp[PlayerIndex] = {}
  228.     say(PlayerIndex, join_message)
  229.     timer(3000, "TeamWelcome", get_var(PlayerIndex,"$team"), PlayerIndex)
  230. end
  231.  
  232. function OnPlayerLeave(PlayerIndex)
  233.     if game_started then
  234.         EndCheck(PlayerIndex)  
  235.     end
  236.     killed_by_nothing[PlayerIndex] = nil
  237.     last_damage[PlayerIndex] = nil
  238.     temp[PlayerIndex] = nil
  239. end
  240.  
  241. function OnPlayerChat(PlayerIndex, Message)
  242.     local response = nil
  243.     local isadmin = nil
  244.     if (tonumber(get_var(PlayerIndex,"$lvl"))) >= 1 then isadmin = true else isadmin = false end       
  245.     local Message = string.lower(Message)
  246.    
  247.     if (Message == "balance") then
  248.         if isadmin then
  249.             response = false
  250.             BalanceTeams()
  251.         else
  252.             response = true
  253.         end
  254.     end
  255.    
  256.     if (Message == "help") or (Message == "/help") or (Message == "@help") then
  257.         response = false
  258.         say(PlayerIndex, "Dodgeball: When you kill the enemy, they join your team.")
  259.         say(PlayerIndex, "You can only kill enemies with plasma grenades or by melee.")    
  260.         say(PlayerIndex, "Play ".. max_rounds .." rounds per map.")
  261.         say(PlayerIndex, "Round is over when all players are on the same team.")
  262.     end    
  263.    
  264.     return response
  265. end
  266.  
  267. function EndCheck(PlayerIndex)
  268.     local name = get_var(PlayerIndex, "$name")
  269.     local team = get_var(PlayerIndex,"$team")
  270.     local reds = tonumber(get_var(0, "$reds")) - 1
  271.     local blues = tonumber(get_var(0, "$blues")) - 1
  272.     local stickies
  273.     local lastman = 0
  274.     local insult = GenerateInsult(noun)
  275.     -- set default scores to zero if nil
  276.     if team_score["red"] == nil then team_score["red"] = 0 end
  277.     if team_score["blue"] == nil then team_score["blue"] = 0 end
  278.    
  279.     -- last red
  280.     if (team == "red") and (reds == 1) then
  281.         stickies = tonumber(get_var(0, "$blues"))
  282.         for i = 1, 16 do
  283.             if get_var(i, "$team") == "red" and i ~= PlayerIndex then
  284.                 lastman = i
  285.                 break
  286.             end
  287.         end
  288.         for i=1,16 do
  289.             if player_present(i) then          
  290.                 rprint(i, "|c" .. get_var(lastman, "$name") .. " is the last RED player alive and is untouchable for 10 seconds!")     
  291.             end
  292.         end
  293.         timer(invulnerable_duration * 1000, "InvulnerableRemove", lastman) 
  294.         execute_command_sequence("god me;s me 1.75;hp me +2", lastman)
  295.         execute_command("camo me " ..invulnerable_duration, lastman)
  296.         execute_command("nades me +" ..stickies.. " 2", lastman)       
  297.     elseif (team == "red") and (reds == 0) and (get_var(0, "$blues") > "0") then
  298.         if max_rounds ~= cur_round then
  299.             team_score["blue"] = team_score["blue"] + 1
  300.             cur_round = cur_round + 1
  301.             game_ticks = 0
  302.             timer(1000, "NewRound")
  303.             for i=1,16 do
  304.                 if player_present(i) then          
  305.                     rprint(i, "|c" .. name .. " (RIP) was the last red player!")
  306.                     -- announce round winner
  307.                     if team_score["red"] > team_score["blue"] then
  308.                         rprint(i, "|cRED team wins the round!")
  309.                     elseif team_score["blue"] > team_score["red"] then
  310.                         rprint(i, "|cBLUE team wins the round!")
  311.                     elseif team_score["red"] == team_score["blue"] then
  312.                         rprint(i, "|cTIED UP!")    
  313.                     end
  314.                 end
  315.             end    
  316.         else
  317.             team_score["blue"] = team_score["blue"] + 1
  318.             for i=1,16 do
  319.                 if player_present(i) then          
  320.                     rprint(i, "|c" .. name .. " (RIP) was the last red player!")
  321.                 end
  322.             end    
  323.             execute_command("sv_map_next")
  324.         end        
  325.     end
  326.    
  327.     -- last blue
  328.     if (team == "blue") and (blues == 1) then
  329.         stickies = tonumber(get_var(0, "$reds"))
  330.         for i = 1, 16 do
  331.             if (get_var(i, "$team") == "blue") and (i ~= PlayerIndex) then
  332.                 lastman = i
  333.                 break
  334.             end
  335.         end
  336.         for i=1,16 do
  337.             if player_present(i) then          
  338.                 rprint(i, "|c" .. get_var(lastman, "$name") .. " is the last BLUE player alive and is untouchable for 10 seconds!")    
  339.             end
  340.         end    
  341.         timer(invulnerable_duration * 1000, "InvulnerableRemove", lastman) 
  342.         execute_command_sequence("god me;s me 1.75;hp me +2", lastman)
  343.         execute_command("camo me " ..invulnerable_duration, lastman)
  344.         execute_command("nades me +" ..stickies.. " 2", lastman)       
  345.     elseif (team == "blue") and (blues == 0) and (get_var(0, "$reds") > "0") then
  346.         if max_rounds ~= cur_round then
  347.             team_score["red"] = team_score["red"] + 1
  348.             cur_round = cur_round + 1
  349.             game_ticks = 0
  350.             timer(1000, "NewRound")        
  351.             for i=1,16 do
  352.                 if player_present(i) then          
  353.                     rprint(i, "|c" .. name .. " (RIP) was the last blue player!")
  354.                     -- announce round winner
  355.                     if team_score["red"] > team_score["blue"] then
  356.                         rprint(i, "|cRED team wins the round!")
  357.                     elseif team_score["blue"] > team_score["red"] then
  358.                         rprint(i, "|cBLUE team wins the round!")
  359.                     elseif team_score["red"] == team_score["blue"] then
  360.                         rprint(i, "|cTIED UP!")    
  361.                     end
  362.                 end
  363.             end    
  364.         else
  365.             team_score["red"] = team_score["red"] + 1
  366.             for i=1,16 do
  367.                 if player_present(i) then      
  368.                     rprint(i, "|c" .. name .. " (RIP) was the last blue player!")
  369.                 end
  370.             end
  371.             execute_command("sv_map_next")
  372.         end
  373.     end
  374.    
  375. end
  376.  
  377. function InvulnerableRemove(PlayerIndex)
  378.     execute_command("ungod me", PlayerIndex)
  379.     return false
  380. end
  381.  
  382. function NewRound()
  383.     game_ticks = game_ticks + 1
  384.     if game_ticks == 2 then
  385.         BalanceTeams()
  386.         if team_score["red"] == nil then team_score["red"] = 0 end
  387.         if team_score["blue"] == nil then team_score["blue"] = 0 end   
  388.         for i=1,16 do
  389.             if player_present(i) then          
  390.                 rprint(i, "|cStarting a New Round!")
  391.             end
  392.         end    
  393.         return true
  394.     elseif game_ticks == 3 then
  395.         for i=1,16 do
  396.             if player_present(i) then
  397.                 rprint(i, "\n")
  398.                 rprint(i, "\n")
  399.                 rprint(i, "\n")
  400.                 rprint(i, "\n")
  401.                 rprint(i, "\n")
  402.                 rprint(i, "\n")
  403.                 rprint(i, "\n")
  404.                 rprint(i, "\n")
  405.                 rprint(i, "\n")
  406.                 rprint(i, "\n")
  407.                 rprint(i, "\n")
  408.                 rprint(i, "\n")
  409.                 rprint(i, "\n")
  410.                 rprint(i, "\n")
  411.                 rprint(i, "\n")
  412.                 rprint(i, "\n")
  413.                 rprint(i, "\n")
  414.                 rprint(i, "\n")
  415.                 rprint(i, "\n")
  416.                 rprint(i, "\n")
  417.                 rprint(i, "\n")            
  418.                 rprint(i, "|cStarting in 5")   
  419.             end
  420.         end    
  421.         return true
  422.     elseif game_ticks == 4 then
  423.         for i=1,16 do
  424.             if player_present(i) then
  425.                 rprint(i, "\n")
  426.                 rprint(i, "\n")
  427.                 rprint(i, "\n")
  428.                 rprint(i, "\n")
  429.                 rprint(i, "\n")
  430.                 rprint(i, "\n")
  431.                 rprint(i, "\n")
  432.                 rprint(i, "\n")
  433.                 rprint(i, "\n")
  434.                 rprint(i, "\n")
  435.                 rprint(i, "\n")
  436.                 rprint(i, "\n")
  437.                 rprint(i, "\n")
  438.                 rprint(i, "\n")
  439.                 rprint(i, "\n")
  440.                 rprint(i, "\n")
  441.                 rprint(i, "\n")
  442.                 rprint(i, "\n")
  443.                 rprint(i, "\n")
  444.                 rprint(i, "\n")
  445.                 rprint(i, "\n")            
  446.                 rprint(i, "|cStarting in 4")           
  447.             end
  448.         end
  449.         return true
  450.     elseif game_ticks == 5 then
  451.         for i=1,16 do
  452.             if player_present(i) then
  453.                 rprint(i, "\n")
  454.                 rprint(i, "\n")
  455.                 rprint(i, "\n")
  456.                 rprint(i, "\n")
  457.                 rprint(i, "\n")
  458.                 rprint(i, "\n")
  459.                 rprint(i, "\n")
  460.                 rprint(i, "\n")
  461.                 rprint(i, "\n")
  462.                 rprint(i, "\n")
  463.                 rprint(i, "\n")
  464.                 rprint(i, "\n")
  465.                 rprint(i, "\n")
  466.                 rprint(i, "\n")
  467.                 rprint(i, "\n")
  468.                 rprint(i, "\n")
  469.                 rprint(i, "\n")
  470.                 rprint(i, "\n")
  471.                 rprint(i, "\n")
  472.                 rprint(i, "\n")
  473.                 rprint(i, "\n")            
  474.                 rprint(i, "|cStarting in 3")               
  475.             end
  476.         end
  477.         return true
  478.     elseif game_ticks == 6 then
  479.         for i=1,16 do
  480.             if player_present(i) then
  481.                 rprint(i, "\n")
  482.                 rprint(i, "\n")
  483.                 rprint(i, "\n")
  484.                 rprint(i, "\n")
  485.                 rprint(i, "\n")
  486.                 rprint(i, "\n")
  487.                 rprint(i, "\n")
  488.                 rprint(i, "\n")
  489.                 rprint(i, "\n")
  490.                 rprint(i, "\n")
  491.                 rprint(i, "\n")
  492.                 rprint(i, "\n")
  493.                 rprint(i, "\n")
  494.                 rprint(i, "\n")
  495.                 rprint(i, "\n")
  496.                 rprint(i, "\n")
  497.                 rprint(i, "\n")
  498.                 rprint(i, "\n")
  499.                 rprint(i, "\n")
  500.                 rprint(i, "\n")
  501.                 rprint(i, "\n")            
  502.                 rprint(i, "|cStarting in 2")               
  503.             end
  504.         end
  505.         return true
  506.     elseif game_ticks == 7 then
  507.         for i=1,16 do
  508.             if player_present(i) then
  509.                 rprint(i, "\n")
  510.                 rprint(i, "\n")
  511.                 rprint(i, "\n")
  512.                 rprint(i, "\n")
  513.                 rprint(i, "\n")
  514.                 rprint(i, "\n")
  515.                 rprint(i, "\n")
  516.                 rprint(i, "\n")
  517.                 rprint(i, "\n")
  518.                 rprint(i, "\n")
  519.                 rprint(i, "\n")
  520.                 rprint(i, "\n")
  521.                 rprint(i, "\n")
  522.                 rprint(i, "\n")
  523.                 rprint(i, "\n")
  524.                 rprint(i, "\n")
  525.                 rprint(i, "\n")
  526.                 rprint(i, "\n")
  527.                 rprint(i, "\n")
  528.                 rprint(i, "\n")
  529.                 rprint(i, "\n")                
  530.                 rprint(i, "|cStarting in 1")               
  531.             end
  532.         end
  533.         return true
  534.     elseif game_ticks == 8 then
  535.         game_ticks = 9
  536.         game_started = true
  537.         execute_command("sv_map_reset")
  538.         for i=1,16 do
  539.             if player_present(i) then
  540.                 rprint(i, "\n")
  541.                 rprint(i, "\n")
  542.                 rprint(i, "\n")
  543.                 rprint(i, "\n")
  544.                 rprint(i, "\n")
  545.                 rprint(i, "\n")
  546.                 rprint(i, "\n")
  547.                 rprint(i, "\n")
  548.                 rprint(i, "\n")
  549.                 rprint(i, "\n")
  550.                 rprint(i, "\n")
  551.                 rprint(i, "\n")
  552.                 rprint(i, "\n")
  553.                 rprint(i, "\n")
  554.                 rprint(i, "\n")
  555.                 rprint(i, "\n")
  556.                 rprint(i, "\n")
  557.                 rprint(i, "\n")
  558.                 rprint(i, "|cRound " .. cur_round  .. " of " .. max_rounds .. " rounds.")      
  559.                 rprint(i, "|c--- PLAY BALL! ---")
  560.                 rprint(i, "\n")
  561.                 rprint(i, "\n")            
  562.             end
  563.         end    
  564.         return false
  565.     else
  566.         return true    
  567.     end
  568. end
  569.  
  570. function BalanceTeams()
  571.     if not team_play then return end
  572.     local reds = tonumber(get_var(0,"$reds"))
  573.     local blues = tonumber(get_var(0,"$blues"))
  574.     local bigger_team = nil
  575.     while TeamsAreUneven() do
  576.         if (reds > blues + 1) then
  577.             bigger_team = "red"
  578.             execute_command("st rand" .. bigger_team)
  579.         elseif (blues > reds + 1) then
  580.             bigger_team = "blue"
  581.             execute_command("st rand" .. bigger_team)          
  582.         end
  583.         if (reds == blues) or (reds == blues + 1) or (blues == reds + 1) then break end
  584.     end
  585. end
  586.  
  587. function OnPlayerSpawn(PlayerIndex)
  588.     -- set grenade counts as they are set above
  589.     if player_present(PlayerIndex) then
  590.         local player_object = get_dynamic_player(PlayerIndex)
  591.         local Deaths = tonumber(get_var(PlayerIndex, "$deaths"))
  592.         execute_command_sequence("s me 1;nades me 0;wdel me 0", PlayerIndex)
  593.         local ObjectID = spawn_object("weap", "weapons\\shotgun\\shotgun")
  594.         assign_weapon(ObjectID, PlayerIndex)
  595.         execute_command_sequence("ammo me 0 5;mag me 0 5;", PlayerIndex)           
  596.         execute_command_sequence("nades me " .. plasma_count .. " 2", PlayerIndex)
  597.         last_damage[PlayerIndex] = 0
  598.         if spawn_death_coords and (temp[PlayerIndex][1] ~= nil) and (killed_by_nothing[PlayerIndex] == false) then
  599.             if map_name ~= "gephyrophobia" or map_name ~= "damnation" then
  600.                 local player_object = get_dynamic_player(PlayerIndex)
  601.                 local player_obj_id = read_dword(get_player(PlayerIndex) + 0x34)
  602.                 if (player_object ~= 0) then
  603.                     moveobject(player_obj_id, temp[PlayerIndex][1], temp[PlayerIndex][2], temp[PlayerIndex][3])
  604.                 end
  605.             end
  606.             temp[PlayerIndex] = {}
  607.         end
  608.         if Deaths > 14 then
  609.             timer(6000, "GiveOverShield", PlayerIndex)
  610.         end    
  611.     end
  612. end
  613.  
  614. function OnTeamSwitch(PlayerIndex)
  615.     if game_started then
  616.         if team_play then
  617.             if (killed_by_nothing[PlayerIndex] == true) then
  618.                 if announce_team_switch then
  619.                     say_all(get_var(PlayerIndex,"$name") .. " switched to the " .. get_var(PlayerIndex,"$team") .. " team.")
  620.                 end
  621.                 killed_by_nothing[PlayerIndex] = false
  622.                 temp[PlayerIndex] = {}
  623.                 timer(1000, "TeamWelcome", get_var(PlayerIndex,"$team"), PlayerIndex)              
  624.             end    
  625.         end
  626.     end
  627. end
  628.  
  629. function ShowScores()
  630.     if game_started then
  631.         if team_score["red"] == nil then team_score["red"] = 0 end
  632.         if team_score["blue"] == nil then team_score["blue"] = 0 end   
  633.         for i=1,16 do
  634.             if player_present(i) then
  635.                 if game_ticks > 8 then
  636.                     rprint(i, "|cRounds won: Red: " .. team_score["red"] .. " vs. Blue: " .. team_score["blue"])
  637.                 end    
  638.             end
  639.         end
  640.         return true
  641.     else   
  642.         return false
  643.     end    
  644. end
  645.  
  646. function OnPlayerDie(PlayerIndex, KillerIndex)
  647.     if game_started then
  648.         -- delete dropped grenades
  649.         execute_command('nades me 0', PlayerIndex)
  650.         local player_object = get_dynamic_player(PlayerIndex)
  651.         local vehicle_objectid = read_dword(player_object + 0x11C)
  652.         local vehicle_object = get_object_memory(vehicle_objectid)     
  653.         local vname = get_var(PlayerIndex, "$name")
  654.         local vteam = get_var(PlayerIndex, "$team")
  655.         local killer = tonumber(KillerIndex)
  656.  
  657.         if (killer == -1) then
  658.             if last_damage[PlayerIndex] == 0 then
  659.                 killed_by_nothing[PlayerIndex] = true
  660.             elseif last_damage[PlayerIndex] == distance_damage then
  661.                 last_damage[PlayerIndex] = 0
  662.                 killed_by_nothing[PlayerIndex] = false             
  663.             end
  664.            
  665.         elseif (killer == 0) then
  666.             if last_damage[PlayerIndex] == veh_damage then
  667.                 last_damage[PlayerIndex] = 0           
  668.             end
  669.  
  670.         elseif (killer > 0) then
  671.             local kname = get_var(KillerIndex, "$name")
  672.             local kteam = get_var(KillerIndex, "$team")
  673.            
  674.             if PlayerIndex == killer then -- suicide
  675.                 if game_started then
  676.                     EndCheck(PlayerIndex)
  677.                 end
  678.                
  679.             elseif (team_play and (kteam == vteam) and (PlayerIndex ~= KillerIndex)) then -- teamkill/betray
  680.                 if game_started then
  681.                     rprint(KillerIndex, tk_message)
  682.                     kill(KillerIndex)
  683.                     temp[PlayerIndex] = {}
  684.                     EndCheck(PlayerIndex)
  685.                 end
  686.                
  687.             elseif PlayerIndex ~= KillerIndex  then -- killed by another player    
  688.                 if last_damage[PlayerIndex] == "melee" then
  689.                     local x,y,z = read_vector3d(player_object + 0x5C)
  690.                     temp[PlayerIndex][1] = x
  691.                     temp[PlayerIndex][2] = y
  692.                     temp[PlayerIndex][3] = z
  693.                 elseif last_damage[PlayerIndex] == explosion_damage then
  694.                     local x,y,z = read_vector3d(player_object + 0x5C)
  695.                     if (vehicle_object ~= 0) then
  696.                         temp[PlayerIndex] = {}
  697.                     else
  698.                         temp[PlayerIndex][1] = x
  699.                         temp[PlayerIndex][2] = y
  700.                         temp[PlayerIndex][3] = z                   
  701.                     end
  702.                 end
  703.                 if game_started then
  704.                     EndCheck(PlayerIndex)  
  705.                     execute_command("st", PlayerIndex)
  706.                     execute_command("nades me +1 2", KillerIndex)
  707.                 end
  708.             end
  709.         end
  710.         last_damage[PlayerIndex] = 0   
  711.     end    
  712. end
  713.  
  714. function TeamWelcome(team, PlayerIndex)
  715.     if game_started and team_play then
  716.         local insult = GenerateInsult(noun)
  717.         if team == "red" then
  718.             say(PlayerIndex, "YOU'RE RED. KILL THE BLUES!")
  719.         elseif team == "blue" then
  720.             say(PlayerIndex, "YOU'RE BLUE. KILL THE REDS!")
  721.         end
  722.         if insult ~= nil then say(PlayerIndex, "Don't be a whiny little " .. insult .. "! KILL THEM! ") end
  723.     end
  724.     return false   
  725. end
  726.  
  727. function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
  728.     if player_present(PlayerIndex) then
  729.         local receiver_team = get_var(PlayerIndex, "$team")
  730.         local causer_team = get_var(CauserIndex, "$team")
  731.         local new_damage = (Damage * damage_multiplier)
  732.         last_damage[PlayerIndex] = MetaID
  733.        
  734.         -- increase plasma explosion damage to enemies, don't harm self or team
  735.         if (MetaID == explosion_damage) then
  736.             if (PlayerIndex and PlayerIndex ~= CauserIndex) then           
  737.                 if (receiver_team ~= causer_team) then
  738.                     last_damage[PlayerIndex] = explosion_damage
  739.                     return true, new_damage
  740.                 else
  741.                     return true, 0
  742.                 end
  743.             end
  744.         end
  745.        
  746.         if (MetaID == shockwave_damage) or (MetaID == attached_damage) then
  747.             if (PlayerIndex and PlayerIndex ~= CauserIndex) then           
  748.                 if (receiver_team ~= causer_team) then
  749.                     last_damage[PlayerIndex] = explosion_damage
  750.                 end
  751.             end
  752.         end    
  753.        
  754.         if (MetaID == falling_damage) then
  755.             last_damage[PlayerIndex] = falling_damage
  756.             return true, falling_damage        
  757.         end
  758.        
  759.         if (MetaID == distance_damage) then
  760.             last_damage[PlayerIndex] = distance_damage
  761.             return true, distance_damage   
  762.         end
  763.        
  764.         -- block all damage done by vehicle and hand held weapons, and vehicle splatter damage (it's dodgeball, derp)
  765.         if (MetaID == veh_damage) or (MetaID == banshee_bolt) or (MetaID == banshee_explode) or
  766.             (MetaID == turret_bolt) or (MetaID == ghost_bolt) or (MetaID == tank_shell) or
  767.             (MetaID == tank_bullet) or (MetaID == chain_bullet) or (MetaID == assault_bullet) or
  768.             (MetaID == flame_explode) or (MetaID == needle_detonate) or (MetaID == needle_explode) or
  769.             (MetaID == needle_impact) or (MetaID == pistol_bullet) or (MetaID == ppistol_bolt) or
  770.             (MetaID == ppistol_charge) or (MetaID == prifle_bolt) or (MetaID == pcannon_explode) or
  771.             (MetaID == rocket_explode) or (MetaID == shotgun_pellet) or (MetaID == sniper_bullet) then
  772.             return true, 0
  773.         end            
  774.        
  775.         -- make melee damage instant kill to enemies
  776.         local tag_address = read_dword(0x40440000)
  777.         local tag_count = read_dword(0x4044000C)   
  778.         for i=0,tag_count-1 do
  779.             local tag = tag_address + 0x20 * i
  780.             local tag_name = read_string(read_dword(tag + 0x10))
  781.             local tag_class = read_dword(tag)
  782.             local tag_data = read_dword(tag + 0x14)    
  783.             if (tag_class == 1785754657) and string.find(tag_name, "melee") then
  784.                 if (receiver_team ~= causer_team) then
  785.                     last_damage[PlayerIndex] = "melee"
  786.                     if (read_word(tag_data + 0x1C6) == 6) then
  787.                         write_float(tag_data + 0x1D0, 500)
  788.                         write_float(tag_data + 0x1D4, 500)
  789.                         write_float(tag_data + 0x1D8, 500)
  790.                         write_bit(tag_data + 0x1C8, 3, 1)
  791.                     end                
  792.                 else
  793.                     return true, 0
  794.                 end
  795.             end
  796.         end    
  797.  
  798.     end
  799. end
  800.  
  801. function OnObjectSpawn(PlayerIndex, MapID, ParentID, ObjectID)
  802.     -- edit biped and stickies --
  803.     local tag_address = read_dword(0x40440000)
  804.     local tag_count = read_dword(0x4044000C)   
  805.     for i=0,tag_count-1 do
  806.         local tag = tag_address + 0x20 * i
  807.         local tag_name = read_string(read_dword(tag + 0x10))
  808.         local tag_class = read_dword(tag)
  809.         local tag_data = read_dword(tag + 0x14)
  810.         -- biped grenade throwing velocity from 10 to 15   
  811.         if (tag_class == 1651077220 and tag_name == "characters\\cyborg_mp\\cyborg_mp") then
  812.             write_dword(tag_data + 0x2c0, 1097859072) -- biped grenade throwing velocity from 10 to 15/1097859072
  813.         end
  814.         -- plasma grenade, changed to explode on contact with anything
  815.         if (tag_class == 1886547818 and tag_name == "weapons\\plasma grenade\\plasma grenade") then
  816.             write_dword(tag_data + 0x1bc, 0) -- det timer from
  817.             write_dword(tag_data + 0x1c0, 0) -- det timer to:
  818.             write_dword(tag_data + 0x180, 0x1) -- det timer starts 0 = immed, 1 = after bounce, 2 at rest)
  819.             write_dword(tag_data + 0x1a0, 0.1) -- collision radius 0.1 world units
  820.             write_dword(tag_data + 0x220, 4294967295) -- (nulled/4294967295) attached det damage nulled out
  821.             write_dword(tag_data + 0x17c, 2) -- Detonation Max Time if Attached
  822.             write_dword(tag_data + 0x2c0, 1097859072) -- biped grenade throwing velocity from 10 to 15/1097859072
  823.             write_dword(tag_data + 0x1c8, 1124073472) -- detonation max range from 0 to 128/1124073472
  824.             write_dword(tag_data + 0x1d4, 100) -- physics air damage range from 10 to 100/1120403456
  825.             write_dword(tag_data + 0x94, 4) -- detonation start To/event, effect -- 4 seconds/1082130432
  826.             write_bit(tag_data + 0x1C8, 3, 1) -- doesn't hurt team: 1 = true, 0 = false
  827.             -- default/potential material responses --
  828.             write_dword(tag_data + 0x33c, 65536)
  829.             write_dword(tag_data + 0x344, 1078310993)
  830.             SwapDependency(tag_data + 0x34c, "weapons\\rocket launcher\\effects\\impact dirt", 1701209701)
  831.             write_dword(tag_data + 0x360, 65536)
  832.             write_dword(tag_data + 0x3dc, 65536)
  833.             write_dword(tag_data + 0x3e4, 1078310993)
  834.             SwapDependency(tag_data + 0x3ec, "weapons\\rocket launcher\\effects\\impact dirt", 1701209701)
  835.             write_dword(tag_data + 0x400, 65536)
  836.             write_dword(tag_data + 0x47c, 65536)
  837.             write_dword(tag_data + 0x484, 1078320705)
  838.             SwapDependency(tag_data + 0x48c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  839.             write_dword(tag_data + 0x4a0, 65536)
  840.             write_dword(tag_data + 0x51c, 65536)
  841.             write_dword(tag_data + 0x524, 1078320705)
  842.             SwapDependency(tag_data + 0x52c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  843.             write_dword(tag_data + 0x540, 65536)
  844.             write_dword(tag_data + 0x5bc, 65536)
  845.             write_dword(tag_data + 0x5c4, 1078320705)
  846.             SwapDependency(tag_data + 0x5cc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  847.             write_dword(tag_data + 0x5e0, 65536)
  848.             write_dword(tag_data + 0x65c, 65536)
  849.             write_dword(tag_data + 0x664, 1078320705)
  850.             SwapDependency(tag_data + 0x66c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  851.             write_dword(tag_data + 0x680, 65536)
  852.             write_dword(tag_data + 0x6fc, 65536)
  853.             write_dword(tag_data + 0x704, 1078320705)
  854.             SwapDependency(tag_data + 0x70c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  855.             write_dword(tag_data + 0x720, 65536)
  856.             write_dword(tag_data + 0x79c, 65536)
  857.             write_dword(tag_data + 0x7a4, 1078320705)
  858.             SwapDependency(tag_data + 0x7ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  859.             write_dword(tag_data + 0x7c0, 65536)
  860.             write_dword(tag_data + 0x83c, 65536)
  861.             write_dword(tag_data + 0x844, 1078320705)
  862.             SwapDependency(tag_data + 0x84c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  863.             write_dword(tag_data + 0x860, 65536)
  864.             write_dword(tag_data + 0x8dc, 65536)
  865.             write_dword(tag_data + 0x8e4, 1078320705)
  866.             SwapDependency(tag_data + 0x8ec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  867.             write_dword(tag_data + 0x97c, 65536)
  868.             write_dword(tag_data + 0x984, 1078320705)
  869.             SwapDependency(tag_data + 0x98c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  870.             write_dword(tag_data + 0xa1c, 65536)
  871.             write_dword(tag_data + 0xa24, 1078320705)
  872.             SwapDependency(tag_data + 0xa2c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  873.             write_dword(tag_data + 0xa40, 65536)
  874.             write_dword(tag_data + 0xabc, 65536)
  875.             write_dword(tag_data + 0xac4, 1078320705)
  876.             SwapDependency(tag_data + 0xacc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  877.             write_dword(tag_data + 0xae0, 65536)
  878.             write_dword(tag_data + 0xb5c, 65536)
  879.             write_dword(tag_data + 0xb64, 1078320705)
  880.             SwapDependency(tag_data + 0xb6c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  881.             write_dword(tag_data + 0xb80, 65536)
  882.             write_dword(tag_data + 0xbfc, 65536)
  883.             write_dword(tag_data + 0xc04, 1078320705)
  884.             SwapDependency(tag_data + 0xc0c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  885.             write_dword(tag_data + 0xc20, 65536)
  886.             write_dword(tag_data + 0xc9c, 65536)
  887.             write_dword(tag_data + 0xca4, 1078320705)
  888.             SwapDependency(tag_data + 0xcac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  889.             write_dword(tag_data + 0xcc0, 65536)
  890.             write_dword(tag_data + 0xd3c, 65536)
  891.             write_dword(tag_data + 0xd44, 1078320705)
  892.             SwapDependency(tag_data + 0xd4c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  893.             write_dword(tag_data + 0xd60, 0)
  894.             write_dword(tag_data + 0xddc, 65536)
  895.             write_dword(tag_data + 0xde4, 1078320705)
  896.             SwapDependency(tag_data + 0xdec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  897.             write_dword(tag_data + 0xe00, 65536)
  898.             write_dword(tag_data + 0xe7c, 65536)
  899.             write_dword(tag_data + 0xe84, 1078320705)
  900.             SwapDependency(tag_data + 0xe8c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  901.             write_dword(tag_data + 0xf1c, 65536)
  902.             write_dword(tag_data + 0xf24, 1078320705)
  903.             SwapDependency(tag_data + 0xf2c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  904.             write_dword(tag_data + 0xf40, 65536)
  905.             write_dword(tag_data + 0xfbc, 65536)
  906.             write_dword(tag_data + 0xfc4, 1078320705)
  907.             SwapDependency(tag_data + 0xfcc, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  908.             write_dword(tag_data + 0xfe0, 65536)
  909.             write_dword(tag_data + 0x105c, 65536)
  910.             write_dword(tag_data + 0x1064, 1078320705)
  911.             SwapDependency(tag_data + 0x106c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  912.             write_dword(tag_data + 0x1080, 65536)
  913.             write_dword(tag_data + 0x10fc, 65536)
  914.             write_dword(tag_data + 0x1104, 1078320705)
  915.             SwapDependency(tag_data + 0x110c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  916.             write_dword(tag_data + 0x1120, 65536)
  917.             write_dword(tag_data + 0x119c, 65536)
  918.             write_dword(tag_data + 0x11a4, 1078320705)
  919.             SwapDependency(tag_data + 0x11ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  920.             write_dword(tag_data + 0x11c0, 65536)
  921.             write_dword(tag_data + 0x123c, 65536)
  922.             write_dword(tag_data + 0x1244, 1078320705)
  923.             SwapDependency(tag_data + 0x124c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  924.             write_dword(tag_data + 0x1260, 65536)
  925.             write_dword(tag_data + 0x12dc, 65536)
  926.             write_dword(tag_data + 0x12e4, 1078320705)
  927.             SwapDependency(tag_data + 0x12ec, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  928.             write_dword(tag_data + 0x1300, 65536)
  929.             write_dword(tag_data + 0x137c, 65536)
  930.             write_dword(tag_data + 0x1384, 1078320705)
  931.             SwapDependency(tag_data + 0x138c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  932.             write_dword(tag_data + 0x141c, 65536)
  933.             write_dword(tag_data + 0x1424, 1078320705)
  934.             SwapDependency(tag_data + 0x142c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  935.             write_dword(tag_data + 0x1440, 65536)
  936.             write_dword(tag_data + 0x14bc, 65536)
  937.             write_dword(tag_data + 0x14c4, 1078312016)
  938.             SwapDependency(tag_data + 0x14cc, "weapons\\rocket launcher\\effects\\impact water", 1701209701)
  939.             write_dword(tag_data + 0x155c, 65536)
  940.             write_dword(tag_data + 0x1564, 1078320705)
  941.             SwapDependency(tag_data + 0x156c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  942.             write_dword(tag_data + 0x1580, 65536)
  943.             write_dword(tag_data + 0x15fc, 65536)
  944.             write_dword(tag_data + 0x1604, 1078320705)
  945.             SwapDependency(tag_data + 0x160c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  946.             write_dword(tag_data + 0x1620, 65536)
  947.             write_dword(tag_data + 0x169c, 65536)
  948.             write_dword(tag_data + 0x16a4, 1078320705)
  949.             SwapDependency(tag_data + 0x16ac, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  950.             write_dword(tag_data + 0x16c0, 65536)
  951.             write_dword(tag_data + 0x173c, 65536)
  952.             write_dword(tag_data + 0x1744, 1078320705)
  953.             SwapDependency(tag_data + 0x174c, "weapons\\plasma grenade\\effects\\material explosion", 1701209701)
  954.         end
  955.     end
  956.  
  957.     -- replaces active camo with overshield
  958.     if (MapID == equip_camo) then
  959.         return true, equip_os
  960.     end
  961.    
  962.     -- replaces frag nade projectiles with sticky nade projectiles
  963.     if (MapID == proj_frag) then
  964.         return true, proj_sticky
  965.     end
  966.        
  967.     -- items returning false (blocked) should always be listed after items returning true, or they will be ignored by sapp
  968.  
  969.     -- block all weapons except shotguns (not blocking flag and oddball)
  970.     if (MapID == weap_fuel_rod or MapID == weap_rocket_launcher or MapID == weap_sniper_rifle or
  971.         MapID == weap_plasma_pistol or MapID == weap_plasma_rifle or MapID == weap_assault_rifle or
  972.         MapID == weap_flamer or MapID == weap_needler or MapID == weap_pistol) then
  973.         return false
  974.     end
  975.    
  976.     -- block frag equipment
  977.     if (MapID == equip_frags) then
  978.         return false
  979.     end
  980.    
  981.     -- block sticky (plasma nades) equipment
  982.     if (MapID == equip_stickies) then
  983.         return false
  984.     end
  985.    
  986.     -- end
  987.     return true
  988. end
  989.  
  990. function GetMetaIDs()
  991.     -- damage tags
  992.     attached_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\attached")
  993.     explosion_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\explosion")
  994.     shockwave_damage = get_tag_info("jpt!", "weapons\\plasma grenade\\shock wave")
  995.     falling_damage = get_tag_info("jpt!", "globals\\falling")
  996.     distance_damage = get_tag_info("jpt!", "globals\\distance")
  997.     veh_damage = get_tag_info("jpt!", "globals\\vehicle_collision")
  998.     banshee_bolt = get_tag_info("jpt!", "vehicles\\banshee\\banshee bolt")
  999.     banshee_explode = get_tag_info("jpt!", "vehicles\\banshee\\mp_fuel rod explosion")
  1000.     turret_bolt = get_tag_info("jpt!", "vehicles\\c gun turret\\mp bolt")
  1001.     ghost_bolt = get_tag_info("jpt!", "vehicles\\ghost\\ghost bolt")
  1002.     tank_shell = get_tag_info("jpt!", "vehicles\\scorpion\\shell explosion")
  1003.     tank_bullet = get_tag_info("jpt!", "vehicles\\scorpion\\bullet")
  1004.     chain_bullet = get_tag_info("jpt!", "vehicles\\warthog\\bullet")
  1005.     assault_bullet = get_tag_info("jpt!", "weapons\\assault rifle\\bullet")
  1006.     flame_explode = get_tag_info("jpt!", "weapons\\flamethrower\\explosion")
  1007.     needle_detonate = get_tag_info("jpt!", "weapons\\needler\\detonation damage")
  1008.     needle_explode = get_tag_info("jpt!", "weapons\\needler\\explosion")
  1009.     needle_impact = get_tag_info("jpt!", "weapons\\needler\\impact damage")
  1010.     pistol_bullet = get_tag_info("jpt!", "weapons\\pistol\\bullet")
  1011.     ppistol_bolt = get_tag_info("jpt!", "weapons\\plasma pistol\\bolt")
  1012.     ppistol_charged = get_tag_info("jpt!", "weapons\\plasma rifle\\charged bolt")
  1013.     prifle_bolt = get_tag_info("jpt!", "weapons\\plasma rifle\\bolt")
  1014.     pcannon_explode = get_tag_info("jpt!", "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion")
  1015.     rocket_explode = get_tag_info("jpt!", "weapons\\rocket launcher\\explosion")
  1016.     shotgun_pellet = get_tag_info("jpt!", "weapons\\shotgun\\pellet")
  1017.     sniper_bullet = get_tag_info("jpt!", "weapons\\sniper rifle\\sniper bullet")
  1018.     -- biped
  1019.     mp_biped = get_tag_info("bipd", "characters\\cyborg_mp\\cyborg_mp")
  1020.     -- weapons
  1021.     weap_fuel_rod = read_dword(lookup_tag("weap", "weapons\\plasma_cannon\\plasma_cannon") + 12)
  1022.     weap_rocket_launcher = read_dword(lookup_tag("weap", "weapons\\rocket launcher\\rocket launcher") + 12)
  1023.     weap_sniper_rifle = read_dword(lookup_tag("weap", "weapons\\sniper rifle\\sniper rifle") + 12)
  1024.     weap_plasma_pistol = read_dword(lookup_tag("weap", "weapons\\plasma pistol\\plasma pistol") + 12)
  1025.     weap_plasma_rifle = read_dword(lookup_tag("weap", "weapons\\plasma rifle\\plasma rifle") + 12)
  1026.     weap_assault_rifle = read_dword(lookup_tag("weap", "weapons\\assault rifle\\assault rifle") + 12)
  1027.     weap_flamer = read_dword(lookup_tag("weap", "weapons\\flamethrower\\flamethrower") + 12)
  1028.     weap_needler = read_dword(lookup_tag("weap", "weapons\\needler\\mp_needler") + 12)
  1029.     weap_pistol = read_dword(lookup_tag("weap", "weapons\\pistol\\pistol") + 12)
  1030.     weap_shotgun = read_dword(lookup_tag("weap", "weapons\\shotgun\\shotgun") + 12)
  1031.     --projectiles
  1032.     proj_frag = read_dword(lookup_tag("proj", "weapons\\frag grenade\\frag grenade") + 12)
  1033.     proj_sticky = read_dword(lookup_tag("proj", "weapons\\plasma grenade\\plasma grenade") + 12)
  1034.     -- equipment
  1035.     equip_frags = read_dword(lookup_tag("eqip", "weapons\\frag grenade\\frag grenade") + 12)
  1036.     equip_stickies = read_dword(lookup_tag("eqip", "weapons\\plasma grenade\\plasma grenade") + 12)
  1037.     equip_camo = read_dword(lookup_tag("eqip", "powerups\\active camouflage") + 12)
  1038.     equip_os = read_dword(lookup_tag("eqip", "powerups\\over shield") + 12)
  1039. end
  1040.  
  1041. function get_tag_info(obj_type, obj_name)
  1042.     local tag = lookup_tag(obj_type, obj_name)
  1043.     return tag ~= 0 and read_dword(tag + 0xC) or nil
  1044. end
  1045.  
  1046. function SwapDependency(Address, ToTag, ToClass)
  1047.     local tag_address = read_dword(0x40440000)
  1048.     local tag_count = read_dword(0x4044000C)
  1049.     for i=0,tag_count-1 do
  1050.         local tag = tag_address + 0x20 * i
  1051.         if (read_dword(tag) == ToClass and read_string(read_dword(tag + 0x10)) == ToTag) then
  1052.             write_dword(Address, read_dword(tag + 0xC))
  1053.             return
  1054.         end
  1055.     end
  1056. end
  1057.  
  1058. function GiveOverShield(PlayerIndex)
  1059.     if player_alive(PlayerIndex) then
  1060.         local name = get_var(PlayerIndex,"$name")
  1061.         local insult = GenerateInsult(noun)
  1062.         rprint(PlayerIndex, "** " .. name .. " ** Do you LIKE losing?! Here's an over-shield! You " .. insult .. "!")
  1063.         local ObjectID = spawn_object("eqip", "powerups\\over shield") 
  1064.         powerup_interact(ObjectID, PlayerIndex)
  1065.     end
  1066.     return false
  1067. end
  1068.  
  1069. function TeamsAreUneven()
  1070.     local red = tonumber(get_var(0,"$reds"))
  1071.     local blue = tonumber(get_var(0,"$blues"))
  1072.     if (red > blue + 1) or (blue > red + 1) then
  1073.         return true
  1074.     else
  1075.         return false
  1076.     end
  1077. end
  1078.  
  1079. function getteamplay()
  1080.     if get_var(0,"$ffa") == "0" then
  1081.         return true
  1082.     else
  1083.         return false
  1084.     end
  1085. end
  1086.  
  1087. function moveobject(ObjectID, x, y, z)
  1088.     local object = get_object_memory(ObjectID)
  1089.     if get_object_memory(ObjectID) ~= 0 then
  1090.         local veh_obj = get_object_memory(read_dword(object + 0x11C))
  1091.         write_vector3d((veh_obj ~= 0 and veh_obj or object) + 0x5C, x, y, z)
  1092.     end
  1093. end
  1094.  
  1095. function GenerateInsult(noun)
  1096.     noun = {"sister-kisser", "fart-finagler", "butt-shaker", "douche-nozzle", "pig-licker", "goober-face",
  1097.     "butt-licker", "fudge-stick", "dingle-berry", "tally-wacker", "troll-twat", "puss-nozzle", "numb-nut",
  1098.     "twizzle-tit", "crack-head", "turd-burglar", "sleeze-bag", "butt-munch", "goat-rapist", "chicken-choker",
  1099.     "panty-waist", "gutter-slut", "spit-bucket", "snot-plug", "butt-pickle", "anal-wart", "phlegm wad",
  1100.     "taint-painter", "goiter-monkey", "syphilis-siphon", "butt-monkey", "boar-tit", "scat-muncher", "slag-bucket",
  1101.     "yeasty-wench", "trailer-monkey", "lot-lizard", "$2-whore", "bagpipe-player", "toe-sucker", "puppy-killer",
  1102.     "nipple-canker", "snot-biscuit", "fanny-face", "piss-badger", "crap-magnet", "hippie-poser", "snot-clot" }
  1103.     local rand_noun = rand(1, #noun+1)
  1104.     local noun_type = string.format("%s",  noun[rand_noun])
  1105.     if noun_type ~= nil then
  1106.         return noun_type
  1107.     end
  1108. end
  1109.  
  1110. function OnError(Message)
  1111.     print(debug.traceback())
  1112. end
  1113.  
  1114. -- Created by H® Shaft
  1115. -- This is a complete re-write of Wizards dodgeball for phasor, with added pieces from sehee, and 002
  1116. -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement