Guest User

Stats

a guest
Jul 3rd, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 63.86 KB | None | 0 0
  1. script_check = 0
  2. cur_players = 0
  3. first_strike = nil
  4. game_started = false
  5. perfection = true
  6. damage_table = {}
  7. sniper_table = {}
  8. shotgun_table = {}
  9. splatter_table = {}
  10. stick_table = {}
  11. dead_table = {}
  12. emp_table = {}
  13. killer_table = {}
  14. closecall_table = {}
  15. rejection_table = {}
  16. avenger_table = {}
  17. protector_table = {}
  18. hill_table = {}
  19. flag_table = {}
  20. avengeme_table = {}
  21. hash_table = {}
  22. kills_table = {}
  23. deaths_table = {}
  24. curdeaths_table = {}
  25. timer_table = {}
  26. killstreakcount_table = {}
  27. killstreak_table = {}
  28. multikilltimer_table = {}
  29. multikillcount_table = {}
  30. multikill_table = {}
  31. assistscount_table = {}
  32. assists_table = {}
  33. betrays_table = {}
  34. suicides_table = {}
  35. hits_table = {}
  36. fired_table = {}
  37. weaponkills_table = {}
  38. weapondeaths_table = {}
  39. spreecount_table = {}
  40. assistant_table = {}
  41. cq_table = {}
  42. crackshot_table = {}
  43. grenadier_table = {}
  44. heavy_table = {}
  45. jack_table = {}
  46. mobileasset_table = {}
  47. multikillcom_table = {}
  48. rearadmiral_table = {}
  49. sidearm_table = {}
  50. trigger_table = {}
  51. curspreecount_table = {}
  52. curassistant_table = {}
  53. curcq_table = {}
  54. curcrackshot_table = {}
  55. curgrenadier_table = {}
  56. curheavy_table = {}
  57. curjack_table = {}
  58. curmobileasset_table = {}
  59. curmultikillcom_table = {}
  60. currearadmiral_table = {}
  61. cursidearm_table = {}
  62. curtrigger_table = {}
  63. credits_table = {}
  64. earncredits_table = {}
  65.  
  66. rank_table = {
  67.     "Recruit",
  68.     "Private",
  69.     "Corporal",
  70.     "Corporal Grade 1",
  71.     "Sargeant",
  72.     "Sargeant Grade 1",
  73.     "Sargeant Grade 2",
  74.     "Warrant Officer",
  75.     "Warrant Officer Grade 1",
  76.     "Warrant Officer Grade 2",
  77.     "Warrant Officer Grade 3",
  78.     "Captain",
  79.     "Captain Grade 1",
  80.     "Captain Grade 2",
  81.     "Captain Grade 3",
  82.     "Major",
  83.     "Major Grade 1",
  84.     "Major Grade 2",
  85.     "Major Grade 3",
  86.     "Lt. Colonel",
  87.     "Lt. Colonel Grade 1",
  88.     "Lt. Colonel Grade 2",
  89.     "Lt. Colonel Grade 3",
  90.     "Commander",
  91.     "Commander Grade 1",
  92.     "Commander Grade 2",
  93.     "Commander Grade 3",
  94.     "Colonel",
  95.     "Colonel Grade 1",
  96.     "Colonel Grade 2",
  97.     "Colonel Grade 3",
  98.     "Brigadier",
  99.     "Brigadier Grade 1",
  100.     "Brigadier Grade 2",
  101.     "Brigadier Grade 3",
  102.     "General",
  103.     "General Grade 1",
  104.     "General Grade 2",
  105.     "General Grade 3",
  106.     "General Grade 4",
  107.     "Field Marshall",
  108.     "Hero",
  109.     "Legend",
  110.     "Mythic",
  111.     "Noble",
  112.     "Eclipse",
  113.     "Nova",
  114.     "Forerunner",
  115.     "Reclaimer",
  116.     "Inheritor"
  117. }
  118.  
  119. function GetRequiredVersion()
  120.     return 3104
  121. end
  122.  
  123. function OnScriptLoad(process)
  124.  
  125.     if script_check == 0 then
  126.  
  127.         local file1 = io.open("cg//stats//stats.txt", "r")
  128.         local file2 = io.open("cg//stats//weaponkills.txt", "r")
  129.         local file3 = io.open("cg//stats//weapondeaths.txt", "r")
  130.         local file4 = io.open("cg//stats//commendations.txt", "r")
  131.         local file5 = io.open("cg//stats//credits.txt", "r")
  132.  
  133.         if (file1 ~= nil) then
  134.  
  135.             for line in file1:lines() do
  136.  
  137.                 local words = {}
  138.  
  139.                 for word in line:gmatch("%w+") do
  140.                     table.insert(words, word)
  141.                 end
  142.  
  143.                 hash_table[words[1]] = 1
  144.                 kills_table[words[1]] = tonumber(words[2])
  145.                 deaths_table[words[1]] = tonumber(words[3])
  146.                 timer_table[words[1]] = tonumber(words[4])
  147.                 killstreak_table[words[1]] = tonumber(words[5])
  148.                 multikill_table[words[1]] = tonumber(words[6])
  149.                 assists_table[words[1]] = tonumber(words[7])
  150.                 betrays_table[words[1]] = tonumber(words[8])
  151.                 suicides_table[words[1]] = tonumber(words[9])
  152.  
  153.             end
  154.  
  155.             file1:close()
  156.  
  157.         end
  158.  
  159.         if (file2 ~= nil) then
  160.  
  161.             for line in file2:lines() do
  162.  
  163.                 local words = {}
  164.  
  165.                 for word in line:gmatch("%w+") do
  166.                     table.insert(words, word)
  167.                 end
  168.  
  169.                 weaponkills_table[words[1]] = words[2] .. "," .. words[3] .. "," .. words[4] .. "," .. words[5] .. "," .. words[6] .. "," .. words[7] .. "," .. words[8] .. "," .. words[9] .. "," .. words[10] .. "," .. words[11] .. "," .. words[12] .. "," .. words[13] .. "," .. words[14] .. "," .. words[15] .. "," .. words[16] .. "," .. words[17] .. "," .. words[18] .. "," .. words[19] .. "," .. words[20] .. "," .. words[21] .. "," .. words[22] .. "," .. words[23] .. "," .. words[24] .. "," .. words[25]
  170.  
  171.             end
  172.  
  173.             file2:close()
  174.  
  175.         end
  176.  
  177.         if (file3 ~= nil) then
  178.  
  179.             for line in file3:lines() do
  180.  
  181.                 local words = {}
  182.  
  183.                 for word in line:gmatch("%w+") do
  184.                     table.insert(words, word)
  185.                 end
  186.  
  187.                 weapondeaths_table[words[1]] = words[2] .. "," .. words[3] .. "," .. words[4] .. "," .. words[5] .. "," .. words[6] .. "," .. words[7] .. "," .. words[8] .. "," .. words[9] .. "," .. words[10] .. "," .. words[11] .. "," .. words[12] .. "," .. words[13] .. "," .. words[14] .. "," .. words[15] .. "," .. words[16] .. "," .. words[17] .. "," .. words[18] .. "," .. words[19] .. "," .. words[20] .. "," .. words[21] .. "," .. words[22] .. "," .. words[23] .. "," .. words[24] .. "," .. words[25]
  188.  
  189.             end
  190.  
  191.             file3:close()
  192.  
  193.         end
  194.  
  195.         if (file4 ~= nil) then
  196.  
  197.             for line in file4:lines() do
  198.  
  199.                 local words = {}
  200.  
  201.                 for word in line:gmatch("%w+") do
  202.                     table.insert(words, word)
  203.                 end
  204.  
  205.                 spreecount_table[words[1]] = tonumber(words[2])
  206.                 assistant_table[words[1]] = tonumber(words[3])
  207.                 cq_table[words[1]] = tonumber(words[4])
  208.                 crackshot_table[words[1]] = tonumber(words[5])
  209.                 grenadier_table[words[1]] = tonumber(words[6])
  210.                 heavy_table[words[1]] = tonumber(words[7])
  211.                 jack_table[words[1]] = tonumber(words[8])
  212.                 mobileasset_table[words[1]] = tonumber(words[9])
  213.                 multikillcom_table[words[1]] = tonumber(words[10])
  214.                 rearadmiral_table[words[1]] = tonumber(words[11])
  215.                 sidearm_table[words[1]] = tonumber(words[12])
  216.                 trigger_table[words[1]] = tonumber(words[13])
  217.  
  218.             end
  219.  
  220.             file4:close()
  221.  
  222.         end
  223.  
  224.         if (file5 ~= nil) then
  225.  
  226.             for line in file5:lines() do
  227.  
  228.                 local words = {}
  229.  
  230.                 for word in line:gmatch("%w+") do
  231.                     table.insert(words, word)
  232.                 end
  233.  
  234.                 credits_table[words[1]] = tonumber(words[2])
  235.  
  236.             end
  237.  
  238.             file5:close()
  239.  
  240.         end
  241.  
  242.         for i=0,15 do
  243.  
  244.             local hash = gethash(i)
  245.  
  246.             if hash ~= 0 then
  247.                 earncredits_table[hash] = 1
  248.                 InitializeTables(i)
  249.                 cur_players = cur_players + 1
  250.             end
  251.  
  252.         end
  253.  
  254.         if cur_players > 0 then
  255.             game_started = true
  256.         end
  257.  
  258.         registertimer(2, 975, 0, "GameTimer")
  259.         registertimer(3, 500, 0, "MainTimer")
  260.  
  261.     end
  262.  
  263.     script_check = 1
  264.  
  265. end
  266.  
  267. function OnScriptUnload()
  268. end
  269.  
  270. function OnNewGame(map)
  271. end
  272.  
  273. function OnGameEnd(mode)
  274.  
  275.     if mode == 1 then
  276.  
  277.         removetimer(1)
  278.         removetimer(2)
  279.         removetimer(3)
  280.  
  281.         if game_started == true then
  282.             if perfection == true then
  283.                 for i=0,15 do
  284.  
  285.                     local hash = gethash(i)
  286.  
  287.                     if hash ~= 0 then
  288.                         if curdeaths_table[hash] == nil and killstreakcount_table[hash] >= 15 then
  289.                             credits_table[hash] = credits_table[hash] + 7
  290.                             privatesay(i, "Perfection!")
  291.                         end
  292.                     end
  293.  
  294.                 end
  295.             end
  296.         end
  297.  
  298.         StoreStats()
  299.         game_started = false
  300.  
  301.     end
  302.  
  303. end
  304.  
  305. function OnServerChat(player, chattype, message)
  306.  
  307.     local AllowChat = 1
  308.     local count = gettokencount(message, " ")
  309.     local word = gettoken(message, " ", 0)
  310.     local hash = gethash(player)
  311.     local accuracy = "0%"
  312.     local kdr = kills_table[hash]
  313.     local kpm = 0
  314.     local dpm = 0
  315.     local gametime = " 0s"
  316.     local seconds = 0
  317.     local minutes = 0
  318.     local hours = 0
  319.     local days = 0
  320.     local multikill = 0
  321.     local killstreak = 0
  322.     local weapon = "None"
  323.     local credits = 0
  324.     local curlevel = 0
  325.     local nextlevel = 0
  326.     local nextrank = rank_table[2]
  327.     local rank = rank_table[1]
  328.  
  329.     if fired_table[hash] ~= 0 then
  330.         accuracy = round((hits_table[hash] / fired_table[hash]) * 100, 2) .. "%"
  331.     end
  332.  
  333.     if deaths_table[hash] ~= 0 then
  334.         kdr = round(kills_table[hash]/deaths_table[hash], 2)
  335.     else
  336.         kdr = kills_table[hash]
  337.     end
  338.  
  339.     if timer_table[hash] ~= 0 then
  340.         kpm = round((kills_table[hash] * 60)/timer_table[hash], 2)
  341.         dpm = round((deaths_table[hash] * 60)/timer_table[hash], 2)
  342.     end
  343.  
  344.     seconds = timer_table[hash]
  345.     minutes = math.floor(seconds / 60)
  346.     seconds = seconds - (minutes * 60)
  347.     hours = math.floor(minutes / 60)
  348.     minutes = minutes - (hours * 60)
  349.     days = math.floor(hours / 24)
  350.     hours = hours - (days * 24)
  351.  
  352.     if seconds ~= 0 then
  353.         gametime = " " .. seconds .. "s"
  354.     else
  355.         gametime = ""
  356.     end
  357.  
  358.     if minutes ~= 0 then
  359.         gametime = " " .. minutes .. "m" .. gametime
  360.     end
  361.  
  362.     if hours ~= 0 then
  363.         gametime = " " .. hours .. "h" .. gametime
  364.     end
  365.  
  366.     if days ~= 0 then
  367.         gametime = " " .. days .. "d" .. gametime
  368.     end
  369.  
  370.     if multikill_table[hash] == 1 then
  371.         multikill = multikill_table[hash]
  372.     elseif multikill_table[hash] == 2 then
  373.         multikill = "Double Kill (" .. multikill_table[hash] .. ")"
  374.     elseif multikill_table[hash] == 3 then
  375.         multikill = "Triple Kill (" .. multikill_table[hash] .. ")"
  376.     elseif multikill_table[hash] == 4 then
  377.         multikill = "Overkill (" .. multikill_table[hash] .. ")"
  378.     elseif multikill_table[hash] == 5 then
  379.         multikill = "Killtacular (" .. multikill_table[hash] .. ")"
  380.     elseif multikill_table[hash] == 6 then
  381.         multikill = "Killtrocity (" .. multikill_table[hash] .. ")"
  382.     elseif multikill_table[hash] == 7 then
  383.         multikill = "Killimanjaro (" .. multikill_table[hash] .. ")"
  384.     elseif multikill_table[hash] == 8 then
  385.         multikill = "Killtastrophe (" .. multikill_table[hash] .. ")"
  386.     elseif multikill_table[hash] == 9 then
  387.         multikill = "Killpocalypse (" .. multikill_table[hash] .. ")"
  388.     elseif multikill_table[hash] >= 10 then
  389.         multikill = "Killionaire (" .. multikill_table[hash] .. ")"
  390.     end
  391.  
  392.     if killstreak_table[hash] < 5 then
  393.         killstreak = killstreak_table[hash]
  394.     elseif killstreak_table[hash] >= 5 and killstreak_table[hash] < 10 then
  395.         killstreak = "Killing Spree (" .. killstreak_table[hash] .. ")"
  396.     elseif killstreak_table[hash] >= 10 and killstreak_table[hash] < 15 then
  397.         killstreak = "Killing Frenzy (" .. killstreak_table[hash] .. ")"
  398.     elseif killstreak_table[hash] >= 15 and killstreak_table[hash] < 20 then
  399.         killstreak = "Running Riot (" .. killstreak_table[hash] .. ")"
  400.     elseif killstreak_table[hash] >= 20 and killstreak_table[hash] < 25 then
  401.         killstreak = "Rampage (" .. killstreak_table[hash] .. ")"
  402.     elseif killstreak_table[hash] >= 25 and killstreak_table[hash] < 30 then
  403.         killstreak = "Untouchable (" .. killstreak_table[hash] .. ")"
  404.     elseif killstreak_table[hash] >= 30 and killstreak_table[hash] < 35 then
  405.         killstreak = "Invincible (" .. killstreak_table[hash] .. ")"
  406.     elseif killstreak_table[hash] >= 35 and killstreak_table[hash] < 40 then
  407.         killstreak = "Inconceivable (" .. killstreak_table[hash] .. ")"
  408.     elseif killstreak_table[hash] >= 40 then
  409.         killstreak = "Unfrigginbelievable (" .. killstreak_table[hash] .. ")"
  410.     end
  411.  
  412.     local kills = {}
  413.     local deaths = {}
  414.     local tempRatio = 0
  415.     local ratio = 0
  416.     local killCount = 0
  417.     local deathCount = 0
  418.  
  419.     for word in string.gmatch(weaponkills_table[hash], "%w+") do
  420.         table.insert(kills, tonumber(word))
  421.     end
  422.  
  423.     for word in string.gmatch(weapondeaths_table[hash], "%w+") do
  424.         table.insert(deaths, tonumber(word))
  425.     end
  426.  
  427.     local killsCount =  table.getn(kills)
  428.     local deathsCount = table.getn(deaths)
  429.  
  430.     if killsCount == deathsCount then
  431.         for i=1,killsCount do
  432.  
  433.             if deaths[i] ~= 0 then
  434.                 tempRatio = round(kills[i]/deaths[i], 2)
  435.             else
  436.                 tempRatio = kills[i]
  437.             end
  438.  
  439.             if tempRatio > ratio then
  440.                 ratio = tempRatio
  441.                 weapon = i
  442.                 killCount = kills[i]
  443.                 deathCount = deaths[i]
  444.             end
  445.  
  446.         end
  447.     end
  448.  
  449.     if weapon == 1 then
  450.         weapon = "Melee"
  451.     elseif weapon == 2 then
  452.         weapon = "Falling Damage"
  453.     elseif weapon == 3 then
  454.         weapon = "Collision Damage"
  455.     elseif weapon == 4 then
  456.         weapon = "Banshee Primary"
  457.     elseif weapon == 5 then
  458.         weapon = "Banshee Secondary"
  459.     elseif weapon == 6 then
  460.         weapon = "Shade Primary"
  461.     elseif weapon == 7 then
  462.         weapon = "Ghost Primary"
  463.     elseif weapon == 8 then
  464.         weapon = "Scorpion Primary"
  465.     elseif weapon == 9 then
  466.         weapon = "Scorpion Secondary"
  467.     elseif weapon == 10 then
  468.         weapon = "Warthog Primary"
  469.     elseif weapon == 11 then
  470.         weapon = "Assault Rifle"
  471.     elseif weapon == 12 then
  472.         weapon = "Ball"
  473.     elseif weapon == 13 then
  474.         weapon = "Flag"
  475.     elseif weapon == 14 then
  476.         weapon = "Flamethrower"
  477.     elseif weapon == 15 then
  478.         weapon = "Frag Grenade"
  479.     elseif weapon == 16 then
  480.         weapon = "Needler"
  481.     elseif weapon == 17 then
  482.         weapon = "Pistol"
  483.     elseif weapon == 18 then
  484.         weapon = "Plasma Grenade"
  485.     elseif weapon == 19 then
  486.         weapon = "Plasma Pistol"
  487.     elseif weapon == 20 then
  488.         weapon = "Plasma Rifle"
  489.     elseif weapon == 21 then
  490.         weapon = "Fuel Rod Gun"
  491.     elseif weapon == 22 then
  492.         weapon = "Rocket Launcher"
  493.     elseif weapon == 23 then
  494.         weapon = "Shotgun"
  495.     elseif weapon == 24 then
  496.         weapon = "Sniper Rifle"
  497.     end
  498.  
  499.     credits = credits_table[hash]
  500.  
  501.     if credits < 7500 then
  502.         curlevel = 0
  503.         nextlevel = 7500
  504.     elseif credits >= 7500 and credits < 10000 then
  505.         rank = rank_table[2]
  506.         curlevel = 7500
  507.         nextlevel = 2500
  508.     elseif credits >= 10000 and credits < 15000 then
  509.         rank = rank_table[3]
  510.         curlevel = 10000
  511.         nextlevel = 5000
  512.     elseif credits >= 15000 and credits < 20000 then
  513.         rank = rank_table[4]
  514.         curlevel = 15000
  515.         nextlevel = 5000
  516.     elseif credits >= 20000 and credits < 26250 then
  517.         rank = rank_table[5]
  518.         curlevel = 20000
  519.         nextlevel = 6250
  520.     elseif credits >= 26250 and credits < 32500 then
  521.         rank = rank_table[6]
  522.         curlevel = 26250
  523.         nextlevel = 6250
  524.     elseif credits >= 32500 and credits < 45000 then
  525.         rank = rank_table[7]
  526.         curlevel = 32500
  527.         nextlevel = 12500
  528.     elseif credits >= 45000 and credits < 78000 then
  529.         rank = rank_table[8]
  530.         curlevel = 45000
  531.         nextlevel = 33000
  532.     elseif credits >= 78000 and credits < 111000 then
  533.         rank = rank_table[9]
  534.         curlevel = 78000
  535.         nextlevel = 33000
  536.     elseif credits >= 111000 and credits < 144000 then
  537.         rank = rank_table[10]
  538.         curlevel = 111000
  539.         nextlevel = 33000
  540.     elseif credits >= 144000 and credits < 210000 then
  541.         rank = rank_table[11]
  542.         curlevel = 144000
  543.         nextlevel = 66000
  544.     elseif credits >= 210000 and credits < 233000 then
  545.         rank = rank_table[12]
  546.         curlevel = 210000
  547.         nextlevel = 23000
  548.     elseif credits >= 233000 and credits < 256000 then
  549.         rank = rank_table[13]
  550.         curlevel = 233000
  551.         nextlevel = 23000
  552.     elseif credits >= 256000 and credits < 279000 then
  553.         rank = rank_table[14]
  554.         curlevel = 256000
  555.         nextlevel = 23000
  556.     elseif credits >= 279000 and credits < 325000 then
  557.         rank = rank_table[15]
  558.         curlevel = 279000
  559.         nextlevel = 46000
  560.     elseif credits >= 325000 and credits < 350000 then
  561.         rank = rank_table[16]
  562.         curlevel = 325000
  563.         nextlevel = 25000
  564.     elseif credits >= 350000 and credits < 375000 then
  565.         rank = rank_table[17]
  566.         curlevel = 350000
  567.         nextlevel = 25000
  568.     elseif credits >= 375000 and credits < 400000 then
  569.         rank = rank_table[18]
  570.         curlevel = 375000
  571.         nextlevel = 25000
  572.     elseif credits >= 400000 and credits < 450000 then
  573.         rank = rank_table[19]
  574.         curlevel = 400000
  575.         nextlevel = 50000
  576.     elseif credits >= 450000 and credits < 480000 then
  577.         rank = rank_table[20]
  578.         curlevel = 450000
  579.         nextlevel = 30000
  580.     elseif credits >= 480000 and credits < 510000 then
  581.         rank = rank_table[21]
  582.         curlevel = 480000
  583.         nextlevel = 30000
  584.     elseif credits >= 510000 and credits < 540000 then
  585.         rank = rank_table[22]
  586.         curlevel = 510000
  587.         nextlevel = 30000
  588.     elseif credits >= 540000 and credits < 600000 then
  589.         rank = rank_table[23]
  590.         curlevel = 540000
  591.         nextlevel = 60000
  592.     elseif credits >= 600000 and credits < 650000 then
  593.         rank = rank_table[24]
  594.         curlevel = 600000
  595.         nextlevel = 50000
  596.     elseif credits >= 650000 and credits < 700000 then
  597.         rank = rank_table[25]
  598.         curlevel = 650000
  599.         nextlevel = 50000
  600.     elseif credits >= 700000 and credits < 750000 then
  601.         rank = rank_table[26]
  602.         curlevel = 700000
  603.         nextlevel = 50000
  604.     elseif credits >= 750000 and credits < 850000 then
  605.         rank = rank_table[27]
  606.         curlevel = 750000
  607.         nextlevel = 100000
  608.     elseif credits >= 850000 and credits < 960000 then
  609.         rank = rank_table[28]
  610.         curlevel = 850000
  611.         nextlevel = 110000
  612.     elseif credits >= 960000 and credits < 1070000 then
  613.         rank = rank_table[29]
  614.         curlevel = 960000
  615.         nextlevel = 110000
  616.     elseif credits >= 1070000 and credits < 1180000 then
  617.         rank = rank_table[30]
  618.         curlevel = 1070000
  619.         nextlevel = 110000
  620.     elseif credits >= 1180000 and credits < 1400000 then
  621.         rank = rank_table[31]
  622.         curlevel = 1180000
  623.         nextlevel = 220000
  624.     elseif credits >= 1400000 and credits < 1520000 then
  625.         rank = rank_table[32]
  626.         curlevel = 1400000
  627.         nextlevel = 120000
  628.     elseif credits >= 1520000 and credits < 1640000 then
  629.         rank = rank_table[33]
  630.         curlevel = 1520000
  631.         nextlevel = 120000
  632.     elseif credits >= 1640000 and credits < 1760000 then
  633.         rank = rank_table[34]
  634.         curlevel = 1640000
  635.         nextlevel = 120000
  636.     elseif credits >= 1760000 and credits < 2000000 then
  637.         rank = rank_table[35]
  638.         curlevel = 1760000
  639.         nextlevel = 240000
  640.     elseif credits >= 2000000 and credits < 2200000 then
  641.         rank = rank_table[36]
  642.         curlevel = 2000000
  643.         nextlevel = 200000
  644.     elseif credits >= 2200000 and credits < 2350000 then
  645.         rank = rank_table[37]
  646.         curlevel = 2200000
  647.         nextlevel = 150000
  648.     elseif credits >= 2350000 and credits < 2500000 then
  649.         rank = rank_table[38]
  650.         curlevel = 2350000
  651.         nextlevel = 150000
  652.     elseif credits >= 2500000 and credits < 2650000 then
  653.         rank = rank_table[39]
  654.         curlevel = 2500000
  655.         nextlevel = 150000
  656.     elseif credits >= 2650000 and credits < 3000000 then
  657.         rank = rank_table[40]
  658.         curlevel = 2650000
  659.         nextlevel = 350000
  660.     elseif credits >= 3000000 and credits < 3700000 then
  661.         rank = rank_table[41]
  662.         curlevel = 3000000
  663.         nextlevel = 700000
  664.     elseif credits >= 3700000 and credits < 4600000 then
  665.         rank = rank_table[42]
  666.         curlevel = 3700000
  667.         nextlevel = 900000
  668.     elseif credits >= 4600000 and credits < 5650000 then
  669.         rank = rank_table[43]
  670.         curlevel = 4600000
  671.         nextlevel = 1050000
  672.     elseif credits >= 5650000 and credits < 7000000 then
  673.         rank = rank_table[44]
  674.         curlevel = 5650000
  675.         nextlevel = 1350000
  676.     elseif credits >= 7000000 and credits < 8500000 then
  677.         rank = rank_table[45]
  678.         curlevel = 7000000
  679.         nextlevel = 1500000
  680.     elseif credits >= 8500000 and credits < 11000000 then
  681.         rank = rank_table[46]
  682.         curlevel = 8500000
  683.         nextlevel = 2500000
  684.     elseif credits >= 11000000 and credits < 13000000 then
  685.         rank = rank_table[47]
  686.         curlevel = 11000000
  687.         nextlevel = 2000000
  688.     elseif credits >= 13000000 and credits < 16500000 then
  689.         rank = rank_table[48]
  690.         curlevel = 13000000
  691.         nextlevel = 3500000
  692.     elseif credits >= 16500000 and credits < 20000000 then
  693.         rank = rank_table[49]
  694.         curlevel = 16500000
  695.         nextlevel = 3500000
  696.     elseif credits >= 20000000 then
  697.         rank = rank_table[50]
  698.         curlevel = 20000000
  699.         nextlevel = 0
  700.     end
  701.  
  702.     local i = 0
  703.  
  704.     for k,v in pairs(rank_table) do
  705.         if v == rank then
  706.             i = k + 1
  707.         end
  708.     end
  709.  
  710.     nextrank = rank_table[i]
  711.     credits = comma_value(credits)
  712.     curlevel = comma_value(credits - curlevel)
  713.     nextlevel = comma_value(nextlevel)
  714.  
  715.     if count == 1 and word == "@stats" then
  716.         AllowChat = 0
  717.         privatesay(player, "----------")
  718.         privatesay(player, "Kills: " .. kills_table[hash] .. " | Deaths: " .. deaths_table[hash] .. " | KDR: " .. kdr .. " | Accuracy: " .. accuracy)
  719.         privatesay(player, "Time Played:" .. gametime .. " | KPM: " .. kpm .. " | DPM: " .. dpm)
  720.         privatesay(player, "Best Multikill: " .. multikill .. " | Best Killstreak: " .. killstreak)
  721.         privatesay(player, "Top Weapon: " .. weapon .. " | Kills: " .. killCount .. " | Deaths: " .. deathCount .. " | KDR: " .. ratio)
  722.         privatesay(player, "Assists: " .. assists_table[hash] .. " | Betrays: " .. betrays_table[hash] .. " | Suicides: " .. suicides_table[hash])
  723.         privatesay(player, "Rank: " .. rank .. " | Credits: " .. credits .. " | Next: " .. nextrank .. " (" .. curlevel .. " of " .. nextlevel .. ")")
  724.         privatesay(player, "----------")
  725.     end
  726.  
  727.     return AllowChat
  728.  
  729. end
  730.  
  731. function OnServerCommand(player, command)
  732.  
  733.     if command == "sv_reloadscripts" then
  734.         StoreStats()
  735.     end
  736.  
  737.     if player ~= -1 and command == "sv_map_next" then
  738.         perfection = false
  739.     end
  740.  
  741.     return 1
  742. end
  743.  
  744. function OnTeamDecision(cur_team)
  745.     return cur_team
  746. end
  747.  
  748. function OnPlayerJoin(player, team)
  749.  
  750.     local hash = gethash(player)
  751.     earncredits_table[hash] = 1
  752.     InitializeTables(player)
  753.     cur_players = cur_players + 1
  754.  
  755.     if cur_players == 1 then
  756.         registertimer(1, 1000, 0, "NewGameTimer")
  757.     end
  758.  
  759. end
  760.  
  761. function OnPlayerLeave(player, team)
  762.  
  763.     local hash = gethash(player)
  764.     earncredits_table[hash] = nil
  765.     cur_players = cur_players - 1
  766.  
  767.     if cur_players == 0 then
  768.         StoreStats()
  769.         game_started = false
  770.     end
  771.  
  772.     for i=0,15 do
  773.  
  774.         local hash = gethash(i)
  775.  
  776.         if killer_table[hash] == player then
  777.             killer_table[hash] = nil
  778.         end
  779.  
  780.     end
  781.  
  782. end
  783.  
  784. function OnPlayerKill(killer, victim, mode)
  785.  
  786.     if game_started == true then
  787.  
  788.         local k_hash = gethash(killer)
  789.         local v_hash = gethash(victim)
  790.         local k_team = getteam(killer)
  791.         local v_team = getteam(victim)
  792.         local k_player = getplayer(killer)
  793.         local k_playerObjId = readdword(k_player, 0x34)
  794.         local k_object = getobject(k_playerObjId)
  795.         local v_player = getplayer(victim)
  796.         local v_playerObjId = readdword(v_player, 0x34)
  797.         local v_object = getobject(v_playerObjId)
  798.         sniper_table[v_hash] = 0
  799.         shotgun_table[v_hash] = 0
  800.         splatter_table[v_hash] = 0
  801.         stick_table[v_hash] = 0
  802.         dead_table[v_hash] = 1
  803.         assist_table[v_hash] = 0
  804.         hill_table[v_hash] = nil
  805.         killer_table[v_hash] = killer
  806.         closecall_table[v_hash] = nil
  807.         avenger_table[v_hash] = nil
  808.         protector_table[v_hash] = nil
  809.         multikilltimer_table[v_hash] = nil
  810.         multikillcount_table[v_hash] = 0
  811.         deaths_table[v_hash] = deaths_table[v_hash] + 1
  812.         curdeaths_table[v_hash] = 1
  813.  
  814.         for i=0,15 do
  815.  
  816.             local hash = gethash(i)
  817.  
  818.             if protector_table[hash] ~= nil and protector_table[hash] == victim then
  819.                 protector_table[hash] = nil
  820.             end
  821.  
  822.         end
  823.  
  824.         if mode == 4 then
  825.  
  826.             kills_table[k_hash] = kills_table[k_hash] + 1
  827.             multikillcount_table[k_hash] = multikillcount_table[k_hash] + 1
  828.             multikilltimer_table[k_hash] = 4
  829.  
  830.             if multikillcount_table[k_hash] > multikill_table[k_hash] then
  831.                 multikill_table[k_hash] = multikillcount_table[k_hash]
  832.             end
  833.  
  834.             killstreakcount_table[k_hash] = killstreakcount_table[k_hash] + 1
  835.  
  836.             if killstreakcount_table[k_hash] > killstreak_table[k_hash] then
  837.                 killstreak_table[k_hash] = killstreakcount_table[k_hash]
  838.             end
  839.  
  840.             if multikillcount_table[k_hash] >= 4 then
  841.  
  842.                 local team_count = getteamsize(v_team)
  843.                 local dead_count = 0
  844.  
  845.                 for i=0,15 do
  846.  
  847.                     local team = getteam(i)
  848.                     local hash = gethash(i)
  849.  
  850.                     if hash ~= 0 then
  851.                         if team == v_team then
  852.                             if dead_table[hash] ~= nil then
  853.                                 dead_count = dead_count + 1
  854.                             end
  855.                         end
  856.                     end
  857.  
  858.                 end
  859.  
  860.                 if dead_count == team_count then
  861.                     credits_table[k_hash] = credits_table[k_hash] + 7
  862.                     jack_table[k_hash] = jack_table[k_hash] + 1
  863.                     privatesay(killer, "Extermination!")
  864.                 end
  865.  
  866.             end
  867.  
  868.             avenger_table[k_hash] = 4
  869.             avengeme_table[v_hash] = killer
  870.  
  871.             if damage_table[k_hash] ~= nil then
  872.  
  873.                 if damage_table[k_hash] == "weapons\\sniper rifle\\sniper bullet" then
  874.  
  875.                     credits_table[k_hash] = credits_table[k_hash] + 4
  876.                     crackshot_table[k_hash] = crackshot_table[k_hash] + 1
  877.  
  878.                     if sniper_table[k_hash] == nil then
  879.                         sniper_table[k_hash] = 1
  880.                     else
  881.                         sniper_table[k_hash] = sniper_table[k_hash] + 1
  882.                     end
  883.  
  884.                     if sniper_table[k_hash] == 5 then
  885.                         credits_table[k_hash] = credits_table[k_hash] + 10
  886.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  887.                         privatesay(killer, "Sniper Spree!")
  888.                     elseif sniper_table[k_hash] == 10 then
  889.                         credits_table[k_hash] = credits_table[k_hash] + 10
  890.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  891.                         privatesay(killer, "Sharpshooter!")
  892.                     elseif sniper_table[k_hash] == 15 then
  893.                         credits_table[k_hash] = credits_table[k_hash] + 10
  894.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  895.                         privatesay(killer, "Be the Bullet!")
  896.                     end
  897.  
  898.                 elseif damage_table[k_hash] == "weapons\\shotgun\\pellet" then
  899.  
  900.                     credits_table[k_hash] = credits_table[k_hash] + 6
  901.                     cq_table[k_hash] = cq_table[k_hash] + 1
  902.  
  903.                     if shotgun_table[k_hash] == nil then
  904.                         shotgun_table[k_hash] = 1
  905.                     else
  906.                         shotgun_table[k_hash] = shotgun_table[k_hash] + 1
  907.                     end
  908.  
  909.                     if shotgun_table[k_hash] == 5 then
  910.                         credits_table[k_hash] = credits_table[k_hash] + 10
  911.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  912.                         privatesay(killer, "Shotgun Spree!")
  913.                     elseif shotgun_table[k_hash] == 10 then
  914.                         credits_table[k_hash] = credits_table[k_hash] + 10
  915.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  916.                         privatesay(killer, "Open Season!")
  917.                     elseif shotgun_table[k_hash] == 15 then
  918.                         credits_table[k_hash] = credits_table[k_hash] + 10
  919.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  920.                         privatesay(killer, "Buck Wild!")
  921.                     end
  922.  
  923.                 elseif damage_table[k_hash] == "globals\\vehicle_collision" then
  924.  
  925.                     credits_table[k_hash] = credits_table[k_hash] + 6
  926.                     mobileasset_table[k_hash] = mobileasset_table[k_hash] + 1
  927.                     privatesay(killer, "Splatter!")
  928.  
  929.                     if splatter_table[k_hash] == nil then
  930.                         splatter_table[k_hash] = 1
  931.                     else
  932.                         splatter_table[k_hash] = splatter_table[k_hash] + 1
  933.                     end
  934.  
  935.                     if splatter_table[k_hash] == 5 then
  936.                         credits_table[k_hash] = credits_table[k_hash] + 10
  937.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  938.                         privatesay(killer, "Splatter Spree!")
  939.                     elseif splatter_table[k_hash] == 10 then
  940.                         credits_table[k_hash] = credits_table[k_hash] + 10
  941.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  942.                         privatesay(killer, "Vehicular Manslaughter!")
  943.                     elseif splatter_table[k_hash] == 15 then
  944.                         credits_table[k_hash] = credits_table[k_hash] + 10
  945.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  946.                         privatesay(killer, "Sunday Driver!")
  947.                     end
  948.  
  949.                 elseif damage_table[k_hash] == "weapons\\plasma grenade\\attached" then
  950.  
  951.                     credits_table[k_hash] = credits_table[k_hash] + 7
  952.                     grenadier_table[k_hash] = grenadier_table[k_hash] + 1
  953.                     privatesay(killer, "Grenade Stick!")
  954.  
  955.                     if stick_table[k_hash] == nil then
  956.                         stick_table[k_hash] = 1
  957.                     else
  958.                         stick_table[k_hash] = stick_table[k_hash] + 1
  959.                     end
  960.  
  961.                     if stick_table[k_hash] == 5 then
  962.                         credits_table[k_hash] = credits_table[k_hash] + 10
  963.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  964.                         privatesay(killer, "Stick Spree!")
  965.                     elseif stick_table[k_hash] == 10 then
  966.                         credits_table[k_hash] = credits_table[k_hash] + 10
  967.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  968.                         privatesay(killer, "Sticky Fingers!")
  969.                     elseif stick_table[k_hash] == 15 then
  970.                         credits_table[k_hash] = credits_table[k_hash] + 10
  971.                         spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  972.                         privatesay(killer, "Corrected!")
  973.                     end
  974.  
  975.                 elseif damage_table[k_hash] == "weapons\\ball\\melee" then
  976.                     credits_table[k_hash] = credits_table[k_hash] + 7
  977.                     privatesay(killer, "Oddball Kill!")
  978.                 elseif damage_table[k_hash] == "weapons\\flag\\melee" then
  979.                     credits_table[k_hash] = credits_table[k_hash] + 7
  980.                     privatesay(killer, "Flag Kill!")
  981.                 elseif damage_table[k_hash] == "weapons\\needler\\explosion" then
  982.                     credits_table[k_hash] = credits_table[k_hash] + 7
  983.                     privatesay(killer, "Needle Kill!")
  984.                 elseif damage_table[k_hash] == "vehicles\\banshee\\bolt" or damage_table[k_hash] == "vehicles\\banshee\\mp_fuel rod explosion" or damage_table[k_hash] == "vehicles\\ghost\\bolt" or damage_table[k_hash] == "vehicles\\scorpion\\bullet" or damage_table[k_hash] == "vehicles\\scorpion\\shell explosion" or damage_table[k_hash] == "vehicles\\warthog\\bullet" then
  985.                     credits_table[k_hash] = credits_table[k_hash] + 4
  986.                 elseif damage_table[k_hash] == "weapons\\frag grenade\\explosion" or damage_table[k_hash] == "weapons\\plasma grenade\\explosion" then
  987.                     credits_table[k_hash] = credits_table[k_hash] + 4
  988.                     grenadier_table[k_hash] = grenadier_table[k_hash] + 1
  989.                 elseif damage_table[k_hash] == "weapons\\flamethrower\\burning" or damage_table[k_hash] == "weapons\\flamethrower\\explosion" or damage_table[k_hash] == "weapons\\flamethrower\\impact damage" or damage_table[k_hash] == "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion" or damage_table[k_hash] == "weapons\\plasma_cannon\\impact damage" or damage_table[k_hash] == "weapons\\rocket launcher\\explosion" then
  990.                     credits_table[k_hash] = credits_table[k_hash] + 4
  991.                     heavy_table[k_hash] = heavy_table[k_hash] + 1
  992.                 elseif damage_table[k_hash] == "weapons\\pistol\\bullet" or damage_table[k_hash] == "weapons\\plasma pistol\\bolt" or damage_table[k_hash] == "weapons\\plasma rifle\\charged bolt" then
  993.                     credits_table[k_hash] = credits_table[k_hash] + 4
  994.                     sidearm_table[k_hash] = sidearm_table[k_hash] + 1
  995.                 elseif damage_table[k_hash] == "weapons\\assault rifle\\bullet" or damage_table[k_hash] == "weapons\\needler\\detonation damage" or damage_table[k_hash] == "weapons\\needler\\impact damage" or damage_table[k_hash] == "weapons\\plasma rifle\\bolt" then
  996.                     credits_table[k_hash] = credits_table[k_hash] + 4
  997.                     trigger_table[k_hash] = trigger_table[k_hash] + 1
  998.                 end
  999.  
  1000.                 local found = string.find(damage_table[k_hash], "melee", -5)
  1001.  
  1002.                 if found ~= nil then
  1003.  
  1004.                     credits_table[k_hash] = credits_table[k_hash] + 6
  1005.                     cq_table[k_hash] = cq_table[k_hash] + 1
  1006.  
  1007.                     if readdword(k_object, 0x204) == 0x51 then
  1008.                         credits_table[k_hash] = credits_table[k_hash] + 7
  1009.                         rearadmiral_table[k_hash] = rearadmiral_table[k_hash] + 1
  1010.                         privatesay(killer, "Assassin!")
  1011.                     else
  1012.                         privatesay(killer, "Beat Down!")
  1013.                     end
  1014.                 end
  1015.  
  1016.             end
  1017.  
  1018.             if dead_table[k_hash] ~= nil then
  1019.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1020.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1021.                 privatesay(killer, "Kill from the Grave!")
  1022.             end
  1023.  
  1024.             if killstreakcount_table[v_hash] >= 5 then
  1025.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1026.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1027.                 privatesay(killer, "Killjoy!")
  1028.             end
  1029.  
  1030.             if emp_table[k_hash] ~= nil and emp_table[k_hash] == victim then
  1031.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1032.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1033.                 privatesay(killer, "EMP Blast!")
  1034.             end
  1035.  
  1036.             if killer_table[k_hash] ~= nil and killer_table[k_hash] == victim then
  1037.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1038.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1039.                 privatesay(killer, "Revenge!")
  1040.                 killer_table[k_hash] = nil
  1041.             end
  1042.  
  1043.             if first_strike == nil then
  1044.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1045.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1046.                 privatesay(killer, "First Strike!")
  1047.                 first_strike = k_hash
  1048.             end
  1049.  
  1050.             local obj_action3 = readbyte(v_object, 0x2A4)
  1051.  
  1052.             if obj_action3 == 5 then
  1053.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1054.                 privatesay(killer, "Reload This!")
  1055.             end
  1056.  
  1057.             if readfloat(k_object, 0xE4) == 0 and readfloat(k_object, 0xE0) > 0 and readfloat(k_object, 0xE0) <= 0.2 then
  1058.                 closecall_table[k_hash] = 1
  1059.             end
  1060.  
  1061.             local v_airborne = readbyte(v_object, 0x4CC)
  1062.  
  1063.             if v_airborne == 1 then
  1064.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1065.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1066.                 privatesay(killer, "Pull!")
  1067.             end
  1068.  
  1069.             if avenger_table[v_hash] ~= nil then
  1070.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1071.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1072.                 privatesay(killer, "Avenger!")
  1073.             end
  1074.  
  1075.             local k_airborne = readbyte(k_object, 0x4CC)
  1076.  
  1077.             if k_airborne == 1 then
  1078.                 credits_table[k_hash] = credits_table[k_hash] + 7
  1079.                 jack_table[k_hash] = jack_table[k_hash] + 1
  1080.                 privatesay(killer, "Firebird!")
  1081.             end
  1082.  
  1083.             for i=0,15 do
  1084.  
  1085.                 local hash = gethash(i)
  1086.                 local m_player = getplayer(i)
  1087.                 local player_assists = readword(m_player, 0xA4)
  1088.  
  1089.                 if hash ~= 0 then
  1090.                     if hash ~= k_hash then
  1091.  
  1092.                         if player_assists > assistscount_table[hash] then
  1093.  
  1094.                             credits_table[hash] = credits_table[hash] + 6
  1095.                             assistant_table[hash] = assistant_table[hash] + 1
  1096.                             privatesay(i, "Assist!")
  1097.                             assistscount_table[hash] = player_assists
  1098.                             assists_table[hash] = assists_table[hash] + 1
  1099.  
  1100.                             if assists_table[hash] == 5 then
  1101.                                 credits_table[hash] = credits_table[hash] + 10
  1102.                                 spreecount_table[hash] = spreecount_table[hash] + 1
  1103.                                 privatesay(i, "Assist Spree!")
  1104.                             elseif assists_table[hash] == 10 then
  1105.                                 credits_table[hash] = credits_table[hash] + 10
  1106.                                 spreecount_table[hash] = spreecount_table[hash] + 1
  1107.                                 privatesay(i, "Sidekick!")
  1108.                             elseif assists_table[hash] == 15 then
  1109.                                 credits_table[hash] = credits_table[hash] + 10
  1110.                                 spreecount_table[hash] = spreecount_table[hash] + 1
  1111.                                 privatesay(i, "Second Gunman!")
  1112.                             end
  1113.  
  1114.                         end
  1115.  
  1116.                         if avengeme_table[hash] ~= nil and avengeme_table[hash] == victim then
  1117.                             privatesay(i, "Avenge Me!")
  1118.                             avengeme_table[hash] = nil
  1119.                         end
  1120.  
  1121.                         if protector_table[hash] ~= nil and protector_table[hash] == victim then
  1122.                             credits_table[k_hash] = credits_table[k_hash] + 7
  1123.                             privatesay(killer, "Protector!")
  1124.                             privatesay(i, "Bros to the End!")
  1125.                         end
  1126.  
  1127.                     end
  1128.                 end
  1129.  
  1130.             end
  1131.  
  1132.             if hill_table[k_hash] ~= nil and hill_table[k_hash] < 5 then
  1133.                 hill_table[k_hash] = hill_table[k_hash] + 1
  1134.             end
  1135.  
  1136.             if hill_table[k_hash] == 5 then
  1137.                 privatesay(killer, "Hail to the King!")
  1138.                 hill_table[k_hash] = nil
  1139.             end
  1140.  
  1141.             if readbyte(v_player, 0x74) == 0x29 and readbyte(v_player, 0x7A) == 0x70 then
  1142.                 privatesay(killer, "Killed Oddball Carrier!")
  1143.             else
  1144.                 if readbyte(v_object, 0x2F2) == 2 then
  1145.                     privatesay(killer, "Killed Flag Carrier!")
  1146.                 end
  1147.             end
  1148.  
  1149.             if multikillcount_table[k_hash] == 2 then
  1150.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1151.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1152.                 privatesay(killer, "Double Kill!")
  1153.             elseif multikillcount_table[k_hash] == 3 then
  1154.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1155.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1156.                 privatesay(killer, "Triple Kill!")
  1157.             elseif multikillcount_table[k_hash] == 4 then
  1158.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1159.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1160.                 privatesay(killer, "Overkill!")
  1161.             elseif multikillcount_table[k_hash] == 5 then
  1162.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1163.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1164.                 privatesay(killer, "Killtacular!")
  1165.             elseif multikillcount_table[k_hash] == 6 then
  1166.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1167.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1168.                 privatesay(killer, "Killtrocity!")
  1169.             elseif multikillcount_table[k_hash] == 7 then
  1170.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1171.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1172.                 privatesay(killer, "Killimanjaro!")
  1173.             elseif multikillcount_table[k_hash] == 8 then
  1174.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1175.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1176.                 privatesay(killer, "Killtastrophe!")
  1177.             elseif multikillcount_table[k_hash] == 9 then
  1178.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1179.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1180.                 privatesay(killer, "Killpocalypse!")
  1181.             elseif multikillcount_table[k_hash] == 10 then
  1182.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1183.                 multikillcom_table[k_hash] = multikillcom_table[k_hash] + 1
  1184.                 privatesay(killer, "Killionaire!")
  1185.             end
  1186.  
  1187.             if killstreakcount_table[k_hash] == 5 then
  1188.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1189.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1190.                 privatesay(killer, "Killing Spree!")
  1191.             elseif killstreakcount_table[k_hash] == 10 then
  1192.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1193.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1194.                 privatesay(killer, "Killing Frenzy!")
  1195.             elseif killstreakcount_table[k_hash] == 15 then
  1196.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1197.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1198.                 privatesay(killer, "Running Riot!")
  1199.             elseif killstreakcount_table[k_hash] == 20 then
  1200.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1201.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1202.                 privatesay(killer, "Rampage!")
  1203.             elseif killstreakcount_table[k_hash] == 25 then
  1204.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1205.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1206.                 privatesay(killer, "Untouchable!")
  1207.             elseif killstreakcount_table[k_hash] == 30 then
  1208.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1209.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1210.                 privatesay(killer, "Invincible!")
  1211.             elseif killstreakcount_table[k_hash] == 35 then
  1212.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1213.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1214.                 privatesay(killer, "Inconceivable!")
  1215.             elseif killstreakcount_table[k_hash] == 40 then
  1216.                 credits_table[k_hash] = credits_table[k_hash] + 10
  1217.                 spreecount_table[k_hash] = spreecount_table[k_hash] + 1
  1218.                 privatesay(killer, "Unfrigginbelievable!")
  1219.             end
  1220.  
  1221.             local tagname = damage_table[k_hash]
  1222.             local found1 = string.find(tagname, "melee", -5)
  1223.             local found2 = string.find(tagname, "ball")
  1224.             local found3 = string.find(tagname, "flag")
  1225.             local killer = {}
  1226.             local victim = {}
  1227.  
  1228.             for word in string.gmatch(weaponkills_table[k_hash], "%w+") do
  1229.                 table.insert(killer, tonumber(word))
  1230.             end
  1231.  
  1232.             for word in string.gmatch(weapondeaths_table[v_hash], "%w+") do
  1233.                 table.insert(victim, tonumber(word))
  1234.             end
  1235.  
  1236.             if found1 ~= nil and found2 == nil and found3 == nil then
  1237.                 killer[1] = killer[1] + 1
  1238.                 victim[1] = victim[1] + 1
  1239.             elseif tagname == "globals\\distance" or tagname == "globals\\falling" then
  1240.                 killer[2] = killer[2] + 1
  1241.                 victim[2] = victim[2] + 1
  1242.             elseif tagname == "globals\\vehicle_collision" then
  1243.                 killer[3] = killer[3] + 1
  1244.                 victim[3] = victim[3] + 1
  1245.             elseif tagname == "vehicles\\banshee\\bolt" then
  1246.                 killer[4] = killer[4] + 1
  1247.                 victim[4] = victim[4] + 1
  1248.             elseif tagname == "vehicles\\banshee\\mp_fuel rod explosion" then
  1249.                 killer[5] = killer[5] + 1
  1250.                 victim[5] = victim[5] + 1
  1251.             elseif tagname == "vehicles\\c gun turret\\mp bolt" then
  1252.                 killer[6] = killer[6] + 1
  1253.                 victim[6] = victim[6] + 1
  1254.             elseif tagname == "vehicles\\ghost\\bolt" then
  1255.                 killer[7] = killer[7] + 1
  1256.                 victim[7] = victim[7] + 1
  1257.             elseif tagname == "vehicles\\scorpion\\bullet" then
  1258.                 killer[8] = killer[8] + 1
  1259.                 victim[8] = victim[8] + 1
  1260.             elseif tagname == "vehicles\\scorpion\\shell explosion" then
  1261.                 killer[9] = killer[9] + 1
  1262.                 victim[9] = victim[9] + 1
  1263.             elseif tagname == "vehicles\\warthog\\bullet" then
  1264.                 killer[10] = killer[10] + 1
  1265.                 victim[10] = victim[10] + 1
  1266.             elseif tagname == "weapons\\assault rifle\\bullet" then
  1267.                 killer[11] = killer[11] + 1
  1268.                 victim[11] = victim[11] + 1
  1269.             elseif tagname == "weapons\\ball\\melee" then
  1270.                 killer[12] = killer[12] + 1
  1271.                 victim[12] = victim[12] + 1
  1272.             elseif tagname == "weapons\\flag\\melee" then
  1273.                 killer[13] = killer[13] + 1
  1274.                 victim[13] = victim[13] + 1
  1275.             elseif tagname == "weapons\\flamethrower\\burning" or tagname == "weapons\\flamethrower\\explosion" or tagname == "weapons\\flamethrower\\impact damage" then
  1276.                 killer[14] = killer[14] + 1
  1277.                 victim[14] = victim[14] + 1
  1278.             elseif tagname == "weapons\\frag grenade\\explosion" then
  1279.                 killer[15] = killer[15] + 1
  1280.                 victim[15] = victim[15] + 1
  1281.             elseif tagname == "weapons\\needler\\detonation damage" or tagname == "weapons\\needler\\explosion" or tagname == "weapons\\needler\\impact damage" then
  1282.                 killer[16] = killer[16] + 1
  1283.                 victim[16] = victim[16] + 1
  1284.             elseif tagname == "weapons\\pistol\\bullet" then
  1285.                 killer[17] = killer[17] + 1
  1286.                 victim[17] = victim[17] + 1
  1287.             elseif tagname == "weapons\\plasma grenade\\attached" or tagname == "weapons\\plasma grenade\\explosion" then
  1288.                 killer[18] = killer[18] + 1
  1289.                 victim[18] = victim[18] + 1
  1290.             elseif tagname == "weapons\\plasma pistol\\bolt" or tagname == "weapons\\plasma rifle\\charged bolt" then
  1291.                 killer[19] = killer[19] + 1
  1292.                 victim[19] = victim[19] + 1
  1293.             elseif tagname == "weapons\\plasma rifle\\bolt" then
  1294.                 killer[20] = killer[20] + 1
  1295.                 victim[20] = victim[20] + 1
  1296.             elseif tagname == "weapons\\plasma_cannon\\effects\\plasma_cannon_explosion" or tagname == "weapons\\plasma_cannon\\impact damage" then
  1297.                 killer[21] = killer[21] + 1
  1298.                 victim[21] = victim[21] + 1
  1299.             elseif tagname == "weapons\\rocket launcher\\explosion" then
  1300.                 killer[22] = killer[22] + 1
  1301.                 victim[22] = victim[22] + 1
  1302.             elseif tagname == "weapons\\shotgun\\pellet" then
  1303.                 killer[23] = killer[23] + 1
  1304.                 victim[23] = victim[23] + 1
  1305.             elseif tagname == "weapons\\sniper rifle\\sniper bullet" then
  1306.                 killer[24] = killer[24] + 1
  1307.                 victim[24] = victim[24] + 1
  1308.             end
  1309.  
  1310.             weaponkills_table[k_hash] = killer[1] .. "," .. killer[2] .. "," .. killer[3] .. "," .. killer[4] .. "," .. killer[5] .. "," .. killer[6] .. "," .. killer[7] .. "," .. killer[8] .. "," .. killer[9] .. "," .. killer[10] .. "," .. killer[11] .. "," .. killer[12] .. "," .. killer[13] .. "," .. killer[14] .. "," .. killer[15] .. "," .. killer[16] .. "," .. killer[17] .. "," .. killer[18] .. "," .. killer[19] .. "," .. killer[20] .. "," .. killer[21] .. "," .. killer[22] .. "," .. killer[23] .. "," .. killer[24]
  1311.             weapondeaths_table[v_hash] = victim[1] .. "," .. victim[2] .. "," .. victim[3] .. "," .. victim[4] .. "," .. victim[5] .. "," .. victim[6] .. "," .. victim[7] .. "," .. victim[8] .. "," .. victim[9] .. "," .. victim[10] .. "," .. victim[11] .. "," .. victim[12] .. "," .. victim[13] .. "," .. victim[14] .. "," .. victim[15] .. "," .. victim[16] .. "," .. victim[17] .. "," .. victim[18] .. "," .. victim[19] .. "," .. victim[20] .. "," .. victim[21] .. "," .. victim[22] .. "," .. victim[23] .. "," .. victim[24]
  1312.  
  1313.         elseif mode == 5 then
  1314.             betrays_table[k_hash] = betrays_table[k_hash] + 1
  1315.         elseif mode == 6 then
  1316.             suicides_table[v_hash] = suicides_table[v_hash] + 1
  1317.         end
  1318.  
  1319.         killstreakcount_table[v_hash] = 0
  1320.  
  1321.     end
  1322.  
  1323. end
  1324.  
  1325. function OnKillMultiplier(player, multiplier)
  1326. end
  1327.  
  1328. function OnPlayerSpawn(player, m_objectId)
  1329. end
  1330.  
  1331. function OnPlayerSpawnEnd(player, m_objectId)
  1332.  
  1333.     if game_started == true then
  1334.         local hash = gethash(player)
  1335.         dead_table[hash] = nil
  1336.     end
  1337.  
  1338. end
  1339.  
  1340. function OnTeamChange(relevant, player, team, dest_team)
  1341.     return 1
  1342. end
  1343.  
  1344. function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
  1345.  
  1346.     if game_started == true then
  1347.  
  1348.         local hash = gethash(player)
  1349.         local m_player = getplayer(player)
  1350.         local m_playerObjId = readdword(m_player, 0x34)
  1351.         local m_object = getobject(m_playerObjId)
  1352.  
  1353.         if tagType == "eqip" and tagName == "powerups\\over shield" then
  1354.             rejection_table[hash] = readfloat(m_object, 0xE4)
  1355.         end
  1356.     end
  1357.  
  1358.     return 1
  1359.  
  1360. end
  1361.  
  1362. function OnWeaponReload(player, weapon)
  1363.     return 1
  1364. end
  1365.  
  1366. function OnVehicleEntry(player)
  1367.     return 1
  1368. end
  1369.  
  1370. function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
  1371.  
  1372.     if game_started == true then
  1373.  
  1374.         local receiver = objecttoplayer(receiving_obj)
  1375.         local causer = objecttoplayer(causing_obj)
  1376.         local r_hash = gethash(receiver)
  1377.         local c_hash = gethash(causer)
  1378.         local r_team = getteam(receiver)
  1379.         local c_team = getteam(causer)
  1380.         local r_player = getplayer(receiver)
  1381.         local r_playerObjId = readdword(r_player, 0x34)
  1382.         local r_object = getobject(r_playerObjId)
  1383.         local found1 = string.find(tagname, "wave", -4)
  1384.         local found2 = string.find(tagname, "melee_response", -14)
  1385.         local found3 = string.find(tagname, "trigger", -7)
  1386.  
  1387.         if causer ~= -1 and receiver ~= -1 then
  1388.  
  1389.             if found1 == nil and found2 == nil and found3 == nil then
  1390.                 damage_table[c_hash] = tagname
  1391.             end
  1392.  
  1393.             if readfloat(r_object, 0xE4) > 0 then
  1394.                 if tagname == "weapons\\plasma rifle\\charged bolt" or tagname == "weapons\\plasma grenade\\explosion" then
  1395.                     emp_table[c_hash] = receiver
  1396.                 end
  1397.             end
  1398.  
  1399.             if causer ~= receiver and r_team ~= c_team then
  1400.                 if rejection_table[r_hash] ~= nil then
  1401.  
  1402.                     local health = readfloat(r_object, 0xD8) * readfloat(r_object, 0xE0)
  1403.                     local shields = readfloat(r_object, 0xDC) * rejection_table[r_hash]
  1404.                     local hitpoints = health + shields
  1405.  
  1406.                     if readfloat(tagdata, 0x1D0) > hitpoints or readfloat(tagdata, 0x1D4) > hitpoints or readfloat(tagdata, 0x1D8) > hitpoints then
  1407.                         credits_table[r_hash] = credits_table[r_hash] + 7
  1408.                         jack_table[r_hash] = jack_table[r_hash] + 1
  1409.                         privatesay(receiver, "Rejection!")
  1410.                         rejection_table[r_hash] = nil
  1411.                     end
  1412.  
  1413.                 end
  1414.             end
  1415.  
  1416.             if readfloat(r_object, 0xE4) == 0 and readfloat(r_object, 0xE0) <= 0.2 then
  1417.                 protector_table[r_hash] = causer
  1418.             end
  1419.  
  1420.         end
  1421.  
  1422.         if found1 == nil and found2 == nil then
  1423.  
  1424.             if found3 ~= nil then
  1425.                 fired_table[r_hash] = fired_table[r_hash] + 1
  1426.             end
  1427.  
  1428.             if causer ~= -1 and receiver ~= -1 then
  1429.                 hits_table[c_hash] = hits_table[c_hash] + 1
  1430.             end
  1431.  
  1432.         end
  1433.  
  1434.     end
  1435.  
  1436. end
  1437.  
  1438. function OnWeaponAssignment(player, object, count, tag)
  1439. end
  1440.  
  1441. function OnWeaponCreation(owningPlayer, owningObject, m_weapon, tag)
  1442. end
  1443.  
  1444. function GameTimer(id, userdata, count)
  1445.  
  1446.     if game_started == true then
  1447.         for i=0,15 do
  1448.  
  1449.             local hash = gethash(i)
  1450.  
  1451.             if hash ~= 0 then
  1452.                 timer_table[hash] = timer_table[hash] + 1
  1453.             end
  1454.  
  1455.         end
  1456.     end
  1457.  
  1458.     return 1
  1459.  
  1460. end
  1461.  
  1462. function MainTimer(id, userdata, count)
  1463.  
  1464.     if game_started == true then
  1465.         for i=0,15 do
  1466.  
  1467.             local hash = gethash(i)
  1468.  
  1469.             if hash ~= 0 then
  1470.  
  1471.                 local m_player = getplayer(i)
  1472.                 local m_playerObjId = readdword(m_player, 0x34)
  1473.                 local m_object = getobject(m_playerObjId)
  1474.                 local player_objective_mode = readbyte(m_player, 0x74)
  1475.                 local player_objective_mode2 = readbyte(m_player, 0x7A)
  1476.  
  1477.                 if emp_table[hash] ~= nil then
  1478.                     if readfloat(m_object, 0xE4) > 0 then
  1479.                         emp_table[hash] = nil
  1480.                     end
  1481.                 end
  1482.  
  1483.                 if closecall_table[hash] ~= nil and readfloat(m_object, 0xE4) > 0 then
  1484.                     credits_table[hash] = credits_table[hash] + 7
  1485.                     jack_table[hash] = jack_table[hash] + 1
  1486.                     privatesay(i, "Close Call!")
  1487.                     closecall_table[hash] = nil
  1488.                 end
  1489.  
  1490.                 if rejection_table[hash] ~= nil and readfloat(m_object, 0xE4) > 2.9 then
  1491.                     rejection_table[hash] = nil
  1492.                 end
  1493.  
  1494.                 if avenger_table[hash] ~= nil then
  1495.                     if avenger_table[hash] > 0.5 then
  1496.                         avenger_table[hash] = avenger_table[hash] - 0.5
  1497.                     elseif avenger_table[hash] == 0.5 then
  1498.  
  1499.                         avenger_table[hash] = nil
  1500.  
  1501.                         for k,v in pairs(avengeme_table) do
  1502.                             if v == i then
  1503.                                 v = nil
  1504.                             end
  1505.                         end
  1506.  
  1507.                     end
  1508.                 end
  1509.  
  1510.                 if protector_table[hash] ~= nil and readfloat(m_object, 0xE4) > 0 then
  1511.                     protector_table[hash] = nil
  1512.                 end
  1513.  
  1514.                 if multikilltimer_table[hash] ~= nil then
  1515.                     if multikilltimer_table[hash] > 0.5 then
  1516.                         multikilltimer_table[hash] = multikilltimer_table[hash] - 0.5
  1517.                     elseif multikilltimer_table[hash] == 0.5 then
  1518.                         multikilltimer_table[hash] = nil
  1519.                         multikillcount_table[hash] = 0
  1520.                     end
  1521.                 end
  1522.  
  1523.                 if player_objective_mode == 0x22 and player_objective_mode2 == 0x71 then
  1524.                     if hill_table[hash] == nil then
  1525.                         hill_table[hash] = 0
  1526.                     end
  1527.                 else
  1528.                     if hill_table[hash] ~= nil then
  1529.                         hill_table[hash] = nil
  1530.                     end
  1531.                 end
  1532.  
  1533.                 if readword(m_player, 0xC8) > flag_table[hash] then
  1534.                     credits_table[hash] = credits_table[hash] + 7
  1535.                     privatesay(i, "Flag Score!")
  1536.                 end
  1537.  
  1538.                 flag_table[hash] = readword(m_player, 0xC8)
  1539.                 CheckCommendations(i)
  1540.  
  1541.             end
  1542.  
  1543.         end
  1544.     end
  1545.  
  1546.     return 1
  1547.  
  1548. end
  1549.  
  1550. function StoreStats()
  1551.  
  1552.     for k,v in pairs(earncredits_table) do
  1553.         if v == 1 then
  1554.  
  1555.             local file1 = io.open("cg//stats//stats.txt", "w+")
  1556.             local file2 = io.open("cg//stats//weaponkills.txt", "w+")
  1557.             local file3 = io.open("cg//stats//weapondeaths.txt", "w+")
  1558.             local file4 = io.open("cg//stats//commendations.txt", "w+")
  1559.             local file5 = io.open("cg//stats//credits.txt", "w+")
  1560.  
  1561.             if (file1 ~= nil) then
  1562.  
  1563.                 for k,v in pairs(hash_table) do
  1564.                     if v == 1 then
  1565.                         file1:write(k .. "," .. kills_table[k] .. "," .. deaths_table[k] .. "," .. timer_table[k] .. "," .. killstreak_table[k] .. "," .. multikill_table[k] .. "," .. assists_table[k] .. "," .. betrays_table[k] .. "," .. suicides_table[k] .. "\n")
  1566.                     end
  1567.                 end
  1568.  
  1569.                 file1:close()
  1570.  
  1571.             end
  1572.  
  1573.             if (file2 ~= nil) then
  1574.  
  1575.                 for k,v in pairs(weaponkills_table) do
  1576.                     if k ~= 0 then
  1577.                         file2:write(k .. "," .. v .. "\n")
  1578.                     end
  1579.                 end
  1580.  
  1581.                 file2:close()
  1582.  
  1583.             end
  1584.  
  1585.             if (file3 ~= nil) then
  1586.  
  1587.                 for k,v in pairs(weapondeaths_table) do
  1588.                     if k ~= 0 then
  1589.                         file3:write(k .. "," .. v .. "\n")
  1590.                     end
  1591.                 end
  1592.  
  1593.                 file3:close()
  1594.  
  1595.             end
  1596.  
  1597.             if (file4 ~= nil) then
  1598.  
  1599.                 for k,v in pairs(commendations_table) do
  1600.                     if k ~= 0 then
  1601.                         file4:write(k .. "," .. spreecount_table[k] .. "," .. assistant_table[k] .. "," .. cq_table[k] .. "," .. crackshot_table[k] .. "," .. grenadier_table[k] .. "," .. heavy_table[k] .. "," .. jack_table[k] .. "," .. mobileasset_table[k] .. "," .. multikillcom_table[k] .. "," .. rearadmiral_table[k] .. "," .. sidearm_table[k] .. "," .. trigger_table[k] .. "\n")
  1602.                     end
  1603.                 end
  1604.  
  1605.                 file4:close()
  1606.  
  1607.             end
  1608.  
  1609.             if (file5 ~= nil) then
  1610.  
  1611.                 for k,v in pairs(credits_table) do
  1612.                     if k ~= 0 then
  1613.                         file5:write(k .. "," .. v .. "\n")
  1614.                     end
  1615.                 end
  1616.  
  1617.                 file5:close()
  1618.  
  1619.             end
  1620.  
  1621.         end
  1622.     end
  1623.  
  1624. end
  1625.  
  1626. function CheckCommendations(player)
  1627.  
  1628.     local hash = gethash(player)
  1629.  
  1630.     if spreecount_table[hash] ~= curspreecount_table[hash] then
  1631.  
  1632.         if spreecount_table[hash] == 5 then
  1633.             credits_table[hash] = credits_table[hash] + 250
  1634.             privatesay(player, "Any Spree: Iron!")
  1635.         elseif spreecount_table[hash] == 50 then
  1636.             credits_table[hash] = credits_table[hash] + 425
  1637.             privatesay(player, "Any Spree: Bronze!")
  1638.         elseif spreecount_table[hash] == 250 then
  1639.             credits_table[hash] = credits_table[hash] + 1200
  1640.             privatesay(player, "Any Spree: Silver!")
  1641.         elseif spreecount_table[hash] == 1000 then
  1642.             credits_table[hash] = credits_table[hash] + 2400
  1643.             privatesay(player, "Any Spree: Gold!")
  1644.         elseif spreecount_table[hash] == 4000 then
  1645.             credits_table[hash] = credits_table[hash] + 2400
  1646.             privatesay(player, "Any Spree: Onyx!")
  1647.         elseif spreecount_table[hash] == 10000 then
  1648.             privatesay(player, "Any Spree: MAX!")
  1649.         end
  1650.  
  1651.         curspreecount_table[hash] = spreecount_table[hash]
  1652.  
  1653.     end
  1654.  
  1655.     if assistant_table[hash] ~= curassistant_table[hash] then
  1656.  
  1657.         if assistant_table[hash] == 50 then
  1658.             credits_table[hash] = credits_table[hash] + 150
  1659.             privatesay(player, "Assistant: Iron!")
  1660.         elseif assistant_table[hash] == 250 then
  1661.             credits_table[hash] = credits_table[hash] + 425
  1662.             privatesay(player, "Assistant: Bronze!")
  1663.         elseif assistant_table[hash] == 1000 then
  1664.             credits_table[hash] = credits_table[hash] + 1200
  1665.             privatesay(player, "Assistant: Silver!")
  1666.         elseif assistant_table[hash] == 4000 then
  1667.             credits_table[hash] = credits_table[hash] + 2400
  1668.             privatesay(player, "Assistant: Gold!")
  1669.         elseif assistant_table[hash] == 8000 then
  1670.             credits_table[hash] = credits_table[hash] + 2400
  1671.             privatesay(player, "Assistant: Onyx!")
  1672.         elseif assistant_table[hash] == 20000 then
  1673.             privatesay(player, "Assistant: MAX!")
  1674.         end
  1675.  
  1676.         curassistant_table[hash] = assistant_table[hash]
  1677.  
  1678.     end
  1679.  
  1680.     if cq_table[hash] ~= curcq_table[hash] then
  1681.  
  1682.         if cq_table[hash] == 50 then
  1683.             credits_table[hash] = credits_table[hash] + 150
  1684.             privatesay(player, "Close Quarters: Iron!")
  1685.         elseif cq_table[hash] == 125 then
  1686.             credits_table[hash] = credits_table[hash] + 375
  1687.             privatesay(player, "Close Quarters: Bronze!")
  1688.         elseif cq_table[hash] == 400 then
  1689.             credits_table[hash] = credits_table[hash] + 1200
  1690.             privatesay(player, "Close Quarters: Silver!")
  1691.         elseif cq_table[hash] == 1600 then
  1692.             credits_table[hash] = credits_table[hash] + 2400
  1693.             privatesay(player, "Close Quarters: Gold!")
  1694.         elseif cq_table[hash] == 4000 then
  1695.             credits_table[hash] = credits_table[hash] + 2400
  1696.             privatesay(player, "Close Quarters: Onyx!")
  1697.         elseif cq_table[hash] == 8000 then
  1698.             privatesay(player, "Close Quarters: MAX!")
  1699.         end
  1700.  
  1701.         curcq_table[hash] = cq_table[hash]
  1702.  
  1703.     end
  1704.  
  1705.     if crackshot_table[hash] ~= curcrackshot_table[hash] then
  1706.  
  1707.         if crackshot_table[hash] == 100 then
  1708.             credits_table[hash] = credits_table[hash] + 300
  1709.             privatesay(player, "Crack Shot: Iron!")
  1710.         elseif crackshot_table[hash] == 500 then
  1711.             credits_table[hash] = credits_table[hash] + 1000
  1712.             privatesay(player, "Crack Shot: Bronze!")
  1713.         elseif crackshot_table[hash] == 4000 then
  1714.             credits_table[hash] = credits_table[hash] + 2000
  1715.             privatesay(player, "Crack Shot: Silver!")
  1716.         elseif crackshot_table[hash] == 10000 then
  1717.             credits_table[hash] = credits_table[hash] + 3000
  1718.             privatesay(player, "Crack Shot: Gold!")
  1719.         elseif crackshot_table[hash] == 20000 then
  1720.             credits_table[hash] = credits_table[hash] + 3000
  1721.             privatesay(player, "Crack Shot: Onyx!")
  1722.         elseif crackshot_table[hash] == 32000 then
  1723.             privatesay(player, "Crack Shot: MAX!")
  1724.         end
  1725.  
  1726.         curcrackshot_table[hash] = crackshot_table[hash]
  1727.  
  1728.     end
  1729.  
  1730.     if grenadier_table[hash] ~= curgrenadier_table[hash] then
  1731.  
  1732.         if grenadier_table[hash] == 25 then
  1733.             credits_table[hash] = credits_table[hash] + 100
  1734.             privatesay(player, "Grenadier: Iron!")
  1735.         elseif grenadier_table[hash] == 125 then
  1736.             credits_table[hash] = credits_table[hash] + 200
  1737.             privatesay(player, "Grenadier: Bronze!")
  1738.         elseif grenadier_table[hash] == 500 then
  1739.             credits_table[hash] = credits_table[hash] + 500
  1740.             privatesay(player, "Grenadier: Silver!")
  1741.         elseif grenadier_table[hash] == 4000 then
  1742.             credits_table[hash] = credits_table[hash] + 750
  1743.             privatesay(player, "Grenadier: Gold!")
  1744.         elseif grenadier_table[hash] == 8000 then
  1745.             credits_table[hash] = credits_table[hash] + 750
  1746.             privatesay(player, "Grenadier: Onyx!")
  1747.         elseif grenadier_table[hash] == 14000 then
  1748.             privatesay(player, "Grenadier: MAX!")
  1749.         end
  1750.  
  1751.         curgrenadier_table[hash] = grenadier_table[hash]
  1752.  
  1753.     end
  1754.  
  1755.     if heavy_table[hash] ~= curheavy_table[hash] then
  1756.  
  1757.         if heavy_table[hash] == 25 then
  1758.             credits_table[hash] = credits_table[hash] + 100
  1759.             privatesay(player, "Heavy Weapon: Iron!")
  1760.         elseif heavy_table[hash] == 150 then
  1761.             credits_table[hash] = credits_table[hash] + 200
  1762.             privatesay(player, "Heavy Weapon: Bronze!")
  1763.         elseif heavy_table[hash] == 750 then
  1764.             credits_table[hash] = credits_table[hash] + 500
  1765.             privatesay(player, "Heavy Weapon: Silver!")
  1766.         elseif heavy_table[hash] == 3000 then
  1767.             credits_table[hash] = credits_table[hash] + 750
  1768.             privatesay(player, "Heavy Weapon: Gold!")
  1769.         elseif heavy_table[hash] == 7000 then
  1770.             credits_table[hash] = credits_table[hash] + 750
  1771.             privatesay(player, "Heavy Weapon: Onyx!")
  1772.         elseif heavy_table[hash] == 14000 then
  1773.             privatesay(player, "Heavy Weapon: MAX!")
  1774.         end
  1775.  
  1776.         curheavy_table[hash] = heavy_table[hash]
  1777.  
  1778.     end
  1779.  
  1780.     if jack_table[hash] ~= curjack_table[hash] then
  1781.  
  1782.         if jack_table[hash] == 50 then
  1783.             credits_table[hash] = credits_table[hash] + 150
  1784.             privatesay(player, "Jack of All Trades: Iron!")
  1785.         elseif jack_table[hash] == 125 then
  1786.             credits_table[hash] = credits_table[hash] + 375
  1787.             privatesay(player, "Jack of All Trades: Bronze!")
  1788.         elseif jack_table[hash] == 400 then
  1789.             credits_table[hash] = credits_table[hash] + 1000
  1790.             privatesay(player, "Jack of All Trades: Silver!")
  1791.         elseif jack_table[hash] == 1600 then
  1792.             credits_table[hash] = credits_table[hash] + 1600
  1793.             privatesay(player, "Jack of All Trades: Gold!")
  1794.         elseif jack_table[hash] == 4800 then
  1795.             credits_table[hash] = credits_table[hash] + 1600
  1796.             privatesay(player, "Jack of All Trades: Onyx!")
  1797.         elseif jack_table[hash] == 9600 then
  1798.             privatesay(player, "Jack of All Trades: MAX!")
  1799.         end
  1800.  
  1801.         curjack_table[hash] = jack_table[hash]
  1802.  
  1803.     end
  1804.  
  1805.     if mobileasset_table[hash] ~= curmobileasset_table[hash] then
  1806.  
  1807.         if mobileasset_table[hash] == 25 then
  1808.             credits_table[hash] = credits_table[hash] + 100
  1809.             privatesay(player, "Mobile Asset: Iron!")
  1810.         elseif mobileasset_table[hash] == 125 then
  1811.             credits_table[hash] = credits_table[hash] + 200
  1812.             privatesay(player, "Mobile Asset: Bronze!")
  1813.         elseif mobileasset_table[hash] == 500 then
  1814.             credits_table[hash] = credits_table[hash] + 500
  1815.             privatesay(player, "Mobile Asset: Silver!")
  1816.         elseif mobileasset_table[hash] == 4000 then
  1817.             credits_table[hash] = credits_table[hash] + 750
  1818.             privatesay(player, "Mobile Asset: Gold!")
  1819.         elseif mobileasset_table[hash] == 8000 then
  1820.             credits_table[hash] = credits_table[hash] + 750
  1821.             privatesay(player, "Mobile Asset: Onyx!")
  1822.         elseif mobileasset_table[hash] == 14000 then
  1823.             privatesay(player, "Mobile Asset: MAX!")
  1824.         end
  1825.  
  1826.         curmobileasset_table[hash] = mobileasset_table[hash]
  1827.  
  1828.     end
  1829.  
  1830.     if multikillcom_table[hash] ~= curmultikillcom_table[hash] then
  1831.  
  1832.         if multikillcom_table[hash] == 10 then
  1833.             credits_table[hash] = credits_table[hash] + 250
  1834.             privatesay(player, "Multikill: Iron!")
  1835.         elseif multikillcom_table[hash] == 125 then
  1836.             credits_table[hash] = credits_table[hash] + 450
  1837.             privatesay(player, "Multikill: Bronze!")
  1838.         elseif multikillcom_table[hash] == 500 then
  1839.             credits_table[hash] = credits_table[hash] + 875
  1840.             privatesay(player, "Multikill: Silver!")
  1841.         elseif multikillcom_table[hash] == 2500 then
  1842.             credits_table[hash] = credits_table[hash] + 1400
  1843.             privatesay(player, "Multikill: Gold!")
  1844.         elseif multikillcom_table[hash] == 5000 then
  1845.             credits_table[hash] = credits_table[hash] + 1400
  1846.             privatesay(player, "Multikill: Onyx!")
  1847.         elseif multikillcom_table[hash] == 15000 then
  1848.             privatesay(player, "Multikill: MAX!")
  1849.         end
  1850.  
  1851.         curmultikillcom_table[hash] = multikillcom_table[hash]
  1852.  
  1853.     end
  1854.  
  1855.     if rearadmiral_table[hash] ~= currearadmiral_table[hash] then
  1856.  
  1857.         if rearadmiral_table[hash] == 5 then
  1858.             credits_table[hash] = credits_table[hash] + 300
  1859.             privatesay(player, "Rear Admiral: Iron!")
  1860.         elseif rearadmiral_table[hash] == 25 then
  1861.             credits_table[hash] = credits_table[hash] + 500
  1862.             privatesay(player, "Rear Admiral: Bronze!")
  1863.         elseif rearadmiral_table[hash] == 100 then
  1864.             credits_table[hash] = credits_table[hash] + 750
  1865.             privatesay(player, "Rear Admiral: Silver!")
  1866.         elseif rearadmiral_table[hash] == 1000 then
  1867.             credits_table[hash] = credits_table[hash] + 1000
  1868.             privatesay(player, "Rear Admiral: Gold!")
  1869.         elseif rearadmiral_table[hash] == 4000 then
  1870.             credits_table[hash] = credits_table[hash] + 1000
  1871.             privatesay(player, "Rear Admiral: Onyx!")
  1872.         elseif rearadmiral_table[hash] == 8000 then
  1873.             privatesay(player, "Rear Admiral: MAX!")
  1874.         end
  1875.  
  1876.         currearadmiral_table[hash] = rearadmiral_table[hash]
  1877.  
  1878.     end
  1879.  
  1880.     if sidearm_table[hash] ~= curassistant_table[hash] then
  1881.  
  1882.         if sidearm_table[hash] == 50 then
  1883.             credits_table[hash] = credits_table[hash] + 100
  1884.             privatesay(player, "Sidearm: Iron!")
  1885.         elseif sidearm_table[hash] == 250 then
  1886.             credits_table[hash] = credits_table[hash] + 200
  1887.             privatesay(player, "Sidearm: Bronze!")
  1888.         elseif sidearm_table[hash] == 1000 then
  1889.             credits_table[hash] = credits_table[hash] + 500
  1890.             privatesay(player, "Sidearm: Silver!")
  1891.         elseif sidearm_table[hash] == 4000 then
  1892.             credits_table[hash] = credits_table[hash] + 750
  1893.             privatesay(player, "Sidearm: Gold!")
  1894.         elseif sidearm_table[hash] == 8000 then
  1895.             credits_table[hash] = credits_table[hash] + 750
  1896.             privatesay(player, "Sidearm: Onyx!")
  1897.         elseif sidearm_table[hash] == 10000 then
  1898.             privatesay(player, "Sidearm: MAX!")
  1899.         end
  1900.  
  1901.         cursidearm_table[hash] = sidearm_table[hash]
  1902.  
  1903.     end
  1904.  
  1905.     if trigger_table[hash] ~= curtrigger_table[hash] then
  1906.  
  1907.         if trigger_table[hash] == 100 then
  1908.             credits_table[hash] = credits_table[hash] + 300
  1909.             privatesay(player, "Trigger Man: Iron!")
  1910.         elseif trigger_table[hash] == 500 then
  1911.             credits_table[hash] = credits_table[hash] + 1000
  1912.             privatesay(player, "Trigger Man: Bronze!")
  1913.         elseif trigger_table[hash] == 4000 then
  1914.             credits_table[hash] = credits_table[hash] + 2000
  1915.             privatesay(player, "Trigger Man: Silver!")
  1916.         elseif trigger_table[hash] == 10000 then
  1917.             credits_table[hash] = credits_table[hash] + 3000
  1918.             privatesay(player, "Trigger Man: Gold!")
  1919.         elseif trigger_table[hash] == 20000 then
  1920.             credits_table[hash] = credits_table[hash] + 3000
  1921.             privatesay(player, "Trigger Man: Onyx!")
  1922.         elseif trigger_table[hash] == 32000 then
  1923.             privatesay(player, "Trigger Man: MAX!")
  1924.         end
  1925.  
  1926.         curtrigger_table[hash] = trigger_table[hash]
  1927.  
  1928.     end
  1929.  
  1930. end
  1931.  
  1932. function InitializeTables(player)
  1933.  
  1934.     local hash = gethash(player)
  1935.  
  1936.     if flag_table[hash] == nil then
  1937.         flag_table[hash] = 0
  1938.     end
  1939.  
  1940.     if kills_table[hash] == nil then
  1941.         kills_table[hash] = 0
  1942.     end
  1943.  
  1944.     if deaths_table[hash] == nil then
  1945.         deaths_table[hash] = 0
  1946.     end
  1947.  
  1948.     if timer_table[hash] == nil then
  1949.         timer_table[hash] = 0
  1950.     end
  1951.  
  1952.     if killstreakcount_table[hash] == nil then
  1953.         killstreakcount_table[hash] = 0
  1954.     end
  1955.  
  1956.     if killstreak_table[hash] == nil then
  1957.         killstreak_table[hash] = 0
  1958.     end
  1959.  
  1960.     if multikillcount_table[hash] == nil then
  1961.         multikillcount_table[hash] = 0
  1962.     end
  1963.  
  1964.     if multikill_table[hash] == nil then
  1965.         multikill_table[hash] = 0
  1966.     end
  1967.  
  1968.     if assistscount_table[hash] == nil then
  1969.         assistscount_table[hash] = 0
  1970.     end
  1971.  
  1972.     if assists_table[hash] == nil then
  1973.         assists_table[hash] = 0
  1974.     end
  1975.  
  1976.     if betrays_table[hash] == nil then
  1977.         betrays_table[hash] = 0
  1978.     end
  1979.  
  1980.     if suicides_table[hash] == nil then
  1981.         suicides_table[hash] = 0
  1982.     end
  1983.  
  1984.     if hits_table[hash] == nil then
  1985.         hits_table[hash] = 0
  1986.     end
  1987.  
  1988.     if fired_table[hash] == nil then
  1989.         fired_table[hash] = 0
  1990.     end
  1991.  
  1992.     -- melee,falling,collision,banshee1,banshee2,shade,ghost,scorpion1,scorpion2,warthog,ar,ball,flag,flamer,frag,needler,pistol,plasma,pp,pr,frg,rox,shotty,sniper
  1993.     if weaponkills_table[hash] == nil then
  1994.         weaponkills_table[hash] = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
  1995.     end
  1996.  
  1997.     if weapondeaths_table[hash] == nil then
  1998.         weapondeaths_table[hash] = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
  1999.     end
  2000.  
  2001.     if spreecount_table[hash] == nil then
  2002.         spreecount_table[hash] = 0
  2003.     end
  2004.  
  2005.     if assistant_table[hash] == nil then
  2006.         assistant_table[hash] = 0
  2007.     end
  2008.  
  2009.     if cq_table[hash] == nil then
  2010.         cq_table[hash] = 0
  2011.     end
  2012.  
  2013.     if crackshot_table[hash] == nil then
  2014.         crackshot_table[hash] = 0
  2015.     end
  2016.  
  2017.     if grenadier_table[hash] == nil then
  2018.         grenadier_table[hash] = 0
  2019.     end
  2020.  
  2021.     if heavy_table[hash] == nil then
  2022.         heavy_table[hash] = 0
  2023.     end
  2024.  
  2025.     if jack_table[hash] == nil then
  2026.         jack_table[hash] = 0
  2027.     end
  2028.  
  2029.     if mobileasset_table[hash] == nil then
  2030.         mobileasset_table[hash] = 0
  2031.     end
  2032.  
  2033.     if multikillcom_table[hash] == nil then
  2034.         multikillcom_table[hash] = 0
  2035.     end
  2036.  
  2037.     if rearadmiral_table[hash] == nil then
  2038.         rearadmiral_table[hash] = 0
  2039.     end
  2040.  
  2041.     if sidearm_table[hash] == nil then
  2042.         sidearm_table[hash] = 0
  2043.     end
  2044.  
  2045.     if trigger_table[hash] == nil then
  2046.         trigger_table[hash] = 0
  2047.     end
  2048.  
  2049.     if curspreecount_table[hash] == nil then
  2050.         curspreecount_table[hash] = spreecount_table[hash]
  2051.     end
  2052.  
  2053.     if curassistant_table[hash] == nil then
  2054.         curassistant_table[hash] = assistant_table[hash]
  2055.     end
  2056.  
  2057.     if curcq_table[hash] == nil then
  2058.         curcq_table[hash] = cq_table[hash]
  2059.     end
  2060.  
  2061.     if curcrackshot_table[hash] == nil then
  2062.         curcrackshot_table[hash] = crackshot_table[hash]
  2063.     end
  2064.  
  2065.     if curgrenadier_table[hash] == nil then
  2066.         curgrenadier_table[hash] = grenadier_table[hash]
  2067.     end
  2068.  
  2069.     if curheavy_table[hash] == nil then
  2070.         curheavy_table[hash] = heavy_table[hash]
  2071.     end
  2072.  
  2073.     if curjack_table[hash] == nil then
  2074.         curjack_table[hash] = jack_table[hash]
  2075.     end
  2076.  
  2077.     if curmobileasset_table[hash] == nil then
  2078.         curmobileasset_table[hash] = mobileasset_table[hash]
  2079.     end
  2080.  
  2081.     if curmultikillcom_table[hash] == nil then
  2082.         curmultikillcom_table[hash] = multikillcom_table[hash]
  2083.     end
  2084.  
  2085.     if currearadmiral_table[hash] == nil then
  2086.         currearadmiral_table[hash] = rearadmiral_table[hash]
  2087.     end
  2088.  
  2089.     if cursidearm_table[hash] == nil then
  2090.         cursidearm_table[hash] = sidearm_table[hash]
  2091.     end
  2092.  
  2093.     if curtrigger_table[hash] == nil then
  2094.         curtrigger_table[hash] = trigger_table[hash]
  2095.     end
  2096.  
  2097.     if credits_table[hash] == nil then
  2098.         credits_table[hash] = 0
  2099.     end
  2100.  
  2101. end
  2102.  
  2103. function NewGameTimer(id, userdata, count)
  2104.  
  2105.     if count == 5 then
  2106.         game_started = true
  2107.         return 0
  2108.     else
  2109.         return 1
  2110.     end
  2111.  
  2112. end
  2113.  
  2114. function round(what, precision)
  2115.    return math.floor(what*math.pow(10,precision)+0.5) / math.pow(10,precision)
  2116. end
  2117.  
  2118. function comma_value(n)
  2119.     local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
  2120.     return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
  2121. end
Advertisement
Add Comment
Please, Sign In to add comment