LUA 164
V1+ Commands Script 2.3 By xdedeone on 26th February 2019 07:13:58 PM
  1. --require "mylanes"
  2.  
  3. -- create the communication channel
  4. --linda = lanes.linda()
  5.  
  6. -- How many messages can be sent within a specified amount of time
  7. -- My recommendation: 7 is best, unless you want a server with hardly any talking
  8. spam_max = 7
  9.  
  10. -- How long the person will be muted for spamming (in seconds)
  11. spam_timeout = 60
  12. -- Don't modify the below variables unless you're a skilled and
  13. -- experienced scripter, and you're sure you know what your doing.
  14. rtv_timeout = 1
  15. script_check = 0
  16. cur_players = 0
  17. rtv_initiated = 0
  18. admin_table = {}
  19. mute_table = {}
  20. suspend_table = {}
  21. bos_table = {}
  22. boslog_table = {}
  23. name_bans = {}
  24. access_table = {}
  25. rtv_table = {}
  26. votekick_table = {}
  27. votekicktimeout_table = {}
  28. spam_table = {}
  29. spamtimeout_table = {}
  30. ghost_table = {}
  31. time_passed = 0 -- Initialize time_passed to 0 seconds
  32. mode = {}
  33. hidden = {}
  34. follow = {}
  35. objspawntype = {}
  36. objspawntag = {}
  37. afk = {}
  38. ipadmins = {}
  39. Noweapons = {}
  40. global_rcons = {}
  41. unique_table = {}
  42. nukes = {}
  43.  
  44. vehicle_drone_table = {}
  45. loc = {}
  46. control_table = {}
  47. Object_table = {}
  48. id = 0
  49. message_table = {}
  50. Chat = 0
  51. timer_started = 0
  52. message_delay = 3
  53. uniques = 0
  54.  
  55. ip_banlist = {}
  56. mute_banlist = {}
  57. ip_table = {}
  58.  
  59. --Objects Table (for handling purposes)
  60. objects = {}
  61.  
  62.         -- Bipeds
  63. objects[1] = {"cyborg", "bipd", "characters\\cyborg_mp\\cyborg_mp"}
  64.  
  65.         -- Equipment
  66. objects[2] = {"camo", "eqip", "powerups\\active camouflage"}
  67. objects[3] = {"health", "eqip", "powerups\\health pack"}
  68. objects[4] = {"overshield", "eqip", "powerups\\over shield"}
  69. objects[5] = {"fnade", "eqip", "weapons\\frag grenade\\frag grenade"}
  70. objects[6] = {"pnade", "eqip", "weapons\\plasma grenade\\plasma grenade"}
  71.  
  72.         -- Vehicles
  73. objects[7] = {"shee", "vehi", "vehicles\\banshee\\banshee_mp"}
  74. objects[8] = {"turret", "vehi", "vehicles\\c gun turret\\c gun turret_mp"}
  75. objects[9] = {"ghost", "vehi", "vehicles\\ghost\\ghost_mp"}
  76. objects[10] = {"rhog", "vehi", "vehicles\\rwarthog\\rwarthog"}
  77. objects[11] = {"tank", "vehi", "vehicles\\scorpion\\scorpion_mp"}
  78. objects[12] = {"hog", "vehi", "vehicles\\warthog\\mp_warthog"}
  79.  
  80.         -- Weapons
  81. objects[13] = {"rifle", "weap", "weapons\\assault rifle\\assault rifle"}
  82. objects[14] = {"ball", "weap", "weapons\\ball\\ball"}
  83. objects[15] = {"flag", "weap", "weapons\\flag\\flag"}
  84. objects[16] = {"flamethrower", "weap", "weapons\\flamethrower\\flamethrower"}
  85. objects[17] = {"needler", "weap", "weapons\\needler\\mp_needler"}
  86. objects[18] = {"pistol", "weap", "weapons\\pistol\\pistol"}
  87. objects[19] = {"ppistol", "weap", "weapons\\plasma pistol\\plasma pistol"}
  88. objects[20] = {"prifle", "weap", "weapons\\plasma rifle\\plasma rifle"}
  89. objects[21] = {"frg", "weap", "weapons\\plasma_cannon\\plasma_cannon"}
  90. objects[22] = {"rocket", "weap", "weapons\\rocket launcher\\rocket launcher"}
  91. objects[23] = {"shotgun", "weap", "weapons\\shotgun\\shotgun"}
  92. objects[24] = {"sniper", "weap", "weapons\\sniper rifle\\sniper rifle"}
  93.  
  94.         -- Projectiles
  95. objects[25] = {"sheebolt", "proj", "vehicles\\banshee\\banshee bolt"}
  96. objects[26] = {"sheerod", "proj", "vehicles\\banshee\\mp_banshee fuel rod"}
  97. objects[27] = {"turretbolt", "proj", "vehicles\\c gun turret\\mp gun turret"}
  98. objects[28] = {"ghostbolt", "proj", "vehicles\\ghost\\ghost bolt"}
  99. objects[29] = {"tankshot", "proj", "vehicles\\scorpion\\bullet"}
  100. objects[30] = {"tankshell", "proj", "vehicles\\scorpion\\tank shell"}
  101. objects[31] = {"hogshot", "proj", "vehicles\\warthog\\bullet"}
  102. objects[32] = {"rifleshot", "proj", "weapons\\assault rifle\\bullet"}
  103. objects[33] = {"flame", "proj", "weapons\\flamethrower\\flame"}
  104. objects[34] = {"needlershot", "proj", "weapons\\needler\\mp_needle"}
  105. objects[35] = {"pistolshot", "proj", "weapons\\pistol\\bullet"}
  106. objects[36] = {"ppistolbolt", "proj", "weapons\\plasma pistol\\bolt"}
  107. objects[37] = {"priflebolt", "proj", "weapons\\plasma rifle\\bolt"}
  108. objects[38] = {"priflecbolt", "proj", "weapons\\plasma rifle\\charged bolt"}
  109. objects[39] = {"rocketproj", "proj", "weapons\\rocket launcher\\rocket"}
  110. objects[40] = {"shottyshot", "proj", "weapons\\shotgun\\pellet"}
  111. objects[41] = {"snipershot", "proj", "weapons\\sniper rifle\\sniper bullet"}
  112.  
  113. -- if a command is not in this list, whenever a person executes that command, it
  114. -- will say Invalid Command.
  115. commands_table = {
  116.         "/a",
  117.         "/ipadminadd",
  118.         "/ipadmindel",
  119.         "/afk",
  120.         "/alias",
  121.         "/ammo",
  122.         "/b",
  123.         "/bos",
  124.         "/boslist",
  125.         "/banlist",
  126.         "/balance",
  127.         "/deathless",
  128.         "/commands",
  129.         "/count",
  130.         "/c",
  131.         "/e",
  132.         "/crash",
  133.         "/eject",
  134.         "/enter",
  135.         "/falldamage",
  136.         "/getloc",
  137.         "/godmode",
  138.         "/getip",
  139.         "/hax",
  140.         "/heal",
  141.         "/hitler",
  142.         "/infammo",
  143.         "/give",
  144.         "/gethash",
  145.         "/ghost",
  146.         "/hide",
  147.         "/invis",
  148.         "/info",
  149.         "/ipban",
  150.         "/ipbanlist",
  151.         "/ipunban",
  152.         "/j",
  153.         "/k",
  154.         "/kill",
  155.         "/lo3",
  156.         "/launch",
  157.         "/write",
  158.         "/m",
  159.         "/mc",
  160.         "/mnext",
  161.         "/mute",
  162.         "/nuke",
  163.         "/textban",
  164.         "/textbanlist",
  165.         "/textunban",
  166.         "/noweapons",
  167.         "/nameban",
  168.         "/namebanlist",
  169.         "/nameunban",
  170.         "/os",
  171.         "/privatesay",
  172.         "/pl",
  173.         "/reset",
  174.         "/resp",
  175.         "/revoke",
  176.         "/resetweapons",
  177.         "/say",
  178.         "/setassists",
  179.         "/setcolor",
  180.         "/setdeaths",
  181.         "/setfrags",
  182.         "/setkills",
  183.         "/setmode",
  184.         "/setname",
  185.         "/setresp",
  186.         "/setscore",
  187.         "/setplasmas",
  188.         "/spd",
  189.         "/spawn",
  190.         "/specs",
  191.         "/st",
  192.         "/superban",
  193.         "/suspend",
  194.         "/t",
  195.         "/timelimit",
  196.         "/takeweapons",
  197.         "/tp",
  198.         "/ts",
  199.         "/unban",
  200.         "/unbos",
  201.         "/unhide",
  202.         "/unghost",
  203.         "/ungod",
  204.         "/unhax",
  205.         "/uninvis",
  206.         "/unmute",
  207.         "/unsuspend",
  208.         "/viewadmins",
  209.         "/version"
  210. }
  211.  
  212. function GetRequiredVersion()
  213.         return 10057
  214. end
  215.  
  216. function OnScriptLoad(process)
  217.         processid = process
  218.         if script_check == 0 then
  219.  
  220.                 local file = io.open("temp_" .. tostring(process) .. ".tmp", "r")
  221.  
  222.                 if file and process then
  223.                         registertimer(0, "DefaultSvTimer", "temp_" .. process .. ".tmp")
  224.                         file:close()
  225.                 else
  226.                         registertimer(0, "DefaultSvTimer", "defaults.txt")
  227.                 end
  228.  
  229.                 game = GetGameAddresses()
  230.                 --registertimer(500, "ChangeVersion")
  231.  
  232.                 --[[workerTemplate = lanes.gen("*", {["globals"] = _G}, WorkerThread)
  233.                 worker = workerTemplate()--]]
  234.  
  235.                 gametype = readbyte(gametype_base + 0x30, 0x0)
  236.                 writeword(special_chars, 0x0, 0x9090) -- special chars in servername patch
  237.                 writeword(gametype_patch, 0x0, 0xEB) -- gametype patch
  238.                 writeword(devmode_patch1, 0x0, 0x9090) -- devmode
  239.                 writeword(devmode_patch2, 0x0, 0x9090) -- devmode
  240.                 --registertimer(0, "CCTimer")
  241.  
  242.                 spamtimer = registertimer(970, "SpamTimer")
  243.                 maintimer = registertimer(20, "MainTimer")
  244.                 hprinter = registertimer(334, "HprintTimer")
  245.                 --checkworker = registertimer(100, "CheckWorker")
  246.  
  247.                 profilepath = getprofilepath()
  248.  
  249.                 for i=0,15 do
  250.                         if getplayer(i) then
  251.                                 cur_players = cur_players + 1
  252.                                 ip_table[resolveplayer(i)] = getip(i)
  253.                                 messages[gethash(i)] = {}
  254.                         end
  255.                         vehicle_drone_table[i] = {}
  256.                         afk[i+1] = {}
  257.                         loc[i+1] = {}
  258.                         control_table[i+1] = {}
  259.                 end
  260.  
  261.                 local file = io.open(string.format("%s\\ipbanlist.txt", profilepath), "r")
  262.                 if file then
  263.                         for line in file:lines() do
  264.                                 local words = {}
  265.                                 local count = gettokencount(line, ",")
  266.                                 for i = 1,count do
  267.                                         local word = gettoken(line, ",", i - 1)
  268.                                         table.insert(words, word)
  269.                                 end
  270.                                 ip_banlist[tostring(words[1])] = words[2]
  271.                         end
  272.                         file:close()
  273.                 end
  274.  
  275.                 local file = io.open(string.format("%s\\textbanlist.txt", profilepath), "r")
  276.                 if file then
  277.                         for line in file:lines() do
  278.                                 local words = {}
  279.                                 local count = gettokencount(line, ",")
  280.                                 for i = 1,count do
  281.                                         local word = gettoken(line, ",", i - 1)
  282.                                         table.insert(words, word)
  283.                                 end
  284.                                 mute_banlist[tostring(words[1])] = {words[2], words[3]}
  285.                         end
  286.                         file:close()
  287.                 end
  288.  
  289.                 local file = io.open(string.format("%s\\namebans.txt", profilepath), "r")
  290.                 if file then
  291.                         for line in file:lines() do
  292.                                 local words = {}
  293.                                 local count = gettokencount(line, ",")
  294.                                 for i = 1,count do
  295.                                         local word = gettoken(line, ",", i - 1)
  296.                                         table.insert(name_bans, word)
  297.                                 end
  298.                         end
  299.                         file:close()
  300.                 end
  301.  
  302.                 WriteChangeLog()
  303.                 local file = io.open(string.format("%s\\admin.txt", profilepath), "r")
  304.                 if (file ~= nil) then
  305.                         for line in file:lines() do
  306.                                 local words = {}
  307.                                 local count = gettokencount(line, ",")
  308.                                 for i = 1,count do
  309.                                         local word = gettoken(line, ",", i - 1)
  310.                                         table.insert(words, tostring(word))
  311.                                 end
  312.                                 if count >= 3 then
  313.                                         if not admin_table then admin_table = {} end
  314.                                         if not admin_table[words[2]] then admin_table[words[2]] = {} end
  315.                                         admin_table[words[2]].name = words[1]
  316.                                         admin_table[words[2]].level = words[3]
  317.                                 end
  318.                                 if count == 4 and tonumber(words[3]) then
  319.                                         if not ipadmins[words[4]] then ipadmins[words[4]] = {} end
  320.                                         ipadmins[words[4]].name = words[1]
  321.                                         ipadmins[words[4]].level = words[3]
  322.                                 end
  323.                         end
  324.                         file:close()
  325.                 end
  326.  
  327.                 local file = io.open(string.format("%s\\admins.txt", profilepath), "r")
  328.                 if (file ~= nil) then
  329.                         for line in file:lines() do
  330.                                 local words = {}
  331.                                 local count = gettokencount(line, ",")
  332.                                 for i = 1,count do
  333.                                         local word = gettoken(line, ",", i - 1)
  334.                                         table.insert(words, tostring(word))
  335.                                 end
  336.                                 if not admin_table[words[2]] then admin_table[words[2]] = {} end
  337.                                 admin_table[words[2]].name = words[1]
  338.                                 admin_table[words[2]].level = words[3]
  339.                                 if count == 4 and tonumber(words[3]) then
  340.                                         if not ipadmins[words[4]] then ipadmins[words[4]] = {} end
  341.                                         ipadmins[words[4]].name = words[1]
  342.                                         ipadmins[words[4]].level =words[3]
  343.                                 end
  344.                         end
  345.                         file:close()
  346.                 end
  347.  
  348.                 local file = io.open(string.format("%s\\ipadmins.txt", profilepath), "r")
  349.                 if (file ~= nil) then
  350.                         for line in file:lines() do
  351.                                 local words = {}
  352.                                 local count = gettokencount(line, ",")
  353.                                 for i = 1,count do
  354.                                         local word = gettoken(line, ",", i - 1)
  355.                                         table.insert(words, tostring(word))
  356.                                 end
  357.                                 if count == 3 and tonumber(words[3]) then
  358.                                         if not ipadmins[words[2]] then ipadmins[words[2]] = {} end
  359.                                         ipadmins[words[2]].level = words[3]
  360.                                         ipadmins[words[2]].name = words[1]
  361.                                 end
  362.                         end
  363.                         file:close()
  364.                 end
  365.  
  366.  
  367.                 local file = io.open(string.format("%s\\uniques.txt", profilepath), "r")
  368.                 if file then
  369.                         for line in file:lines() do
  370.                                 local words = {}
  371.                                 local count = gettokencount(line, ",")
  372.                                 for i = 1,count do
  373.                                         local word = gettoken(line, ",", i - 1)
  374.                                         table.insert(words, word)
  375.                                 end
  376.                                 if count == 3 then
  377.                                         local name = words[1]
  378.                                         local hash = words[2]
  379.                                         local ip = words[3]
  380.                                         unique_table[name] = {hash, ip}
  381.                                         uniques = uniques + 1
  382.                                 end
  383.                         end
  384.                         file:close()
  385.                 end
  386.  
  387.                 local file = io.open(string.format("%s\\access.ini", profilepath), "r")
  388.  
  389.                 if (file ~= nil) then
  390.                         local j
  391.                         for line in file:lines() do
  392.                                 if j == nil then
  393.                                         local start = string.sub(line, 2, 2)
  394.                                         j = tonumber(start)
  395.                                         if j == nil then break end
  396.                                 else
  397.                                         if string.sub(line, 1, 1) ~= "[" then
  398.                                                 local count = gettokencount(line, ",")
  399.                                                 local commands = string.sub(line, 6, line:len())
  400.                                                 for i = 0,count-1 do
  401.                                                         local word = gettoken(commands, ",", i)
  402.                                                         if word == "-1" then access_table[j] = -1 break end
  403.                                                         if access_table[j] == nil then
  404.                                                                 access_table[j] = "," .. word
  405.                                                         else
  406.                                                                 access_table[j] = access_table[j] .. "," .. word
  407.                                                         end
  408.                                                 end
  409.                                                 j = j + 1
  410.                                         end
  411.                                 end
  412.                         end
  413.  
  414.                         file:close()
  415.  
  416.                         AccessMerging()
  417.                 else -- access file doesn't exist, create it.
  418.                         file = io.open(profilepath .. "\\access.ini", "w")
  419.                         file:write("[0]\n")
  420.                         file:write("data=-1")
  421.                         access_table[0] = -1
  422.                         file:close()
  423.                 end
  424.  
  425.                 local file = io.open(string.format("%s\\files\\rtv.txt", profilepath), "r")
  426.  
  427.                 if (file ~= nil) then
  428.                         rtv_initiated = tonumber(file:read("*line"))
  429.                         file:close()
  430.                 end
  431.  
  432.                 if rtv_initiated < 0 then
  433.  
  434.                         local file = io.open(string.format("%s\\files\\rtv.txt", profilepath), "w+")
  435.  
  436.                         if (file ~= nil) then
  437.                                 file:write(rtv_initiated + 1)
  438.                                 file:close()
  439.                         end
  440.  
  441.                 end
  442.  
  443.                 local file = io.open(string.format("%s\\files\\bos.txt", profilepath), "r")
  444.  
  445.                 if (file ~= nil) then
  446.  
  447.                         for line in file:lines() do
  448.  
  449.                                 local words = {}
  450.  
  451.                                 local count = gettokencount(line, ",")
  452.  
  453.                                 for i = 1,count do
  454.                                         local word = gettoken(line, ",", i-1)
  455.                                         table.insert(words, word)
  456.                                 end
  457.  
  458.                                 local name = words[1]
  459.                                 local hash = words[2]
  460.                                 local ip = words[3]
  461.  
  462.                                 name = name:gsub(" ", "", 1)
  463.  
  464.                                 table.insert(boslog_table, name .. "," .. hash .. "," .. ip)
  465.  
  466.                         end
  467.  
  468.                         file:close()
  469.  
  470.                 end
  471.  
  472.                 table.sort(boslog_table)
  473.  
  474.                 registertimer(0, "deleteadmins")
  475.  
  476.         end
  477.  
  478.         script_check = 1
  479.  
  480. end
  481.  
  482. function deleteadmins(id, count)
  483.         local file = io.open(profilepath .. '\\admin.txt', "r")
  484.         if file then
  485.                 for line in file:lines() do
  486.                         svcmd("sv_admin_del " .. 1)
  487.                 end
  488.         end
  489.         sv_admin_del = true
  490.         return 0
  491. end
  492.  
  493. function CCTimer(id, count)
  494.         --cmp byte ptr [005DF847],33
  495.         --[[writebyte(0x2420000, 0x0, 0x80) -- cmp
  496.         writebyte(0x2420000, 0x1, 0x3D) -- byte ptr
  497.         writedword(0x2420000, 0x2, 0x47F85D00) -- [005DF847]
  498.         writebyte(0x2420000, 0x6, 0x33) -- ,33
  499.         --jne 0242001F
  500.         writebyte(0x2420007, 0x0, 0x75) -- jne
  501.         writebyte(0x2420007, 0x1, 0x16) -- 0242001F
  502.         --mov [005DF847],00002E34
  503.         writebyte(0x2420009, 0x0, 0xC7) -- mov
  504.         writebyte(0x2420009, 0x1, 0x5) -- [005DF847]
  505.         writedword(0x2420009, 0x2, 0x47F85D00) -- [005DF847]
  506.         writedword(0x2420009, 0x6, 0x342E0000) -- ,00002E34
  507.         --mov [005DF849],37303630
  508.         writebyte(0x2420013, 0x0, 0xC7) -- mov
  509.         writebyte(0x2420013, 0x1, 0x5) -- [005DF849]
  510.         writedword(0x2420013, 0x2, 0x49F85D00) -- [005DF849]
  511.         writedword(0x2420013, 0x6, 0x37303630) -- ,37303630
  512.         --jmp 02420052
  513.         writebyte(0x242001D, 0x0, 0xEB) -- jmp
  514.         writebyte(0x242001D, 0x1, 0x33) -- 02420052
  515.         --cmp byte ptr [005DF847],34
  516.         writebyte(0x242001F, 0x0, 0x80) -- cmp
  517.         writebyte(0x242001F, 0x1, 0x3D) -- byte ptr
  518.         writedword(0x242001F, 0x2, 0x47F85D00) -- [005DF847]
  519.         writebyte(0x242001F, 0x6, 0x34) -- ,34
  520.         --jne 0242003E
  521.         writebyte(0x2420026, 0x0, 0x75) -- jne
  522.         writebyte(0x2420026, 0x1, 0x16) -- 0242003E
  523.         --mov [005DF847],00002E38
  524.         writebyte(0x2420028, 0x0, 0xC7) -- mov
  525.         writebyte(0x2420028, 0x1, 0x5) -- [005DF847]
  526.         writedword(0x2420028, 0x2, 0x47F85D00) -- [005DF847]
  527.         writedword(0x2420028, 0x6, 0x382E0000) -- ,00002E38
  528.         --mov [005DF849],37303630
  529.         writebyte(0x2420032, 0x0, 0xC7) -- mov
  530.         writebyte(0x2420032, 0x1, 0x5) -- [005DF849]
  531.         writedword(0x2420032, 0x2, 0x49F85D00) -- [005DF849]
  532.         writedword(0x2420032, 0x6, 0x30363136) -- ,37303630
  533.         --jmp 02420052
  534.         writebyte(0x242003C, 0x0, 0xEB) -- jmp
  535.         writebyte(0x242003C, 0x1, 0x14) -- 02420052
  536.         --mov [005DF847],00002E33
  537.         writebyte(0x242003E, 0x0, 0xC7) -- mov
  538.         writebyte(0x242003E, 0x1, 0x5) -- [005DF847]
  539.         writedword(0x242003E, 0x2, 0x47F85D00) -- [005DF847]
  540.         writedword(0x242003E, 0x6, 0x332E0000)
  541.         --mov [005DF849],35303630
  542.         writebyte(0x2420048, 0x0, 0xC7)
  543.         writebyte(0x2420048, 0x1, 0x5)
  544.         writedword(0x2420048, 0x2, 0x49F85D00)
  545.         writedword(0x2420048, 0x6, 0x30363136)
  546.         --mov ecx,[005DF840] : ["01.00.03.0605"]
  547.         writebyte(0x2420052, 0x0, 0x8B)
  548.         writebyte(0x2420052, 0x1, 0xD)
  549.         writedword(0x2420052, 0x2, 0x40F85D00)
  550.         --jmp 0058E386
  551.         writebyte(0x2420058, 0x0, 0xE9)
  552.         writedword(0x2420058, 0x1, 0x29E316FE)
  553.  
  554.         --jmp to the codecave here:
  555.         --jmp 02420000
  556.         writebyte(0x58E380, 0x0, 0xE9) -- jmp
  557.         writedword(0x58E380, 0x1, 0x7B1CE901) -- 02420000
  558.         writebyte(0x58E385, 0x0, 0x90) -- nop
  559.         writedword(0x5992DE, 0x0, 0xFFFFFFFF)--]]
  560.         writebyte(0x2420000, 0x1, 0x3D) -- byte ptr
  561.         writedword(0x2420000, 0x2, 0x47F85D00) -- [005DF847]
  562.         writebyte(0x2420000, 0x6, 0x33) -- ,33
  563.         --jne 0242001F
  564.         writebyte(0x2420007, 0x0, 0x75) -- jne
  565.         writebyte(0x2420007, 0x1, 0x16) -- 0242001F
  566.         --mov [005DF847],00002E34
  567.         writebyte(0x2420009, 0x0, 0xC7) -- mov
  568.         writebyte(0x2420009, 0x1, 0x5) -- [005DF847]
  569.         writedword(0x2420009, 0x2, 0x47F85D00) -- [005DF847]
  570.         writedword(0x2420009, 0x6, 0x342E0000) -- ,00002E34
  571.         --mov [005DF849],37303630
  572.         writebyte(0x2420013, 0x0, 0xC7) -- mov
  573.         writebyte(0x2420013, 0x1, 0x5) -- [005DF849]
  574.         writedword(0x2420013, 0x2, 0x49F85D00) -- [005DF849]
  575.         writedword(0x2420013, 0x6, 0x37303630) -- ,37303630
  576.         --jmp 02420052
  577.         writebyte(0x242001D, 0x0, 0xEB) -- jmp
  578.         writebyte(0x242001D, 0x1, 0x33) -- 02420052
  579.         --cmp byte ptr [005DF847],34
  580.         writebyte(0x242001F, 0x0, 0x80) -- cmp
  581.         writebyte(0x242001F, 0x1, 0x3D) -- byte ptr
  582.         writedword(0x242001F, 0x2, 0x47F85D00) -- [005DF847]
  583.         writebyte(0x242001F, 0x6, 0x34) -- ,34
  584.         --jne 0242003E
  585.         writebyte(0x2420026, 0x0, 0x75) -- jne
  586.         writebyte(0x2420026, 0x1, 0x16) -- 0242003E
  587.         --mov [005DF847],00002E38
  588.         writebyte(0x2420028, 0x0, 0xC7) -- mov
  589.         writebyte(0x2420028, 0x1, 0x5) -- [005DF847]
  590.         writedword(0x2420028, 0x2, 0x47F85D00) -- [005DF847]
  591.         writedword(0x2420028, 0x6, 0x382E0000) -- ,00002E38
  592.         --mov [005DF849],37303630
  593.         writebyte(0x2420032, 0x0, 0xC7) -- mov
  594.         writebyte(0x2420032, 0x1, 0x5) -- [005DF849]
  595.         writedword(0x2420032, 0x2, 0x49F85D00) -- [005DF849]
  596.         writedword(0x2420032, 0x6, 0x30363136) -- ,37303630
  597.         --jmp 02420052
  598.         writebyte(0x242003C, 0x0, 0xEB) -- jmp
  599.         writebyte(0x242003C, 0x1, 0x14) -- 02420052
  600.         --mov [005DF847],00002E33
  601.         writebyte(0x242003E, 0x0, 0xC7) -- mov
  602.         writebyte(0x242003E, 0x1, 0x5) -- [005DF847]
  603.         writedword(0x242003E, 0x2, 0x47F85D00) -- [005DF847]
  604.         writedword(0x242003E, 0x6, 0x332E0000)
  605.         --mov [005DF849],35303630
  606.         writebyte(0x2420048, 0x0, 0xC7)
  607.         writebyte(0x2420048, 0x1, 0x5)
  608.         writedword(0x2420048, 0x2, 0x49F85D00)
  609.         writedword(0x2420048, 0x6, 0x30363136)
  610.         --mov ecx,[005DF840] : ["01.00.03.0605"]
  611.         writebyte(0x2420052, 0x0, 0x8B)
  612.         writebyte(0x2420052, 0x1, 0xD)
  613.         writedword(0x2420052, 0x2, 0x40F85D00)
  614.         --jmp 0058E386
  615.         writebyte(0x2420058, 0x0, 0xE9)
  616.         writedword(0x2420058, 0x1, 0x29E316FE)
  617.  
  618.         --jmp to the codecave here:
  619.         --jmp 02420000
  620.         writebyte(0x58E380, 0x0, 0xE9) -- jmp
  621.         writedword(0x58E380, 0x1, 0x7B1CE901) -- 02420000
  622.         writebyte(0x58E385, 0x0, 0x90) -- nop
  623.         return 0
  624. end
  625.  
  626. function OnScriptUnload()
  627.  
  628.         local file = io.open(profilepath .. "//files//bos.txt", "w")
  629.  
  630.         if file then
  631.  
  632.                 for k,v in pairs(boslog_table) do
  633.                         if v then
  634.                                 file:write(v .. "\n")
  635.                         end
  636.                 end
  637.  
  638.                 file:close()
  639.  
  640.         end
  641.  
  642.         local file = io.open(profilepath .. "\\ipadmins.txt", "w")
  643.         for k,v in pairs(ipadmins) do
  644.                 file:write(tostring(ipadmins[k].name) .. "," .. tostring(k) .. "," .. tostring(ipadmins[k].level) .. "\n")
  645.         end
  646.         file:close()
  647.  
  648.         local file = io.open(profilepath .. "\\admins.txt", "w")
  649.         for k,v in pairs(admin_table) do
  650.                 file:write(tostring(admin_table[k].name) .. "," .. tostring(k) .. "," .. tostring(admin_table[k].level) .. "\n")
  651.         end
  652.         file:close()
  653.  
  654.         local file = io.open(profilepath .. "\\uniques.txt", "w")
  655.         for k,v in pairs(unique_table) do
  656.                 local line = k .. "," .. v[1] .. "," .. v[2]
  657.                 file:write(tostring(line) .. "\n")
  658.         end
  659.         file:close()
  660.  
  661.         local file = io.open("temp_" .. tostring(processid) .. ".tmp", "w")
  662.         if deathless then
  663.                 file:write("sv_deathless 1\n")
  664.         else
  665.                 file:write("sv_deathless 0\n")
  666.         end
  667.         if respset then
  668.                 file:write("sv_respawn_time " .. tostring(resptime) .."\n")
  669.         else
  670.                 file:write("sv_respawn_time default\n")
  671.         end
  672.         if infammo then
  673.                 file:write("sv_infinite_ammo 1\n")
  674.         else
  675.                 file:write("sv_infinite_ammo 0\n")
  676.         end
  677.         if rockthevote then
  678.                 file:write("sv_rtv_enabled true\n")
  679.         else
  680.                 file:write("sv_rtv_enabled false\n")
  681.         end
  682.         if rtv_required then
  683.                 file:write("sv_rtv_needed " .. tostring(rtv_required) .. "\n")
  684.         end
  685.         if votekick_allowed then
  686.                 file:write("sv_votekick_enabled true\n")
  687.         else
  688.                 file:write("sv_votekick_enabled false\n")
  689.         end
  690.         if votekick_required then
  691.                 file:write("sv_votekick_needed " .. tostring(votekick_required) .. "\n")
  692.         end
  693.         if votekick_action then
  694.                 file:write("sv_votekick_action " .. tostring(votekick_action) .. "\n")
  695.         end
  696.         if Version then
  697.                 file:write("sv_version " .. string.sub(tostring(Version), 7, 8) .. "\n")
  698.         else
  699.                 file:write("sv_version 1.09\n")
  700.         end
  701.         if version_check then
  702.                 file:write("sv_version_check true\n")
  703.         else
  704.                 file:write("sv_version_check false\n")
  705.         end
  706.         if hash_check then
  707.                 file:write("sv_hash_check true\n")
  708.         else
  709.                 file:write("sv_hash_check false\n")
  710.         end
  711.         if noweapons then
  712.                 file:write("sv_noweapons true\n")
  713.         else
  714.                 file:write("sv_noweapons false\n")
  715.         end
  716.         if falldamage then
  717.                 file:write("sv_falldamage true")
  718.         else
  719.                 file:write("sv_falldamage false")
  720.         end
  721.         file:close()
  722.  
  723.         for i = 0,15 do
  724.                 cleanupdrones(i)
  725.         end
  726.  
  727. end
  728.  
  729. function OnNewGame(Mapname)
  730.         map = Mapname
  731. end
  732.  
  733. function OnGameEnd(mode)
  734.  
  735.         if mode == 1 then
  736.                 if maintimer then
  737.                         removetimer(maintimer)
  738.                 end
  739.                 if spamtimer then
  740.                         removetimer(spamtimer)
  741.                 end
  742.                 if rtvtimer then
  743.                         removetimer(rtvtimer)
  744.                 end
  745.                 if votekicktimer then
  746.                         removetimer(votekicktimer)
  747.                 end
  748.                 if testtimer then
  749.                         removetimer(testtimer)
  750.                 end
  751.                 rtv_initiated = -1
  752.                 votekick_allowed = false
  753.                 for i = 0,15 do
  754.                         cleanupdrones(i)
  755.                 end
  756.         elseif mode == 2 then
  757.                 say("This has been made possible by Phasor.")
  758.                 say("http://phasor.proboards.com!")
  759.         elseif mode == 3 then
  760.  
  761.                 local file = io.open(profilepath .. "//files//bos.txt", "w")
  762.  
  763.                 if file then
  764.  
  765.                         for k,v in pairs(boslog_table) do
  766.                                 if v then
  767.                                         file:write(v .. "\n")
  768.                                 end
  769.                         end
  770.  
  771.                         file:close()
  772.  
  773.                 end
  774.  
  775.                 if hprinter then
  776.                         removetimer(hprinter)
  777.                 end
  778.  
  779.         end
  780.  
  781. end
  782.  
  783. function OnServerChat(player, chattype, message)
  784.         local AllowChat = 1
  785.         local count = gettokencount(message, " ")
  786.         local t = {}
  787.         local name = getname(player)
  788.         local hash = gethash(player)
  789.         local ip = getip(player)
  790.         local access
  791.  
  792.         for k,v in pairs(mute_banlist) do
  793.                 for k2,v2 in pairs(mute_banlist[k]) do
  794.                         if mute_banlist[k][k2] == hash or mute_banlist[k][k2] == ip then
  795.                                 return 0
  796.                         end
  797.                 end
  798.         end
  799.  
  800.         if mute_table[hash] then
  801.                 return 0
  802.         end
  803.  
  804.         if spamtimeout_table[hash] then
  805.                 return 0
  806.         end
  807.  
  808.         for i=1,count do
  809.                 local word = gettoken(message, " ", i - 1)
  810.                 word = string.lower(word)
  811.                 table.insert(t, word)
  812.         end
  813.  
  814.         if t[1] == "rtv" then
  815.                 if count == 1 and rockthevote then
  816.                         if rtv_initiated >= 0 then
  817.  
  818.                                 local rtv_count = 0
  819.                                 local rtv_number = round(cur_players * rtv_required, 0)
  820.                                 for i = 0,15 do
  821.  
  822.                                         local hash2 = gethash(i)
  823.  
  824.                                         if getplayer(i) then
  825.                                                 if rtv_table[hash2] == 1 then
  826.                                                         rtv_count = rtv_count + 1
  827.                                                 end
  828.                                         end
  829.  
  830.                                 end
  831.                                 if rtv_count == 0 then
  832.                                         rtv_initiated = 1
  833.                                         rtv_table[hash] = 1
  834.                                         rtv_count = rtv_count + 1
  835.                                         say(name .. " has initiated rtv!")
  836.                                         say("Type \"rtv\" to join the vote!")
  837.                                         rtvtimer = registertimer(120000, "rtvTimer")
  838.                                 else
  839.                                         if rtv_table[hash] == 1 then
  840.                                                 privatesay(player, "You have already voted for rtv!")
  841.                                         elseif rtv_table[hash] == nil then
  842.                                                 rtv_table[hash] = 1
  843.                                                 rtv_count = rtv_count + 1
  844.                                                 say(name .. " has voted for rtv!")
  845.                                                 say(rtv_count .. " of " .. rtv_number .. " votes required for rtv!")
  846.                                         end
  847.                                 end
  848.                                 local file = io.open(profilepath .. "//files//rtv.txt", "w")
  849.  
  850.                                 if file then
  851.                                         file:write(rtv_timeout)
  852.                                         file:close()
  853.                                 end
  854.                                 if rtv_count >= rtv_number then
  855.                                         removetimer(rtvtimer)
  856.                                         rtv_initiated = rtv_timeout
  857.                                         say("Enough votes for rtv, game is now ending...")
  858.                                         svcmd("sv_map_next")
  859.                                 end
  860.  
  861.                         else
  862.                                 privatesay(player, "You cannot initiate rtv at this time!")
  863.                         end
  864.  
  865.                         AllowChat = 0
  866.                 elseif count == 1 then
  867.                         privatesay(player, "Rockthevote is disabled.")
  868.                 end
  869.         elseif t[1] == "votekick" then
  870.                 if count == 2 then
  871.                         if votekick_allowed and votekicktimeout_table[hash] == nil then
  872.                                 local players = getvalidplayers(t[2], player)
  873.                                 if players then
  874.                                         for j = 1,#players do
  875.                                                 local votekick_count = 0
  876.                                                 local votekick_number = round(cur_players * votekick_required, 0)
  877.                                                 local player2 = players[j]
  878.                                                 local name2 = getname(players[j])
  879.                                                 local hash2 = gethash(players[j])
  880.                                                 local ip2 = getip(players[j])
  881.                                                 local admin
  882.  
  883.                                                 for i=0,15 do
  884.  
  885.                                                         if getplayer(i) then
  886.                                                                 if votekick_table[hash2] == 1 then
  887.                                                                         votekick_count = votekick_count + 1
  888.                                                                 end
  889.                                                         end
  890.  
  891.                                                 end
  892.  
  893.                                                 if hash2 then
  894.  
  895.                                                         if admin_table[hash2] or ipadmins[ip2] then
  896.                                                                 admin = true
  897.                                                                 break
  898.                                                         end
  899.  
  900.                                                         if not admin then
  901.                                                                 if player ~= player2 then
  902.                                                                         votekick_allowed = player2
  903.                                                                         votekick_table[hash] = 1
  904.                                                                         votekick_count = votekick_count + 1
  905.                                                                         say(name .. " has initiated a votekick on " .. name2 .. "!")
  906.                                                                         say("Type \"kick\" to join the vote!")
  907.                                                                         votekicktimer = registertimer(60000, 0, "votekickTimer")
  908.                                                                         votekicktimeout_table[hash] = 1
  909.                                                                 else
  910.                                                                         privatesay(player, "Invalid player!")
  911.                                                                 end
  912.                                                         else
  913.                                                                 privatesay(player, "Admins cannot be votekicked!")
  914.                                                         end
  915.  
  916.                                                 else
  917.                                                         privatesay(player, "Invalid player!")
  918.                                                 end
  919.  
  920.                                                 if votekick_count >= votekick_number then
  921.  
  922.                                                         for k,v in pairs(votekick_table) do
  923.                                                                 votekick_table[k] = nil
  924.                                                         end
  925.  
  926.                                                         removetimer(votekicktimer)
  927.                                                         votekick_allowed = true
  928.                                                         say("Kicking " .. name2 .. "!")
  929.                                                         if votekick_action == "ban" then
  930.                                                                 svcmd("sv_ban " .. players[j] .. " 5m")
  931.                                                         else
  932.                                                                 svcmd("sv_kick " .. players[j])
  933.                                                         end
  934.  
  935.                                                 end
  936.                                         end
  937.                                 else
  938.                                         privatesay(player, "Invalid player!")
  939.                                 end
  940.                         else
  941.                                 privatesay(player, "You cannot initiate a votekick at this time!")
  942.                         end
  943.  
  944.                         AllowChat = 0
  945.  
  946.                 end
  947.         elseif t[1] == "kick" then
  948.                 if count == 1 then
  949.  
  950.                         if votekick_allowed ~= true and votekick_allowed then
  951.  
  952.                                 local votekick_count = 0
  953.                                 local votekick_number = round(cur_players * votekick_required)
  954.                                 local name2 = getname(votekick_allowed)
  955.                                 local sv_player = resolveplayer(votekick_allowed)
  956.  
  957.                                 for i=0,15 do
  958.  
  959.                                         local hash2 = gethash(i)
  960.  
  961.                                         if hash2 then
  962.                                                 if votekick_table[hash2] == 1 then
  963.                                                         votekick_count = votekick_count + 1
  964.                                                 end
  965.                                         end
  966.  
  967.                                 end
  968.  
  969.                                 if player ~= votekick_allowed then
  970.                                         if votekick_table[hash] == 1 then
  971.                                                 privatesay(player, "You have already voted!")
  972.                                         elseif votekick_table[hash] == nil then
  973.                                                 votekick_table[hash] = 1
  974.                                                 votekick_count = votekick_count + 1
  975.                                                 say(name .. " has voted to kick " .. name2 .. "!")
  976.                                                 say(votekick_count .. " of " .. votekick_number .. " votes required to kick!")
  977.                                         end
  978.                                 else
  979.                                         privatesay(player, "You are not allowed to vote!")
  980.                                 end
  981.  
  982.                                 if votekick_count >= votekick_number then
  983.  
  984.                                         for k,v in pairs(votekick_table) do
  985.                                                 votekick_table[k] = nil
  986.                                         end
  987.  
  988.                                         removetimer(votekicktimer)
  989.                                         votekick_allowed = true
  990.                                         say("Kicking " .. name2 .. "!")
  991.                                         if votekick_action == "ban" then
  992.                                                 svcmd("sv_ban " .. sv_player .. " 5m")
  993.                                         else
  994.                                                 svcmd("sv_kick " .. sv_player)
  995.                                         end
  996.  
  997.                                 end
  998.  
  999.                         else
  1000.                                 privatesay(player, "A votekick has not been initiated!")
  1001.                         end
  1002.  
  1003.                         AllowChat = 0
  1004.  
  1005.                 end
  1006.         elseif string.sub(t[1], 1, 1) == "@" then
  1007.                 local receiverID = string.sub(t[1], 2, t[1]:len())
  1008.                 local players = getvalidplayers(receiverID, player)
  1009.                 if players then
  1010.                         for i = 1,#players do
  1011.                                 if player ~= players[i] then
  1012.                                         local sendernum = resolveplayer(player)
  1013.                                         local receivernum = resolveplayer(players[i])
  1014.                                         local privatemessage = table.concat(t, " ", 2, #t)
  1015.                                         hprint(player, "to " .. getname(players[i]) .. ": (" .. receivernum .. ") " .. privatemessage)
  1016.                                         hprint(players[i], getname(player) .. ": (" .. sendernum .. ") " .. privatemessage)
  1017.                                 end
  1018.                         end
  1019.                         privatesay(player, "Message Sent")
  1020.                 else
  1021.                         privatesay(player, "There is no player with an ID of " .. receiverID .. ".")
  1022.                 end
  1023.                 return 0
  1024.         end
  1025.  
  1026.         if admin_table[hash] then
  1027.                 access = tonumber(admin_table[hash].level)
  1028.         elseif ipadmins[ip] then
  1029.                 access = tonumber(ipadmins[ip].level)
  1030.         end
  1031.  
  1032.         if access then
  1033.                 if string.sub(t[1], 1, 1) == "/" then
  1034.                         AllowChat = 1
  1035.                 elseif string.sub(t[1], 1, 1) == "\\" then
  1036.                         AllowChat = 0
  1037.                 end
  1038.  
  1039.                 cmd = t[1]:gsub("\\", "/")
  1040.  
  1041.                 local found1 = cmd:find("/")
  1042.                 local found2 = cmd:find("/", 2)
  1043.                 local valid_command
  1044.                 local permission
  1045.  
  1046.                 if found1 and not found2 then
  1047.  
  1048.                         for k,v in pairs(commands_table) do
  1049.                                 if cmd == v then
  1050.                                         valid_command = true
  1051.                                         break
  1052.                                 end
  1053.                         end
  1054.  
  1055.                         if not valid_command then
  1056.                                 sendresponse("Invalid Command", t[1], player)
  1057.                         else
  1058.  
  1059.                                 local command_list = access_table[access]
  1060.                                 local command = cmd:gsub("/", "sv_")
  1061.  
  1062.                                 if command_list == -1 then
  1063.                                         permission = true
  1064.                                 else
  1065.                                         local found = command_list:find("," .. command .. ",")
  1066.  
  1067.                                         if found then
  1068.                                                 permission = true
  1069.                                         end
  1070.  
  1071.                                 end
  1072.                                 if permission then
  1073.                                         if cmd == "/a" and t[2] == "list" then
  1074.                                                 Command_ShowAdminList(player, t[1] .. " " .. t[2], count)
  1075.                                         elseif cmd == "/a" and t[2] == "del" then
  1076.                                                 Command_Admindel(player, t[1] .. " " .. t[2], t[3], count)
  1077.                                         elseif cmd == "/a" then
  1078.                                                 Command_Adminadd(player, t[1], t[2], t[3], t[4], count)
  1079.                                         elseif cmd == "/afk" then
  1080.                                                 Command_AFK(player, t[1], t[2], count)
  1081.                                         elseif cmd == "/ipadminadd" then
  1082.                                                 Command_Ipadminadd(player, t[1], t[2], t[3], t[4], count)
  1083.                                         elseif cmd == "/ipadmindel" then
  1084.                                                 Command_Ipadmindel(player, t[1], t[2], count)
  1085.                                         elseif cmd == "/gethash" then
  1086.                                                 Command_Gethash(player, t[1], t[2], count)
  1087.                                         elseif cmd == "/alias" then
  1088.                                                 Command_Alias(player, t[1], t[2], count)
  1089.                                         elseif cmd == "/ammo" then
  1090.                                                 Command_Setammo(player, t[1], t[2], t[3], t[4], count)
  1091.                                         elseif cmd == "/b" then
  1092.                                                 Command_Ban(player, t[1], t[2], t[3], count)
  1093.                                         elseif cmd == "/superban" then
  1094.                                                 Command_Superban(player, t[1], t[2], count)
  1095.                                         elseif cmd == "/bos" then
  1096.                                                 Command_Bos(player, t[1], t[2], count)
  1097.                                         elseif cmd == "/boslist" then
  1098.                                                 Command_Boslist(player, t[1], count)
  1099.                                         elseif cmd == "/unbos" then
  1100.                                                 Command_Unbos(player, t[1], t[2], count)
  1101.                                         elseif cmd == "/c" then
  1102.                                                 Command_Control(player, t[1], t[2], t[3], count)
  1103.                                         elseif cmd == "/commands" then
  1104.                                                 Command_Commands(player, t[1], count)
  1105.                                         elseif cmd == "/count" then
  1106.                                                 Command_Count(player, t[1], count)
  1107.                                         elseif cmd == "/deathless" then
  1108.                                                 Command_Deathless(player, t[1], t[2], count)
  1109.                                         elseif cmd == "/setmode" then
  1110.                                                 Command_Setmode(player, t[1], t[2], t[3], t[4], count)
  1111.                                         elseif cmd == "/e" then
  1112.                                                 Command_Execute(player, message)
  1113.                                         elseif cmd == "/crash" then
  1114.                                                 Command_Crash(player, t[1], t[2], count)
  1115.                                         elseif cmd == "/eject" then
  1116.                                                 Command_Eject(player, t[1], t[2], count)
  1117.                                         elseif cmd == "/follow" then
  1118.                                                 Command_Follow(player, t[1], t[2], count)
  1119.                                         elseif cmd == "/falldamage" then
  1120.                                                 Command_Falldamage(player, t[1], t[2], count)
  1121.                                         elseif cmd == "/getloc" then
  1122.                                                 Command_Getloc(player, t[1], t[2], count)
  1123.                                         elseif cmd == "/ghost" then
  1124.                                                 Command_Ghost(player, t[1], t[2], count)
  1125.                                         elseif cmd == "/hide" then
  1126.                                                 Command_Hide(player, t[1], t[2], count)
  1127.                                         elseif cmd == "/unban" then
  1128.                                                 Command_Unban(player, t[1], t[2], count)
  1129.                                         elseif cmd == "/unghost" then
  1130.                                                 Command_Unghost(player, t[1], t[2], count)
  1131.                                         elseif cmd == "/godmode" then
  1132.                                                 Command_Godmode(player, t[1], t[2], count)
  1133.                                         elseif cmd == "/getip" then
  1134.                                                 Command_getip(player, t[1], t[2], count)
  1135.                                         elseif cmd == "/hax" then
  1136.                                                 Command_Hax(player, t[1], t[2], count)
  1137.                                         elseif cmd == "/heal" then
  1138.                                                 Command_Heal(player, t[1], t[2], count)
  1139.                                         elseif cmd == "/ungod" then
  1140.                                                 Command_Ungod(player, t[1], t[2], count)
  1141.                                         elseif cmd == "/hitler" then
  1142.                                                 Command_Hitler(player, t[1], count)
  1143.                                         elseif cmd == "/infammo" then
  1144.                                                 Command_Infammo(player, t[1], t[2], count)
  1145.                                         elseif cmd == "/ipban" then
  1146.                                                 Command_Ipban(player, t[1], t[2], count)
  1147.                                         elseif cmd == "/ipbanlist" then
  1148.                                                 Command_Ipbanlist(player, t[1], count)
  1149.                                         elseif cmd == "/ipunban" then
  1150.                                                 Command_Ipunban(player, t[1], t[2], count)
  1151.                                         elseif cmd == "/write" then
  1152.                                                 Command_Write(player, t[1], t[2], t[3], t[4], t[5], t[6], count)
  1153.                                         elseif cmd == "/invis" then
  1154.                                                 Command_Invis(player, t[1], t[2], t[3], count)
  1155.                                         elseif cmd == "/j" then
  1156.                                                 Command_Move(player, t[1], t[2], t[3], t[4], t[5], count)
  1157.                                         elseif cmd == "/k" then
  1158.                                                 Command_Kick(player, t[1], t[2], count)
  1159.                                         elseif cmd == "/kill" then
  1160.                                                 Command_Kill(player, t[1], t[2], count)
  1161.                                         elseif cmd == "/lo3" then
  1162.                                                 Command_lo3(player, t[1], count)
  1163.                                         elseif cmd == "/m" then
  1164.                                                 Command_Map(player, message)
  1165.                                         elseif cmd == "/mc" then
  1166.                                                 Command_StartMapcycle(player, t[1], count)
  1167.                                         elseif cmd == "/mnext" then
  1168.                                                 Command_Mapnext(player, t[1], count)
  1169.                                         elseif cmd == "/mute" then
  1170.                                                 Command_Mute(player, t[1], t[2], count)
  1171.                                         elseif cmd == "/nuke" then
  1172.                                                 Command_Nuke(player, t[1], t[2], count)
  1173.                                         elseif cmd == "/noweapons" then
  1174.                                                 Command_Noweapons(player, t[1], t[2], count)
  1175.                                         elseif cmd == "/nameban" then
  1176.                                                 Command_Nameban(player, t[1], t[2], count)
  1177.                                         elseif cmd == "/namebanlist" then
  1178.                                                 Command_Namebanlist(player, t[1], count)
  1179.                                         elseif cmd == "/nameunban" then
  1180.                                                 Command_Nameunban(player, t[1], t[2], count)
  1181.                                         elseif cmd == "/os" then
  1182.                                                 Command_Overshield(player, t[1], t[2], count)
  1183.                                         elseif cmd == "/pass" then
  1184.                                                 Command_Setpassword(player, t[1], t[2], count)
  1185.                                         elseif cmd == "/pl" then
  1186.                                                 Command_Getplayerlist(player, t[1], count)
  1187.                                         elseif cmd == "/privatesay" then
  1188.                                                 Command_Privatesay(player, t, count)
  1189.                                         elseif cmd == "/reset" then
  1190.                                                 Command_Mapreset(player, t[1], count)
  1191.                                         elseif cmd == "/revoke" then
  1192.                                                 Command_Adminrevoke(player, t[1], t[2], count, "chat")
  1193.                                         elseif cmd == "/banlist" then
  1194.                                                 Command_Banlist(player, t[1], count)
  1195.                                         elseif cmd == "/textban" then
  1196.                                                 Command_Textban(player, t[1], t[2], count)
  1197.                                         elseif cmd == "/textbanlist" then
  1198.                                                 Command_Textbanlist(player, t[1], count)
  1199.                                         elseif cmd == "/textunban" then
  1200.                                                 Command_Textunban(player, t[1], t[2], count)
  1201.                                         elseif cmd == "/launch" then
  1202.                                                 Command_Launch(player, t[1], t[2], count)
  1203.                                         elseif cmd == "/resp" then
  1204.                                                 Command_Resp(player, t[1], t[2], t[3], count)
  1205.                                         elseif cmd == "/resetweapons" then
  1206.                                                 Command_Resetweapons(player, t[1], t[2], count)
  1207.                                         elseif cmd == "/say" then
  1208.                                                 if permission then
  1209.                                                         if count ~= 1 then
  1210.                                                                 sendresponse(string.sub(message, 6), message, player)
  1211.                                                         end
  1212.                                                 else
  1213.                                                         sendresponse("You cannot execute this command.", message, player)
  1214.                                                 end
  1215.                                         elseif cmd == "/enter" then
  1216.                                                 Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "enter", count)
  1217.                                         elseif cmd == "/setassists" then
  1218.                                                 Command_Setassists(player, t[1], t[2], t[3], count)
  1219.                                         elseif cmd == "/setdeaths" then
  1220.                                                 Command_Setdeaths(player, t[1], t[2], t[3], count)
  1221.                                         elseif cmd == "/setfrags" then
  1222.                                                 Command_Setfrags(player, t[1], t[2], t[3], count)
  1223.                                         elseif cmd == "/setname" then
  1224.                                                 Command_Setname(player, t[1], t[2], t[3], count)
  1225.                                         elseif cmd == "/setkills" then
  1226.                                                 Command_Setkills(player, t[1], t[2], t[3], count)
  1227.                                         elseif cmd == "/setresp" then
  1228.                                                 Command_Setresp(player, t[1], t[2], count)
  1229.                                         elseif cmd == "/setscore" then
  1230.                                                 Command_Setscore(player, t[1], t[2], t[3], count)
  1231.                                         elseif cmd == "/setplasmas" then
  1232.                                                 Command_Setplasmas(player, t[1], t[2], t[3], count)
  1233.                                         elseif cmd == "/spd" then
  1234.                                                 Command_Setspeed(player, t[1], t[2], t[3], count)
  1235.                                         elseif cmd == "/specs" then
  1236.                                                 Command_Specs(player, t[1], count)
  1237.                                         elseif cmd == "/spawn" then
  1238.                                                 Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "spawn", count)
  1239.                                         elseif cmd == "/give" then
  1240.                                                 Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "give", count)
  1241.                                         elseif cmd == "/st" then
  1242.                                                 Command_Setteleport(player, t[1], t[2], t[3], count)
  1243.                                         elseif cmd == "/suspend" then
  1244.                                                 Command_Suspend(player, t[1], t[2], t[3], count)
  1245.                                         elseif cmd == "/t" and t[2] == "list" then
  1246.                                                 Command_ShowTeleportList(player, t[1] .. " " .. t[2], count)
  1247.                                         elseif cmd == "/t" and t[2] == "del" then
  1248.                                                 Command_Teledelete(player, t[1] .. " " .. t[2], t[3], count)
  1249.                                         elseif cmd == "/t" then
  1250.                                                 Command_Teleport(player, t[1], t[2], t[3], count)
  1251.                                         elseif cmd == "/takeweapons" then
  1252.                                                 Command_Takeweapons(player, t[1], t[2], count)
  1253.                                         elseif cmd == "/setcolor" then
  1254.                                                 Command_Setcolor(player, t[1], t[2], t[3], count)
  1255.                                         elseif cmd == "/tp" then
  1256.                                                 Command_Teletoplayer(player, t[1], t[2], t[3], count)
  1257.                                         elseif cmd == "/ts" then
  1258.                                                 Command_Changeteam(player, t[1], t[2], count)
  1259.                                         elseif cmd == "/timelimit" then
  1260.                                                 Command_Timelimit(player, t[1], t[2], count)
  1261.                                         elseif cmd == "/unhax" then
  1262.                                                 Command_Unhax(player, t[1], t[2], count)
  1263.                                         elseif cmd == "/unhide" then
  1264.                                                 Command_Unhide(player, t[1], t[2], count)
  1265.                                         elseif cmd == "/uninvis" then
  1266.                                                 Command_Uninvis(player, t[1], t[2], count)
  1267.                                         elseif cmd == "/unmute" then
  1268.                                                 Command_Unmute(player, t[1], t[2], count)
  1269.                                         elseif cmd == "/unsuspend" then
  1270.                                                 Command_Unsuspend(player, t[1], t[2], count)
  1271.                                         elseif cmd == "/viewadmins" then
  1272.                                                 Command_Viewadmins(player, t[1], count)
  1273.                                         elseif cmd == "/version" then
  1274.                                                 Command_Version(player, t[1], t[2], count)
  1275.                                         elseif cmd == "/balance" then
  1276.                                                 Command_BalanceTeams(player, t[1], count)
  1277.                                         elseif cmd == "/info" then
  1278.                                                 Command_Info(player, t[1], t[2], count)
  1279.                                         end
  1280.                                         WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. "(Hash: " .. gethash(player) .. " IP: " .. getip(player) .. ") has executed: " .. message)
  1281.                                 else
  1282.                                         say("BLAH")
  1283.                                         sendresponse("You cannot execute this command.", message, player)
  1284.                                         WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. "(Hash: " .. gethash(player) .. " IP: " .. getip(player) .. ") " .. " has failed to execute " .. cmd)
  1285.                                 end
  1286.                         end
  1287.  
  1288.                 end
  1289.         elseif message:sub(1, 1) == "/" or message:sub(1, 1) == "\\" then
  1290.                 sendresponse("You cannot execute this command.", message:sub(1, 1), player)
  1291.         end
  1292.  
  1293.         if AllowChat == 1 and not access then
  1294.                 if not spam_table[hash] then
  1295.                         spam_table[hash] = 1
  1296.                 else
  1297.                         spam_table[hash] = spam_table[hash] + 1
  1298.                 end
  1299.         end
  1300.  
  1301.         return AllowChat
  1302.  
  1303. end
  1304.  
  1305. Spawn = function(message, objname, objtype, objloc, player, type)
  1306.         m = {}
  1307.         vehid = 0
  1308.         local count = gettokencount(message, " ")
  1309.  
  1310.         for i=1,count do
  1311.                 local word = gettoken(message, " ", i - 1)
  1312.                 word = string.lower(word)
  1313.                 table.insert(m, word)
  1314.         end
  1315.         if count == 2 then -- only spawn one next to person spawning
  1316.                 local m_playerObjId = getplayerobjectid(player)
  1317.                 local m_object = getobject(m_playerObjId)
  1318.                 local m_vehicleId = readdword(m_object, 0x11C)
  1319.                 if m_object then
  1320.                         if m_vehicleId ~= 0xFFFFFFFF then
  1321.                                 x,y,z = getobjectcoords(m_vehicleId)
  1322.                         else
  1323.                                 x,y,z = getobjectcoords(m_playerObjId)
  1324.                                 local camera_x = readfloat(m_object, 0x230)
  1325.                                 local camera_y = readfloat(m_object, 0x234)
  1326.                                 x = x + camera_x * 2
  1327.                                 y = y + camera_y * 2
  1328.                                 z = z + 2
  1329.                         end
  1330.                         vehid = createobject(objtype, objloc, 0, 60, false, x+1.0, y, z + 1.3)
  1331.                         if type == "give" then
  1332.                                 assignweapon(player, vehid)
  1333.                                 sendresponse(objname .. " given to " .. getname(player), message, player)
  1334.                         elseif type == "spawn" then
  1335.                                 sendresponse(objname .. " spawned at " .. getname(player) .. "'s location", message, player)
  1336.                         elseif type == "enter" then
  1337.                                 table.insert(vehicle_drone_table[player], vehid)
  1338.                                 entervehicle(player, vehid, 0)
  1339.                                 sendresponse(tostring(getname(player)) .. " was forced to enter a " .. tostring(objname), message, player)
  1340.                         end
  1341.                 else
  1342.                         sendresponse("You cannot spawn stuff while dead!", message, player)
  1343.                 end
  1344.         elseif count >= 3 and count <= 6 then
  1345.                 local players = getvalidplayers(m[3], player)
  1346.                 if players then
  1347.                         for i = 1,#players do
  1348.                                 local m_playerObjId = getplayerobjectid(players[i])
  1349.                                 local m_object = getobject(m_playerObjId)
  1350.                                 local m_vehicleId = readdword(m_object, 0x11C)
  1351.                                 if m_object then
  1352.                                         if m_vehicleId ~= 0xFFFFFFFF and getobject(m_vehicleId) then
  1353.                                                 x,y,z = getobjectcoords(m_vehicleId)
  1354.                                         else
  1355.                                                 x,y,z = getobjectcoords(m_playerObjId)
  1356.                                                 local camera_x = readfloat(m_object, 0x230)
  1357.                                                 local camera_y = readfloat(m_object, 0x234)
  1358.                                                 x = x + camera_x * 2
  1359.                                                 y = y + camera_y * 2
  1360.                                                 z = z + 2
  1361.                                         end
  1362.                                         if count == 3 then
  1363.                                                 vehid = createobject(objtype, objloc, 0, 60, false, x, y, z)
  1364.                                                 if objtype == "weap" and type == "give" then
  1365.                                                         assignweapon(players[i], vehid)
  1366.                                                         sendresponse(objname .. " given to " .. getname(players[i]), message, player)
  1367.                                                         sendresponse("You have been given a " .. objname .. ".", "\\", players[i])
  1368.                                                 elseif type == "spawn" then
  1369.                                                         sendresponse(objname .. " spawned at " .. getname(players[i]) .. "'s location.", message, player)
  1370.                                                 elseif type == "enter" then
  1371.                                                         table.insert(vehicle_drone_table[players[i]], vehid)
  1372.                                                         entervehicle(players[i], vehid, 0)
  1373.                                                         sendresponse(getname(players[i]) .. " was forced to enter a " .. objname, message, player)
  1374.                                                 end
  1375.                                         elseif count == 4 then -- specify amount
  1376.                                                 if m[4] ~= 0 then
  1377.                                                         for i = 1,m[4] do
  1378.                                                                 createobject(objtype, objloc, 0, 0, false, x, y, z)
  1379.                                                         end
  1380.                                                         sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
  1381.                                                         privatesay(players[i], objname .. " spawned above you.")
  1382.                                                 else
  1383.                                                         sendresponse("You didn't spawn anything!")
  1384.                                                 end
  1385.                                         elseif count == 5 then -- specify resptime
  1386.                                                 if m[4] ~= 0 then
  1387.                                                         for i = 1,m[4] do
  1388.                                                                 createobject(objtype, objloc, 0, m[5], false, x, y, z)
  1389.                                                         end
  1390.                                                         sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
  1391.                                                         privatesay(players[i], objname .. " spawned above you.")
  1392.                                                 else
  1393.                                                         sendresponse("You didn't spawn anything!")
  1394.                                                 end
  1395.                                         elseif count == 6 then -- specify recycle boolean
  1396.                                                 if m[4] ~= 0 then
  1397.                                                         for i = 1,m[4] do
  1398.                                                                 createobject(objtype, objloc, 0, m[5], m[6], x, y, z)
  1399.                                                         end
  1400.                                                         sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
  1401.                                                         privatesay(players[i], objname .. " spawned above you.")
  1402.                                                 else
  1403.                                                         sendresponse("You didn't spawn anything!", message, player)
  1404.                                                 end
  1405.                                         end
  1406.                                 elseif type ~= "give" then
  1407.                                         sendresponse("Could not spawn next to " .. getname(players[i]) .. ". Player is dead.", message, player)
  1408.                                 elseif type == "give" then
  1409.                                         sendresponse("Could not give " .. getname(players[i]) .. " a " .. objname .. ". Player is dead.", message, player)
  1410.                                 end
  1411.                         end
  1412.  
  1413.                 else
  1414.                         sendresponse("Invalid Player!", message, player)
  1415.                 end
  1416.         end
  1417.         return vehid
  1418. end
  1419.  
  1420. function OnServerCommand(player, command)
  1421.         local response = 1
  1422.         local count = getcmdtokencount(command)
  1423.         local cmd = getcmdtoken(command, 0)
  1424.         local permission = 1
  1425.         local hash = gethash(player)
  1426.         t = {}
  1427.  
  1428.         for i=1,count do
  1429.                 local word = getcmdtoken(command, i - 1)
  1430.                 word = string.lower(word)
  1431.                 table.insert(t, word)
  1432.         end
  1433.  
  1434.         --[[if player ~= 0xFFFFFFFF and player ~= -1 then
  1435.                 local bool = false
  1436.                 if executed_global_rcon then
  1437.                         for k,v in pairs(global_rcons) do
  1438.                                 if executed_global_rcon == k then
  1439.                                         if bool == true then break end
  1440.                                         if string.find(access_table[k], "," .. t[1] .. ",") then
  1441.                                                 bool = true
  1442.                                                 break
  1443.                                         end
  1444.                                 end
  1445.                         end
  1446.                         executed_global_rcon = nil
  1447.                 end
  1448.                 if bool == false then
  1449.                         for k,v in pairs(admin_table) do
  1450.                                 if k == gethash(player) then
  1451.                                         bool = true
  1452.                                         break
  1453.                                 end
  1454.                         end
  1455.                         if bool == false then
  1456.                                 for k,v in pairs(ipadmins) do
  1457.                                         if bool == true then break end
  1458.                                         for k2,v2 in pairs(ipadmins[k]) do
  1459.                                                 if ipadmins[k][k2] == getip(player) then
  1460.                                                         bool = true
  1461.                                                         break
  1462.                                                 end
  1463.                                         end
  1464.                                 end
  1465.                         end
  1466.                 end
  1467.                 if bool == false then
  1468.                         return 0
  1469.                 end
  1470.         end--]]
  1471.         if admin_table[hash] or player == 0xFFFFFFFF or ipadmins[getip(player)] then
  1472.                 if t[1] == "sv_setafk" then
  1473.                         response = 0
  1474.                         Command_AFK(player, t[1], t[2], count)
  1475.                 elseif t[1] == "sv_viewadmins" then
  1476.                         response = 0
  1477.                         Command_Viewadmins(player, t[1], count)
  1478.                 elseif t[1] == "sv_privatesay" then
  1479.                         response = 0
  1480.                         Command_Privatesay(player, t[1], t[2], t[3], count)
  1481.                 elseif t[1] == "sv_admin_add" then
  1482.                         response = 0
  1483.                         Command_Adminadd(player, t[1], t[2], t[3], t[4], count)
  1484.                 elseif t[1] == "sv_ipadminadd" then
  1485.                         response = 0
  1486.                         Command_Ipadminadd(player, t[1], t[2], t[3], t[4], count)
  1487.                 elseif t[1] == "sv_admin_del" then
  1488.                         if sv_admin_del then
  1489.                                 response = 0
  1490.                                 Command_Admindel(player, t[1], t[2], count)
  1491.                         end
  1492.                 elseif t[1] == "sv_ipadmindel" then
  1493.                         response = 0
  1494.                         Command_Ipadmindel(player, t[1], t[2], count)
  1495.                 elseif t[1] == "sv_admin_list" then
  1496.                         response = 0
  1497.                         Command_ShowAdminList(player, t[1], count)
  1498.                 elseif t[1] == "sv_revoke" then
  1499.                         response = 0
  1500.                         Command_Adminrevoke(player, t[1], t[2], count, "rcon")
  1501.                 elseif t[1] == "sv_gethash" then
  1502.                         response = 0
  1503.                         Command_Gethash(player, t[1], t[2], count)
  1504.                 elseif t[1] == "sv_falldamage" then
  1505.                         response = 0
  1506.                         Command_Falldamage(player, t[1], t[2], count)
  1507.                 elseif t[1] == "sv_launch" then
  1508.                         response = 0
  1509.                         Command_Launch(player, t[1], t[2], count)
  1510.                 elseif t[1] == "sv_getip" then
  1511.                         response = 0
  1512.                         Command_getip(player, t[1], t[2], count)
  1513.                 elseif t[1] == "sv_crash" then
  1514.                         response = 0
  1515.                         Command_Crash(player, t[1], t[2], count)
  1516.                 elseif t[1] == "sv_rtv_enabled" then
  1517.                         response = 0
  1518.                         Command_RTVEnabled(player, t[1], t[2], count)
  1519.                 elseif t[1] == "sv_rtv_needed" then
  1520.                         response = 0
  1521.                         Command_RTVRequired(player, t[1], t[2], count)
  1522.                 elseif t[1] == "sv_votekick_enabled" then
  1523.                         response = 0
  1524.                         Command_VotekickEnabled(player, t[1], t[2], count)
  1525.                 elseif t[1] == "sv_votekick_needed" then
  1526.                         response = 0
  1527.                         Command_VotekickRequired(player, t[1], t[2], count)
  1528.                 elseif t[1] == "sv_votekick_action" then
  1529.                         response = 0
  1530.                         Command_VotekickAction(player, t[1], t[2], count)
  1531.                 elseif t[1] == "sv_hash_check" then
  1532.                         response = 0
  1533.                         Command_Hashcheck(player, t[1], t[2], count)
  1534.                 elseif t[1] == "sv_version_check" then
  1535.                         response = 0
  1536.                         Command_Versioncheck(player, t[1], t[2], count)
  1537.                 elseif t[1] == "sv_version" then
  1538.                         response = 0
  1539.                         Command_Version(player, t[1], t[2], count)
  1540.                 elseif t[1] == "sv_ban" then
  1541.                         if tonumber(t[2]) == nil then
  1542.                                 response = 0
  1543.                                 Command_Ban(player, t[1], t[2], t[3], count)
  1544.                         end
  1545.                 elseif t[1] == "sv_nameban" then
  1546.                         response = 0
  1547.                         Command_Nameban(player, t[1], t[2], count)
  1548.                 elseif t[1] == "sv_namebanlist" then
  1549.                         response = 0
  1550.                         Command_Namebanlist(player, t[1], count)
  1551.                 elseif t[1] == "sv_nameunban" then
  1552.                         response = 0
  1553.                         Command_Nameunban(player, t[1], t[2], count)
  1554.                 elseif t[1] == "sv_ipban" then
  1555.                         response = 0
  1556.                         Command_Ipban(player, t[1], t[2], count)
  1557.                 elseif t[1] == "sv_ipbanlist" then
  1558.                         response = 0
  1559.                         Command_Ipbanlist(player, t[1], count)
  1560.                 elseif t[1] == "sv_ipunban" then
  1561.                         response = 0
  1562.                         Command_Ipunban(player, t[1], t[2], count)
  1563.                 elseif t[1] == "sv_superban" then
  1564.                         response = 0
  1565.                         Command_Superban(player, t[1], t[2], count)
  1566.                 elseif t[1] == "sv_stickman_animation" then
  1567.                         response = 0
  1568.                         registertimer(200, "Stickman")
  1569.                 elseif t[1] == "sv_kick" then
  1570.                         if tonumber(t[2]) == nil then
  1571.                                 response = 0
  1572.                                 Command_Kick(player, t[1], t[2], count)
  1573.                         end
  1574.                 elseif t[1] == "sv_hide" then
  1575.                         response = 0
  1576.                         Command_Hide(player, t[1], t[2], count)
  1577.                 elseif t[1] == "sv_superban" then
  1578.                         Command_Superban(player, t[1], t[2], count)
  1579.                 elseif t[1] == "sv_textban" then
  1580.                         response = 0
  1581.                         Command_Textban(player, t[1], t[2], count)
  1582.                 elseif t[1] == "sv_textbanlist" then
  1583.                         response = 0
  1584.                         Command_Textbanlist(player, t[1], count)
  1585.                 elseif t[1] == "sv_textunban" then
  1586.                         response = 0
  1587.                         Command_Textunban(player, t[1], t[2], count)
  1588.                 elseif t[1] == "sv_pvtsay" then
  1589.                         response = 0
  1590.                         Command_Privatesay(player, t, count)
  1591.                 elseif t[1] == "sv_unhide" then
  1592.                         response = 0
  1593.                         Command_Unhide(player, t[1], t[2], count)
  1594.                 elseif t[1] == "sv_setammo" then
  1595.                         response = 0
  1596.                         Command_Setammo(player, t[1], t[2], t[3], t[4], count)
  1597.                 elseif t[1] == "sv_help" then
  1598.                         response = 0
  1599.                         Command_Help(player, t[1], t[2], count)
  1600.                 elseif t[1] == "sv_deathless" then
  1601.                         response = 0
  1602.                         Command_Deathless(player, t[1], t[2], count)
  1603.                 elseif t[1] == "sv_setmode" then
  1604.                         response = 0
  1605.                         Command_Setmode(player, t[1], t[2], t[3], t[4], count)
  1606.                 elseif t[1] == "sv_eject" then
  1607.                         response = 0
  1608.                         Command_Eject(player, t[1], t[2], count)
  1609.                 elseif t[1] == "sv_getloc" then
  1610.                         response = 0
  1611.                         Command_Getloc(player, t[1], t[2], count)
  1612.                 elseif t[1] == "sv_ghost" then
  1613.                         response = 0
  1614.                         Command_Ghost(player, t[1], t[2], count)
  1615.                 elseif t[1] == "sv_unghost" then
  1616.                         response = 0
  1617.                         Command_Unghost(player, t[1], t[2], count)
  1618.                 elseif t[1] == "sv_setgod" then
  1619.                         response = 0
  1620.                         Command_Godmode(player, t[1], t[2], count)
  1621.                 elseif t[1] == "cheat_hax" then
  1622.                         response = 0
  1623.                         Command_Hax(player, t[1], t[2], count)
  1624.                 elseif t[1] == "sv_heal" then
  1625.                         response = 0
  1626.                         Command_Heal(player, t[1], t[2], count)
  1627.                 elseif t[1] == "sv_ungod" then
  1628.                         response = 0
  1629.                         Command_Ungod(player, t[1], t[2], count)
  1630.                 elseif t[1] == "sv_hitler" then
  1631.                         response = 0
  1632.                         if count == 1 then
  1633.                                 for c = 0,15 do
  1634.                                         if getplayer(c) then
  1635.                                                 kill(c)
  1636.                                                 hprintf(getname(c) .. " was given a lethal injection!")
  1637.                                         end
  1638.                                 end
  1639.                         else
  1640.                                 hprintf("Invalid Syntax: sv_hitler")
  1641.                         end
  1642.                 elseif t[1] == "sv_infinite_ammo" then
  1643.                         response = 0
  1644.                         Command_Infammo(player, t[1], t[2], count)
  1645.                 elseif t[1] == "sv_invis" then
  1646.                         response = 0
  1647.                         Command_Invis(player, t[1], t[2], t[3], count)
  1648.                 elseif t[1] == "sv_move" then
  1649.                         response = 0
  1650.                         Command_Move(player, t[1], t[2], t[3], t[4], t[5], count)
  1651.                 elseif t[1] == "sv_scrim" then
  1652.                         response = 0
  1653.                         Command_Lo3(player, t[1], count)
  1654.                 elseif t[1] == "sv_mute" then
  1655.                         response = 0
  1656.                         Command_Mute(player, t[1], t[2], count)
  1657.                 elseif t[1] == "sv_noweapons" then
  1658.                         response = 0
  1659.                         Command_Noweapons(player, t[1], t[2], count)
  1660.                 elseif t[1] == "sv_resp" then
  1661.                         response = 0
  1662.                         Command_Resp(player, t[1], t[2], t[3], count)
  1663.                 elseif t[1] == "sv_enter" then
  1664.                         response = 0
  1665.                         Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "enter", count)
  1666.                 elseif t[1] == "sv_setassists" then
  1667.                         response = 0
  1668.                         Command_Setassists(player, t[1], t[2], t[3], count)
  1669.                 elseif t[1] == "sv_setdeaths" then
  1670.                         response = 0
  1671.                         Command_Setdeaths(player, t[1], t[2], t[3], count)
  1672.                 elseif t[1] == "sv_setfrags" then
  1673.                         response = 0
  1674.                         Command_Setfrags(player, t[1], t[2], t[3], count)
  1675.                 elseif t[1] == "sv_setkills" then
  1676.                         response = 0
  1677.                         Command_Setkills(player, t[1], t[2], t[3], count)
  1678.                 elseif t[1] == "sv_setscore" then
  1679.                         response = 0
  1680.                         Command_Setscore(player, t[1], t[2], t[3], count)
  1681.                 elseif t[1] == "sv_respawn_time" then
  1682.                         response = 0
  1683.                         Command_Setresp(player, t[1], t[2], count)
  1684.                 elseif t[1] == "sv_setplasmas" then
  1685.                         response = 0
  1686.                         Command_Setplasmas(player, t[1], t[2], t[3], count)
  1687.                 elseif t[1] == "sv_spawn" then
  1688.                         response = 0
  1689.                         Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "spawn", count)
  1690.                 elseif t[1] == "sv_specs" then
  1691.                         response = 0
  1692.                         Command_Specs(player, t[1], count)
  1693.                 elseif t[1] == "sv_give" then
  1694.                         response = 0
  1695.                         Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "give", count)
  1696.                 elseif t[1] == "sv_suspend" then
  1697.                         response = 0
  1698.                         Command_Suspend(player, t[1], t[2], t[3], count)
  1699.                 elseif t[1] == "sv_map" then
  1700.                         if command:find("commands") == nil then
  1701.                                 response = 0
  1702.                                 Command_Map(player, command)
  1703.                         end
  1704.                 elseif t[1] == "sv_teleport_pl" then
  1705.                         if tonumber(t[2]) == nil then
  1706.                                 response = 0
  1707.                                 Command_Teletoplayer(player, t[1], t[2], t[3], count)
  1708.                         end
  1709.                 elseif t[1] == "sv_teleport" then
  1710.                         if tonumber(t[2]) == nil then
  1711.                                 response = 0
  1712.                                 Command_Teleport(player, t[1], t[2], t[3], count)
  1713.                         end
  1714.                 elseif t[1] == "sv_alias" then
  1715.                         if tonumber(t[2]) == nil then
  1716.                                 response = 0
  1717.                                 Command_Alias(player, t[1], t[2], count)
  1718.                         end
  1719.                 elseif t[1] == "sv_changeteam" then
  1720.                         if tonumber(t[2]) == nil then
  1721.                                 response = 0
  1722.                                 Command_Changeteam(player, t[1], t[2], count)
  1723.                         end
  1724.                 elseif t[1] == "sv_setname" then
  1725.                         response = 0
  1726.                         Command_Setname(player, t[1], t[2], t[3], count)
  1727.                 elseif t[1] == "sv_time_cur" then
  1728.                         Command_Timelimit(player, t[1], t[2], count)
  1729.                 elseif t[1] == "cheat_unhax" then
  1730.                         response = 0
  1731.                         Command_Unhax(player, t[1], t[2], count)
  1732.                 elseif t[1] == "sv_unmute" then
  1733.                         response = 0
  1734.                         Command_Unmute(player, t[1], t[2], count)
  1735.                 elseif t[1] == "sv_unsuspend" then
  1736.                         response = 0
  1737.                         Command_Unsuspend(player, t[1], t[2], count)
  1738.                 elseif cmd == "sv_bos" then
  1739.                         response = 0
  1740.                         Command_Bos(player, t[1], t[2], count)
  1741.                 elseif cmd == "sv_setcolor" then
  1742.                         response = 0
  1743.                         Command_Setcolor(player, t[1], t[2], t[3], count)
  1744.                 elseif cmd == "sv_takeweapons" then
  1745.                         response = 0
  1746.                         Command_Takeweapons(player, t[1], t[2], count)
  1747.                 elseif cmd == "sv_resetweapons" then
  1748.                         response = 0
  1749.                         Command_Resetweapons(player, t[1], t[2], count)
  1750.                 elseif cmd == "sv_boslist" then
  1751.                         response = 0
  1752.                         Command_Boslist(player, t[1], count)
  1753.                 elseif cmd == "sv_unbos" then
  1754.                         response = 0
  1755.                         Command_Unbos(player, t[1], t[2], count)
  1756.                 elseif cmd == "sv_kill" then
  1757.                         if tonumber(t[2]) == nil then
  1758.                                 response = 0
  1759.                                 Command_Kill(player, t[1], t[2], count)
  1760.                         end
  1761.                 elseif cmd == "sv_info" then
  1762.                         response = 0
  1763.                         Command_Info(player, t[1], t[2], count)
  1764.                 end
  1765.                 if player ~= 0xFFFFFFFF and player ~= -1 and response == 0 then
  1766.                         WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. " (Hash:" .. gethash(player) .. " IP: " .. getip(player) .. ") has executed '" .. command .. "'")
  1767.                 end
  1768.         else
  1769.                 sendresponse("You cannot execute this command.", t[1], player)
  1770.                 response = 0
  1771.         end
  1772.         return response
  1773.  
  1774. end
  1775.  
  1776. function OnRconAttempt(player, command, rcon)
  1777.         local response = 1
  1778.         if IsAdmin(player) == false then
  1779.                 local hash = gethash(player)
  1780.                 local ip = getip(player)
  1781.                 for k,v in pairs(global_rcons) do
  1782.                         if k == rcon then
  1783.                                 executed_global_rcon = rcon
  1784.                                 svcmd(command, player)
  1785.                                 return 0
  1786.                         end
  1787.                 end
  1788.                 if admin_table[hash] or ipadmins[ip] then
  1789.                         svcmd(command, player)
  1790.                 end
  1791.         end
  1792.         return response
  1793. end
  1794.  
  1795. WriteLog = function(filename, value)
  1796.         local file = io.open(filename, "a")
  1797.         if file then
  1798.                 local timestamp = os.date("%Y/%m/%d %H:%M:%S")
  1799.                 local line = string.format("%s\t%s\n", timestamp, tostring(value))
  1800.                 file:write(line)
  1801.                 file:close()
  1802.         end
  1803. end
  1804.  
  1805. getstatus = function(m_player)
  1806.         local status = ""
  1807.         local player_struct = getplayer(m_player)
  1808.         local m_playerObjId = readdword(player_struct, 0x34)
  1809.         local m_object = getobject(m_playerObjId)
  1810.         local obj_crouch = readbyte(m_object, 0x2A0)
  1811.         if obj_crouch == 0 then
  1812.                 status = "wpassenger"
  1813.         elseif obj_crouch == 1 then
  1814.                 status = "wpassenger"
  1815.         elseif obj_crouch == 2 then
  1816.                 status = "wpassenger"
  1817.         elseif obj_crouch == 3 then
  1818.                 status = "crouching"
  1819.         elseif obj_crouch == 4 then
  1820.                 status = "standing"
  1821.         elseif obj_crouch == 5 then
  1822.                 status = "gdriver"
  1823.         elseif obj_crouch == 6 then
  1824.                 status = "bpilot"
  1825.         elseif obj_crouch == 13 then
  1826.                 status = "sdriver"
  1827.         elseif obj_crouch == 17 then
  1828.                 status = "turret"
  1829.         elseif obj_crouch == 20 or obj_crouch == 21 or obj_crouch == 22 or obj_crouch == 23 then
  1830.                 status = "spassenger"
  1831.         end
  1832.         return status
  1833. end
  1834.  
  1835. function tohex(number)
  1836.         return string.format("%X", number)
  1837. end
  1838.  
  1839. function OnClientUpdate(player, m_objectId)
  1840.         --say(getname(player) .. ": " .. tostring(player))
  1841.         local id = resolveplayer(player)
  1842.         --local test = readbyte(m_player, 0x130) Changes when player joins?
  1843.         --local test = readbyte(m_player, 0x108) Changes to 0 when player joins?
  1844.         --local test = readword(m_object, 0x12) Changes to 1536 when shields go down/up
  1845.         --local test = readbyte(m_object, 0xD0) Changes when you do an action (walk, jump, throw nade, shoot, crouch). But its value depends on the weapon your holding.
  1846.         --local test = readbyte(m_object, 0xD4) Counts up when action occurs. Changes back to 6. Stays at one if shields are depleted.
  1847.         --local test = readbyte(m_object, 0x10C) Changes after you respawn. Changes to 255 while in vehicles.
  1848.         --local test = readword(m_object, 0x10F) All it does is count up every 5 seconds. Starts at 128, ends at 255 and goes back to 128. Seems to be the same for everyone.
  1849.         --[[local x_aim = readfloat(m_player, 0x154) -- Confirmed. Lags.
  1850.         local y_aim = readfloat(m_player, 0x158) -- Confirmed. Lags.
  1851.     local z_aim = readfloat(m_player, 0x15C)--]]
  1852.         local x,y,z = getobjectcoords(m_objectId)
  1853.         if x ~= loc[id][1] or y ~= loc[id][2] or z ~= loc[id][3] then
  1854.                 local m_object = getobject(m_objectId)
  1855.                 if loc[id][1] == nil then
  1856.                         loc[id][1] = x
  1857.                         loc[id][2] = y
  1858.                         loc[id][3] = z
  1859.                 elseif m_object then
  1860.                         local result = OnPositionUpdate(player, m_objectId, x, y, z)
  1861.                         if result == 0 then
  1862.                                 movobjcoords(m_objectId, loc[id][1], loc[id][2], loc[id][3])
  1863.                         else
  1864.                                 loc[id][1] = x
  1865.                                 loc[id][2] = y
  1866.                                 loc[id][3] = z
  1867.                         end
  1868.                 end
  1869.         end
  1870. end
  1871.  
  1872. OnPositionUpdate = function(player, m_objectId, x, y, z)
  1873.         local id = resolveplayer(player)
  1874.         local m_controlObject = getobject(m_objectId)
  1875.         if control_table[id][1] then
  1876.                 for i = 1,#control_table[id] do
  1877.                         local victim = control_table[id][i]
  1878.                         local m_playerObjId = getplayerobjectid(victim)
  1879.                         local m_object = getobject(m_playerObjId)
  1880.                         if m_object then
  1881.                                 local m_vehicle = getobject(readdword(m_object, 0x11C))
  1882.                                 if m_vehicle == nil then
  1883.                                         local x_vel = readfloat(m_controlObject, 0x68)
  1884.                                         local y_vel = readfloat(m_controlObject, 0x6C)
  1885.                                         writefloat(m_object, 0x68, x_vel)
  1886.                                         writefloat(m_object, 0x6C, y_vel)
  1887.                                 end
  1888.                         end
  1889.                 end
  1890.         end
  1891.         return 1
  1892. end
  1893.  
  1894. GetLines = function(filename)
  1895.         local file = io.open(filename, "r")
  1896.         if file then
  1897.                 local Lines = {}
  1898.                 for line in file:lines() do
  1899.                         table.insert(Lines, line)
  1900.                 end
  1901.                 file:close()
  1902.                 return Lines
  1903.         end
  1904. end
  1905.  
  1906. FollowTimer = function(id, count, player, player2)
  1907.         if getplayer(player) and getobject(getplayerobjectid(player)) then
  1908.                 if getplayer(player2) and getobject(getplayerobjectid(player2)) then
  1909.                         local m_objectId = getplayerobjectid(player)
  1910.                         local m_playerObjId = getplayerobjectid(player2)
  1911.                         local m_object = getobject(m_playerObjId)
  1912.                         local m_Object = getobject(m_objectId)
  1913.                         if x == nil then
  1914.                                 x,y,z = getobjectcoords(m_playerObjId)
  1915.                                 movobjcoords(m_objectId, x, y, z+0.5)
  1916.                         end
  1917.                         local obj_x_vel = readfloat(m_object, 0x68)
  1918.                         local obj_y_vel = readfloat(m_object, 0x6C)
  1919.                         local obj_z_vel = readfloat(m_object, 0x70)
  1920.                         writefloat(m_Object, 0x68, obj_x_vel)
  1921.                         writefloat(m_Object, 0x6C, obj_y_vel)
  1922.                         writefloat(m_Object, 0x70, obj_z_vel)
  1923.                 elseif getplayer(player2) then
  1924.                         x,y,z = nil
  1925.                 else
  1926.                         local id = resolveplayer(player)
  1927.                         follow[id] = nil
  1928.                         return 0
  1929.                 end
  1930.         end
  1931.         return 1
  1932. end
  1933.  
  1934. function OnTeamDecision(cur_team)
  1935.         return cur_team
  1936. end
  1937.  
  1938. Ipban = function(player)
  1939.         svcmd("sv_ban " .. resolveplayer(player))
  1940.         local file = io.open(profilepath .. "\\banned.txt", "r")
  1941.         if file then
  1942.                 local Lines = {}
  1943.                 for line in file:lines() do
  1944.                         if line and line ~= "" then
  1945.                                 table.insert(Lines, line)
  1946.                         end
  1947.                 end
  1948.                 svcmd("sv_unban " .. #Lines - 2)
  1949.         end
  1950. end
  1951.  
  1952. function OnPlayerJoin(player, team)
  1953.  
  1954.         messages[gethash(player)] = {}
  1955.  
  1956.         cur_players = cur_players + 1
  1957.         local sv_player = resolveplayer(player)
  1958.         local name = getname(player)
  1959.         local hash = gethash(player)
  1960.         local words = {}
  1961.         local id = resolveplayer(player)
  1962.         local ip = getip(player)
  1963.  
  1964.         ip_table[id] = ip
  1965.  
  1966.         for k,v in pairs(ip_banlist) do
  1967.                 if ip_banlist[k] == tostring(ip) then
  1968.                         Ipban(player)
  1969.                 end
  1970.         end
  1971.  
  1972.         for k,v in pairs(name_bans) do
  1973.                 if name_bans[k] == tostring(name) then
  1974.                         Ipban(player)
  1975.                 end
  1976.         end
  1977.  
  1978.         if ipadmins[ip] or admin_table[hash] then
  1979.                 say("Server Admin: " .. name)
  1980.         end
  1981.  
  1982.         for k,v in pairs(boslog_table) do
  1983.  
  1984.                 local count = gettokencount(v, ",")
  1985.  
  1986.                 for i = 1,count do
  1987.                         local word = gettoken(v, ",", i-1)
  1988.                         table.insert(words, word)
  1989.                 end
  1990.  
  1991.                 local entry_name = words[1]
  1992.                 local entry_hash = words[2]
  1993.                 local entry_ip = words[3]
  1994.  
  1995.                 if entry_hash == hash or entry_ip == ip then
  1996.  
  1997.                         for i=0,15 do
  1998.  
  1999.                                 local player_hash = gethash(i)
  2000.                                 local player_ip = getip(i)
  2001.                                 if ipadmins[player_ip] or admin_table[player_hash] then
  2002.                                         privatesay(i, name .. " banned from BoS.")
  2003.                                         privatesay(i, "Entry: " .. entry_name .. "- " .. entry_hash)
  2004.                                 end
  2005.  
  2006.                         end
  2007.  
  2008.                         hprintf(name .. " banned from BoS.")
  2009.                         hprintf("Entry: " .. entry_name .. "- " .. entry_hash .. "- " .. entry_ip)
  2010.                         svcmd("sv_ban " .. sv_player)
  2011.                         local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a")
  2012.                         ip_banlist[name] = ip
  2013.                         banlist:write(name .. "," .. tostring(ip_banlist[name]) .. "\n")
  2014.                         banlist:close()
  2015.                         table.remove(boslog_table, k)
  2016.                         break
  2017.  
  2018.                 end
  2019.  
  2020.         end
  2021.  
  2022.         local bool
  2023.         for k,v in pairs(unique_table) do
  2024.                 if hash == v[1] or ip == v[2] then
  2025.                         bool = true
  2026.                         break
  2027.                 end
  2028.         end
  2029.         if not bool then
  2030.                 unique_table[name] = {hash, ip}
  2031.                 uniques = uniques + 1
  2032.                 say(name .. " is unique player #" .. tostring(uniques) .. " on this server!")
  2033.         end
  2034.  
  2035. end
  2036.  
  2037. function OnPlayerLeave(player, team)
  2038.  
  2039.         cur_players = cur_players - 1
  2040.         cleanupdrones(player)
  2041.         local id = resolveplayer(player)
  2042.         local name = getname(player)
  2043.         local hash = gethash(player)
  2044.         local ip = ip_table[id]
  2045.         bos_table[id] = name .. "," .. hash .. "," .. ip
  2046.         ip_table[id] = nil
  2047.         hidden[id] = nil
  2048.         afk[id] = {}
  2049.  
  2050. end
  2051.  
  2052. function OnPlayerKill(killer, victim, mode)
  2053.         if respset then
  2054.                 local m_player = getplayer(victim)
  2055.                 local player_respawn_time = readdword(m_player, 0x2C)
  2056.                 writedword(m_player, 0x2c, resptime * 33)
  2057.         end
  2058.         cleanupdrones(victim)
  2059. end
  2060.  
  2061. function OnKillMultiplier(player, multiplier)
  2062. end
  2063.  
  2064. function OnPlayerSpawn(player, m_objectId)
  2065.  
  2066.         local hash = gethash(player)
  2067.  
  2068.         if deathless then
  2069.                 local m_player = getplayer(player)
  2070.                 local m_playerObjId = readdword(m_player, 0x34)
  2071.                 local m_object = getobject(m_playerObjId)
  2072.                 writefloat(m_object, 0xE0, 9999999999)
  2073.                 writefloat(m_object, 0xE4, 9999999999)
  2074.         end
  2075.  
  2076.         if noweapons or Noweapons[hash] then
  2077.                 for i = 0,3 do
  2078.                         local m_object = getobject(m_objectId)
  2079.                         if m_object then
  2080.                                 local weapID = readdword(m_object, 0x2F8 + i*4)
  2081.                                 local weap = getobject(weapID)
  2082.                                 if weap then
  2083.                                         destroyobject(weapID)
  2084.                                 end
  2085.                         end
  2086.                 end
  2087.         end
  2088.  
  2089.         if colorspawn == nil then colorspawn = {} end
  2090.         if colorspawn[player] == nil then colorspawn[player] = {} end
  2091.  
  2092.         if colorspawn[player][1] then
  2093.                 movobjcoords(m_objectId, colorspawn[player][1], colorspawn[player][2], colorspawn[player][3])
  2094.                 colorspawn[player] = {}
  2095.         end
  2096.  
  2097.         if suspend_table[hash] then
  2098.                 suspend_table[hash] = nil
  2099.         end
  2100.  
  2101.         if ghost_table[hash] then
  2102.                 ghost_table[hash] = nil
  2103.         end
  2104.  
  2105. end
  2106.  
  2107. function OnPlayerSpawnEnd(player, m_objectId)
  2108. end
  2109.  
  2110. function OnTeamChange(relevant, player, team, dest_team)
  2111.         return 1
  2112. end
  2113.  
  2114. function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
  2115.         local Pass = 1
  2116.         local hash = gethash(player)
  2117.         if noweapons or Noweapons[hash] then
  2118.                 if tagType == "weap" then
  2119.                         Pass = 0
  2120.                 end
  2121.         end
  2122.         return Pass
  2123. end
  2124.  
  2125. VelTimer = function(id, count, m_objectId)
  2126.         local m_object = getobject(m_objectId)
  2127.         if m_object then
  2128.                 writefloat(m_object, 0x90, 20)
  2129.                 return 1
  2130.         end
  2131.         return 0
  2132. end
  2133.  
  2134. function OnObjectCreation(m_objectId, player_owner, tag)
  2135.         if getplayer(player_owner) then
  2136.                 for i = 25,41 do
  2137.                         if objects[i][3] == tag then
  2138.                                 if mode[gethash(player_owner)] == "portalgun" then
  2139.                                         local m_object = getobject(m_objectId)
  2140.                                         registertimer(20, "portalgunTimer", player_owner, m_object)
  2141.                                 elseif mode[gethash(player_owner)] == "spawngun" then
  2142.                                         local m_object = getobject(m_objectId)
  2143.                                         registertimer(20, "spawngunTimer", player_owner, m_object)
  2144.                                 end
  2145.                         end
  2146.                 end
  2147.         end
  2148. end
  2149.  
  2150. function OnWeaponReload(player, weapon)
  2151.         if infammo then
  2152.                 writeword(getobject(weapon), 0x2B6, 9999)
  2153.                 writeword(getobject(weapon), 0x2B8, 9999)
  2154.                 updateammo(weapon)
  2155.                 return 0
  2156.         else
  2157.                 return 1
  2158.         end
  2159. end
  2160.  
  2161. function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
  2162.         return 1
  2163. end
  2164. function OnVehicleEject(player, forceEject)
  2165.         local m_objectId = getplayerobjectid(player)
  2166.         local m_object = getobject(m_objectId)
  2167.         if m_object then
  2168.                 local vehicleId = readdword(m_object, 0x11C)
  2169.                 if vehicleId == 0xFFFFFFFF then return end
  2170.                 cleanupdrone(player, m_objectId)
  2171.         end
  2172.         return 1
  2173. end
  2174.  
  2175. function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
  2176.         --if tagname:find("vehicle_hit_environment") == nil then say(tostring(tagname)) end
  2177.         if deathless or backtaps then
  2178.                 writebyte(tagdata, 0x1C4, 0)
  2179.         end
  2180.         if deathless and tagname ~= "globals\\falling" and tagname ~= "globals\\distance" then
  2181.                 writebyte(tagdata, 0x1D0, 0)
  2182.                 writebyte(tagdata, 0x1D4, 0)
  2183.                 writebyte(tagdata, 0x1D8, 0)
  2184.         end
  2185.         if deathless or not falldamage then
  2186.                 local receiver = objecttoplayer(receiving_obj)
  2187.                 if (tagname == "globals\\falling" or tagname == "globals\\distance") and receiver then
  2188.                         writefloat(tagdata, 0x1D0, 0.0000001)
  2189.                         writefloat(tagdata, 0x1D4, 0.0000001)
  2190.                         writefloat(tagdata, 0x1D8, 0.0000001)
  2191.                 end
  2192.         end
  2193.         if causing_obj ~= 0xFFFFFFFF then
  2194.                 for i = 25,41 do
  2195.                         local player = objecttoplayer(causing_obj)
  2196.                         if getplayer(player) == nil then return end
  2197.                         if mode[gethash(player)] == "destroy" then
  2198.                                 if tagname == objects[i][3] then
  2199.                                         destroyobject(receiving_obj)
  2200.                                 end
  2201.                         elseif mode[gethash(player)] == "entergun" then
  2202.                                 if tagname == objects[i][3] and string.sub(getobjecttag(receiving_obj), 1, 8) == "vehicles" then
  2203.                                         entervehicle(player, receiving_obj, 0)
  2204.                                 end
  2205.                         end
  2206.                 end
  2207.         end
  2208. end
  2209.  
  2210. AccessMerging = function()
  2211.         for i = 1,#access_table do
  2212.                 if string.find(access_table[i], ",sv_kick,") then
  2213.                         access_table[i] = access_table[i] .. ",sv_k"
  2214.                 end
  2215.                 if string.find(access_table[i], ",sv_admin_add,") then
  2216.                         access_table[i] = access_table[i] .. ",sv_a"
  2217.                 end
  2218.                 if string.find(access_table[i], ",sv_setafk,") then
  2219.                         access_table[i] = access_table[i] .. ",sv_afk"
  2220.                 end
  2221.                 if string.find(access_table[i], ",sv_setammo,") then
  2222.                         access_table[i] = access_table[i] .. ",sv_ammo"
  2223.                 end
  2224.                 if string.find(access_table[i], ",sv_ban,") then
  2225.                         access_table[i] = access_table[i] .. ",sv_b"
  2226.                 end
  2227.                 if string.find(access_table[i], ",sv_setinvis,") then
  2228.                         access_table[i] = access_table[i] .. ",sv_invis"
  2229.                 end
  2230.                 if string.find(access_table[i], ",sv_move,") then
  2231.                         access_table[i] = access_table[i] .. ",sv_j"
  2232.                 end
  2233.                 if string.find(access_table[i], ",sv_scrim,") then
  2234.                         access_table[i] = access_table[i] .. ",sv_lo3"
  2235.                 end
  2236.                 if string.find(access_table[i], ",sv_map,") then
  2237.                         access_table[i] = access_table[i] .. ",sv_m"
  2238.                 end
  2239.                 if string.find(access_table[i], ",sv_mapcycle_begin,") then
  2240.                         access_table[i] = access_table[i] .. ",sv_mc"
  2241.                 end
  2242.                 if string.find(access_table[i], ",sv_map_next,") then
  2243.                         access_table[i] = access_table[i] .. ",sv_mnext"
  2244.                 end
  2245.                 if string.find(access_table[i], ",sv_players,") then
  2246.                         access_table[i] = access_table[i] .. ",sv_pl"
  2247.                 end
  2248.                 if string.find(access_table[i], ",sv_map_reset,") then
  2249.                         access_table[i] = access_table[i] .. ",sv_reset"
  2250.                 end
  2251.                 if string.find(access_table[i], ",sv_password,") then
  2252.                         access_table[i] = access_table[i] .. ",sv_pass"
  2253.                 end
  2254.                 if string.find(access_table[i], ",sv_admin_del,") then
  2255.                         access_table[i] = access_table[i] .. ",sv_revoke"
  2256.                 end
  2257.                 if string.find(access_table[i], ",sv_respawn_time,") then
  2258.                         access_table[i] = access_table[i] .. ",sv_setresp"
  2259.                 end
  2260.                 if string.find(access_table[i], ",sv_teleport_add,") then
  2261.                         access_table[i] = access_table[i] .. ",sv_st"
  2262.                 end
  2263.                 if string.find(access_table[i], ",sv_teleport,") then
  2264.                         access_table[i] = access_table[i] .. ",sv_t"
  2265.                 end
  2266.                 if string.find(access_table[i], ",sv_changeteam,") then
  2267.                         access_table[i] = access_table[i] .. ",sv_ts"
  2268.                 end
  2269.                 if string.find(access_table[i], ",sv_teleport_pl,") then
  2270.                         access_table[i] = access_table[i] .. ",sv_tp"
  2271.                 end
  2272.                 if string.find(access_table[i], ",sv_admin_cur,") then
  2273.                         access_table[i] = access_table[i] .. ",sv_viewadmins"
  2274.                 end
  2275.                 if not access_table or not access_table[i] or not access_table[i]:len() then hprintf("ACCESS.INI IS INCORRECTLY FORMATTED!") return end
  2276.                 if string.sub(access_table[i], access_table[i]:len(), access_table[i]:len()) ~= "," then
  2277.                         access_table[i] = access_table[i] .. ","
  2278.                 end
  2279.         end
  2280. end
  2281.  
  2282. function getobjecttag(m_objectId)
  2283.         local m_object = getobject(m_objectId)
  2284.         local object_map_id = readdword(m_object, 0x0)
  2285.         local map_base = readdword(map_pointer, 0x0)
  2286.         local map_tag_count = todec(endian(map_base, 0xC, 0x3))
  2287.         local tag_table_base = map_base + 0x28
  2288.         local tag_table_size = 0x20
  2289.         for i = 0, (map_tag_count - 1) do
  2290.                 local tag_id = todec(endian(tag_table_base, 0xC + (tag_table_size * i), 0x3))
  2291.                 if tag_id == object_map_id then
  2292.                         local tag_class = readstring(tag_table_base, (tag_table_size * i), 0x3, 1)
  2293.                         local tag_name_address = endian(tag_table_base, 0x10 + (tag_table_size * i), 0x3)
  2294.                         local tag_name = readtagname("0x" .. tag_name_address)
  2295.                         return tag_name,tag_class
  2296.                 end
  2297.         end
  2298. end
  2299.  
  2300. endian = function(address, offset, length)
  2301.  
  2302.         local data_table = {}
  2303.         local data = ""
  2304.  
  2305.         for i=0,length do
  2306.  
  2307.                 local hex = string.format("%X", readbyte(address, offset + i))
  2308.  
  2309.                 if tonumber(hex, 16) < 16 then
  2310.                         hex = 0 .. hex
  2311.                 end
  2312.  
  2313.                 table.insert(data_table, hex)
  2314.  
  2315.         end
  2316.  
  2317.         for k,v in pairs(data_table) do
  2318.                 data = v .. data
  2319.         end
  2320.  
  2321.         return data
  2322.  
  2323. end
  2324.  
  2325. todec = function(number)
  2326.         return tonumber(number, 16)
  2327. end
  2328.  
  2329. DefaultSvTimer = function(id, count, filename)
  2330.  
  2331.         local file = io.open(filename)
  2332.         if file then
  2333.                 for line in file:lines() do
  2334.                         svcmd(tostring(line))
  2335.                 end
  2336.                 file:close()
  2337.                 if filename == "temp_" .. tostring(processid) .. ".tmp" then
  2338.                         os.remove(filename)
  2339.                 end
  2340.         elseif filename == "defaults.txt" then
  2341.                 file = io.open("defaults.txt", "a")
  2342.                 hprintf("Defaults.txt not found. File will be created...")
  2343.                 file:write("sv_deathless 0\n")
  2344.                 file:write("sv_infinite_ammo 0\n")
  2345.                 file:write("sv_respawn_time default\n")
  2346.                 file:write("sv_rtv_enabled true\n")
  2347.                 file:write("sv_rtv_needed 0.6\n")
  2348.                 file:write("sv_votekick_enabled true\n")
  2349.                 file:write("sv_votekick_needed 0.7\n")
  2350.                 file:write("sv_votekick_action kick\n")
  2351.                 file:write("sv_version_check true\n")
  2352.                 file:write("sv_version 1.09\n")
  2353.                 file:write("sv_hash_check true\n")
  2354.                 file:write("sv_falldamage 1")
  2355.                 file:close()
  2356.         end
  2357.  
  2358.         return 0
  2359. end
  2360.  
  2361. getweapon = function(player, weapon)
  2362.  
  2363.         local tag_name_address
  2364.         local tag_name = ""
  2365.         local m_player = getplayer(player)
  2366.         local m_object = getobject(readdword(m_player, 0x34))
  2367.         local weap_id = getobject(readdword(m_object, 0x2F8 + ((weapon - 1) * 4)))
  2368.         local weap_meta_id = readdword(weap_id, 0x0)
  2369.         local map_base = readdword(map_pointer, 0x0)
  2370.         local map_tag_count = todec(endian(map_base, 0xC, 0x3))
  2371.         local tags_base = map_base + 0x28
  2372.         local tags_size = 0x20
  2373.         local tag_address = 0
  2374.  
  2375.         for i=0,(map_tag_count - 1) do
  2376.  
  2377.                 local tag_id = todec(endian(tags_base, 0xC + (tags_size * i), 0x3))
  2378.  
  2379.                 if tag_id == weap_meta_id then
  2380.  
  2381.                         tag_name_address = endian(tags_base, 0x10 + (tags_size * i), 0x3)
  2382.                         tag_name = readtagname("0x" .. tag_name_address)
  2383.                 end
  2384.         end
  2385.  
  2386.         return tag_name
  2387. end
  2388.  
  2389. function OnWeaponAssignment(player, object, count, tag)
  2390.         return 0
  2391. end
  2392.  
  2393. cleanupdrones = function(player)
  2394.         -- pretty hacky way to remove the vehicles, but only way i could get working
  2395.         for k,v in pairs(vehicle_drone_table[player]) do
  2396.                 local seats = getseats(v)
  2397.                 if seats then
  2398.                         for i = 0,seats - 1 do
  2399.                                 entervehicle(player, v, i)
  2400.                                 exitvehicle(player)
  2401.                         end
  2402.                         destroyobject(v)
  2403.                 else
  2404.                         for i = 0,5 do
  2405.                                 entervehicle(player, v, i)
  2406.                                 exitvehicle(player)
  2407.                         end
  2408.                         destroyobject(v)
  2409.                 end
  2410.                 vehicle_drone_table[player][k] = nil
  2411.         end
  2412. end
  2413.  
  2414. getseats = function(m_objectId)
  2415.         local seats
  2416.         local m_object = getobject(m_objectId)
  2417.         local tagname = getobjecttag(m_object)
  2418.         if tagname == "vehicles\\rwarthog\\rwarthog" or tagname == "vehicles\\warthog\\mp_warthog" then
  2419.                 seats = 3
  2420.         elseif tagname == "vehicles\\scorpion\\scorpion_mp" then
  2421.                 seats = 5
  2422.         else
  2423.                 seats = 1
  2424.         end
  2425.         return seats
  2426. end
  2427.  
  2428. cleanupdrone = function(player, objid)
  2429.         for k,v in pairs(vehicle_drone_table[player]) do
  2430.                 if v == objid then
  2431.                         entervehicle(player, v, 0)
  2432.                         exitvehicle(player)
  2433.                         local seats = getseats(v)
  2434.                         if seats then
  2435.                                 for i = 0,seats-1 do
  2436.                                         entervehicle(player, v, i)
  2437.                                         exitvehicle(player)
  2438.                                 end
  2439.                         end
  2440.                         --destroyobject(v) dont destroy, will destroy itself soon
  2441.                         vehicle_drone_table[player][k] = nil
  2442.                         break
  2443.                 end
  2444.         end
  2445. end
  2446.  
  2447. MainTimer = function(id, count)
  2448.  
  2449.  
  2450.         if count % 10 == 0 then
  2451.                 for i = 0,15 do
  2452.  
  2453.                         local hash = gethash(i)
  2454.  
  2455.                         if getplayer(i) then
  2456.                                 if ghost_table[hash] == true then
  2457.                                         applycamo(i, 1)
  2458.                                 elseif ghost_table[hash] and ghost_table[hash] > 0 then
  2459.                                         applycamo(i, ghost_table[hash])
  2460.                                         ghost_table[hash] = ghost_table[hash] - 1
  2461.                                 elseif ghost_table[hash] then
  2462.                                         if ghost_table[hash] <= 0 then
  2463.                                                 ghost_table[hash] = nil
  2464.                                         end
  2465.                                 end
  2466.                         end
  2467.  
  2468.                 end
  2469.         end
  2470.         for i = 0,15 do
  2471.                 local m_player = getplayer(i)
  2472.                 if m_player then
  2473.                         local m_playerObjId = getplayerobjectid(i)
  2474.                         local m_object = getobject(m_playerObjId)
  2475.                         if m_object then
  2476.                                 local id = resolveplayer(i)
  2477.                                 local x_aim = readfloat(m_object, 0x230)
  2478.                                 local y_aim = readfloat(m_object, 0x234)
  2479.                                 local z_aim = readfloat(m_object, 0x238)
  2480.                                 local z = readfloat(m_player, 0x100)
  2481.                                 if afk[id][1] == true then
  2482.                                         afk[id][1] = x_aim
  2483.                                         afk[id][2] = y_aim
  2484.                                         afk[id][3] = z_aim
  2485.                                         --[[local team = readbyte(m_player, 0x20)
  2486.                                         afk[id][4] = team
  2487.                                         writebyte(m_player, 0x20, 16)--]]
  2488.                                         writebit(m_object, 0x10, 7, 1)
  2489.                                 elseif afk[id][1] then
  2490.                                         if x_aim ~= afk[id][1] or y_aim ~= afk[id][2] or z_aim ~= afk[id][3] then
  2491.                                                 writebit(m_object, 0x10, 7, 0)
  2492.                                                 if afk[id][4] then
  2493.                                                         writebyte(m_player, 0x20, afk[id][4])
  2494.                                                         afk[id][4] = nil
  2495.                                                 end
  2496.                                                 afk[id] = {}
  2497.                                                 say(getname(i) .. " is no longer afk!")
  2498.                                         else
  2499.                                                 writefloat(m_player, 0x100, z - 1000)
  2500.                                         end
  2501.                                 elseif hidden[id] then
  2502.                                         writefloat(m_player, 0x100, z - 1000)
  2503.                                 end
  2504.                         end
  2505.                 end
  2506.         end
  2507.  
  2508.         return 1
  2509.  
  2510. end
  2511.  
  2512. SpamTimer = function(id, count)
  2513.  
  2514.         for i=0,15 do
  2515.  
  2516.                 local hash = gethash(i)
  2517.  
  2518.                 if hash then
  2519.  
  2520.                         local name = getname(i)
  2521.  
  2522.                         if spam_table[hash] == nil then
  2523.                                 spam_table[hash] = 0
  2524.                         end
  2525.  
  2526.                         if spam_table[hash] < spam_max then
  2527.                                 if spam_table[hash] > 0 then
  2528.                                         spam_table[hash] = spam_table[hash] - 0.25
  2529.                                 end
  2530.                         else
  2531.                                 say(name .. " has been muted for " .. spam_timeout .. " seconds for spamming!")
  2532.                                 spam_table[hash] = -1
  2533.                         end
  2534.  
  2535.                         if spam_table[hash] == -1 then
  2536.  
  2537.                                 if spamtimeout_table[hash] == nil then
  2538.                                         spamtimeout_table[hash] = spam_timeout
  2539.                                 else
  2540.                                         spamtimeout_table[hash] = spamtimeout_table[hash] - 1
  2541.                                 end
  2542.  
  2543.                                 if spamtimeout_table[hash] == 0 then
  2544.                                         say(name .. " has been unmuted!")
  2545.                                         spamtimeout_table[hash] = nil
  2546.                                         spam_table[hash] = 0
  2547.                                 end
  2548.  
  2549.                         end
  2550.  
  2551.                 end
  2552.  
  2553.         end
  2554.  
  2555.         return 1
  2556.  
  2557. end
  2558.  
  2559. rtvTimer = function(id, count)
  2560.  
  2561.         if count == 1 then
  2562.                 rtv_initiated = rtv_timeout
  2563.                 rtv_table = {}
  2564.                 say("The current rtv has expired!")
  2565.                 return 0
  2566.         else
  2567.                 return 1
  2568.         end
  2569.  
  2570. end
  2571.  
  2572. votekickTimer = function(id, count, userdata)
  2573.  
  2574.         if count == 1 then
  2575.  
  2576.                 local name = getname(userdata)
  2577.                 votekick_allowed = true
  2578.                 say("The votekick on " .. name .. " has expired!")
  2579.  
  2580.                 for k,v in pairs(votekick_table) do
  2581.                         votekick_table[k] = nil
  2582.                 end
  2583.  
  2584.                 return 0
  2585.         else
  2586.                 return 1
  2587.         end
  2588.  
  2589. end
  2590.  
  2591. lo3Timer = function(id, count)
  2592.         if count >= 3 then
  2593.                 say("Start your match!")
  2594.                 svcmd("sv_map_reset")
  2595.                 return 0
  2596.         else
  2597.                 svcmd("sv_map_reset")
  2598.                 return 1
  2599.         end
  2600. end
  2601.  
  2602. readtagname = function(address)
  2603.  
  2604.         local char_table = {}
  2605.         local i = 0
  2606.         local string = ""
  2607.  
  2608.         while readbyte(address, i) ~= 0 do
  2609.                 table.insert(char_table, string.char(readbyte(address, i)))
  2610.                 i = i + 1
  2611.         end
  2612.  
  2613.         for k,v in pairs(char_table) do
  2614.                 string = string .. v
  2615.         end
  2616.  
  2617.         return string
  2618.  
  2619. end
  2620.  
  2621. readstring = function(address, offset, length, endian)
  2622.         local char_table = {}
  2623.         local string = ""
  2624.  
  2625.         local offset = offset or 0x0
  2626.  
  2627.         if length == nil then
  2628.                 if readbyte(address, offset + 1) == 0 and readbyte(address, offset) ~= 0 then
  2629.                         length = 51000
  2630.                 else
  2631.                         length = 256
  2632.                 end
  2633.         end
  2634.  
  2635.         for i=0,length do
  2636.                 if readbyte(address, (offset + i)) ~= 0 then
  2637.                         table.insert(char_table, string.char(readbyte(address, (offset + i))))
  2638.                 elseif i % 2 == 0 and readbyte(address, offset + i) == 0 then
  2639.                         break
  2640.                 end
  2641.         end
  2642.  
  2643.         for k,v in pairs(char_table) do
  2644.                 if endian == 1 then
  2645.                         string = v .. string
  2646.                 else
  2647.                         string = string .. v
  2648.                 end
  2649.         end
  2650.  
  2651.         return string
  2652.  
  2653. end
  2654.  
  2655. writestring = function(string, address, offset, spacing, endian)
  2656.  
  2657.         local char_table = {}
  2658.  
  2659.         offset = offset or 0x0
  2660.  
  2661.         address = address + offset
  2662.  
  2663.         spacing = spacing or 0x1
  2664.  
  2665.         for word in string:gmatch(".") do
  2666.                 table.insert(char_table, string.byte(word))
  2667.         end
  2668.  
  2669.         local length = table.getn(char_table)
  2670.  
  2671.         if endian == 1 then
  2672.                 for i=0,length do
  2673.                         writebyte(address, spacing * i, char_table[length - i])
  2674.                 end
  2675.         else
  2676.                 for i=0,length do
  2677.                         writebyte(address, spacing * i, char_table[i + 1])
  2678.                 end
  2679.         end
  2680. end
  2681.  
  2682. nadeTimer = function(id, count)
  2683.         for c = 0,15 do
  2684.                 if getplayer(c) then
  2685.                         local m_object = getobject(getplayerobjectid(c))
  2686.                         if m_object then
  2687.                                 writebyte(m_object, 0x31E, 3) -- set frags to 3
  2688.                                 writebyte(m_object, 0x31F, 3) -- set plasmas to 3
  2689.                         end
  2690.                 end
  2691.         end
  2692.         if infammo then
  2693.                 return 1
  2694.         elseif infammo then
  2695.                 return 0
  2696.         end
  2697. end
  2698.  
  2699. settimelimit = function(value)
  2700.         if tonumber(value) then
  2701.                 writedword(timelimit_address, 0x0, tonumber(value))
  2702.                 local time_passed = readdword(readdword(gametime_base, 0x0), 0xC)
  2703.                 writedword(gametype_base, 0x78, 30*60*value + time_passed) -- set game timer to the specified value (in minutes) + the amount of time passed (+ one second for testing purposes)
  2704.         end
  2705. end
  2706.  
  2707. --[[getname = function(player)
  2708.         player = tonumber(player)
  2709.         local m_player = getplayer(player)
  2710.         if m_player then
  2711.                 local player_name = readstring(m_player, 0x4, 11)
  2712.                 local player_name2 = readstring(m_player, 0x48, 11)
  2713.                 local player_name3 = tostring(readstring(name_base, 0x20 * player, 0x14))
  2714.                 return player_name3
  2715.         end
  2716. end
  2717.  
  2718.  
  2719. resolveplayer = function(player)
  2720.  
  2721.         player = tonumber(player)
  2722.         local m_player = getplayer(player)
  2723.         if m_player then
  2724.                 local player_rcon_id = readbyte(m_player, 0x64) + 1
  2725.                 if player_rcon_id > 0 and player_rcon_id < 17 then
  2726.                         return player_rcon_id
  2727.                 end
  2728.         end
  2729. end
  2730.  
  2731. readbit = function(address, offset, bit)
  2732.         local value = readbyte(address, offset)
  2733.         local binary_val = tobinary(value)
  2734.         local ret_bit = string.sub(binary_val, bit)
  2735.         return tonumber(ret_bit, 2)
  2736. end
  2737.  
  2738. writebit = function(address, offset, bit, value)
  2739.         local val = readbyte(address, offset)
  2740.         local binary_val = tobinary(val)
  2741.         if bit == 7 then
  2742.                 byte = string.sub(binary_val, 1, 7) .. value
  2743.         elseif bit == 0 then
  2744.                 byte = value .. string.sub(binary_val, 2, 8)
  2745.         else
  2746.                 byte = string.sub(binary_val, 1, bit) .. value .. string.sub(binary_val, bit+1, 8)
  2747.         end
  2748.         byte = tonumber(byte, 2)
  2749.         writebyte(address, offset, byte)
  2750. end
  2751.  
  2752. tobinary = function(number)
  2753.         number = tonumber(number)
  2754.         if number == nil then return end
  2755.         binary = ""
  2756.         while (number > 0) do
  2757.                 binary = binary .. math.floor(number % 2)
  2758.                 number = number / 2
  2759.         end
  2760.         return binary
  2761. end
  2762.  
  2763. tofloat = function(number)
  2764.         local sign = 1
  2765.         if number == nil then return end
  2766.         local mantissa = string.byte(number, 3) % 128
  2767.         for i = 2, 1, -1 do
  2768.                 mantissa = mantissa * 256 + string.byte(number, i)
  2769.         end
  2770.         if string.byte(number, 4) > 127 then
  2771.                 sign = -1
  2772.         end
  2773.         local exponent = (string.byte(number, 4) % 128) * 2 + math.floor(string.byte(number, 3) / 128)
  2774.         if exponent == 0 then return 0 end
  2775.         mantissa = (mantissa * (2 ^ -23) + 1) * sign
  2776.         return mantissa * 2^(exponent - 127)
  2777. end
  2778.  
  2779. readfloat = function(address, offset)
  2780.         if address then
  2781.                 local a = readbyte(address, 0x0 + offset)
  2782.                 local b = readbyte(address, 0x1 + offset)
  2783.                 local c = readbyte(address, 0x2 + offset)
  2784.                 local d = readbyte(address, 0x3 + offset)
  2785.                 local val = string.char(a, b, c, d)
  2786.                 local float = tofloat(val)
  2787.                 return float
  2788.         end
  2789. end
  2790.  
  2791. readdword = function(address, offset)
  2792.         if address then
  2793.                 local a = readbyte(offset + address, 0x3)
  2794.                 local b = readbyte(offset + address, 0x2)
  2795.                 local c = readbyte(offset + address, 0x1)
  2796.                 local d = readbyte(offset + address, 0x0)
  2797.                 local dword = string.format("%02X%02X%02X%02X", a, b, c, d)
  2798.                 dword = tonumber(dword, 16)
  2799.                 return dword
  2800.         end
  2801. end
  2802.  
  2803. readword = function(address, offset)
  2804.         local a = readbyte(offset + address, 0x1)
  2805.         local b = readbyte(offset + address, 0x0)
  2806.         local word = string.format("%02X%02X", a, b)
  2807.         word = tonumber(word, 16)
  2808.         return word
  2809. end
  2810.  
  2811. rresolveplayer = function(player)
  2812.         player = tonumber(player)
  2813.         for i = 0,15 do
  2814.                 local m_player = getplayer(i)
  2815.                 if m_player then
  2816.                         local player_rcon_id =  readbyte(m_player, 0x64) + 1
  2817.                         if player_rcon_id == player then
  2818.                                 return i
  2819.                         end
  2820.                 end
  2821.         end
  2822. end--]]
  2823.  
  2824. Gethash = function(player)
  2825.         local player_table = readdword(0x69B91C, 0x0)
  2826.         local hashbase_offset = 0x3C4
  2827.         local hashbase = readdword(player_table, hashbase_offset)
  2828.         local bool = false
  2829.         for i = 1,16 do
  2830.                 local temp = readword(hashbase, 0x0)
  2831.                 if temp ~= resolveplayer(player) - 1 then
  2832.                         hashbase = hashbase + 0x60
  2833.                 else
  2834.                         bool = true
  2835.                 end
  2836.                 if bool == true then
  2837.                         hash_pointer = player_table + ((i*3) + 0x3BD)
  2838.                         break
  2839.                 end
  2840.         end
  2841.         if hash_pointer then
  2842.                 local player_dword = player * 2 + player
  2843.                 for i = 1,5 do
  2844.                         player_dword = player_dword * 2
  2845.                 end
  2846.                 local ECX = player_table + player_dword + 0x3B8
  2847.                 if ECX == 0 then return end
  2848.                 local EDI = readdword(ECX, 0x0)
  2849.                 if readdword(EDI+0xA98) ~= 1 then
  2850.                         if EDI == 0 then
  2851.                                 hprintf("EDI IS 0")
  2852.                                 return
  2853.                         end
  2854.                 end
  2855.                 hprintf("SUCCESS: " .. tostring(readdword(EDI+0xA98)))
  2856.         end
  2857.         return "BLAH"
  2858. end
  2859.  
  2860. getmachinestruct = function(player)
  2861.         local m_player = getplayer(player)
  2862.         if m_player then
  2863.                 local machine_index = readbyte(m_player, 0x64)
  2864.                 local machine_base = readdword(machine_pointer, 0x0)
  2865.                 local table = machine_base + 0xAA0
  2866.                 local machine_struct = readdword(table + machine_index*4, 0x0)
  2867.                 return machine_struct
  2868.         end
  2869. end
  2870.  
  2871. getip = function(player)
  2872.         if ip_table[resolveplayer(player)] then return ip_table[resolveplayer(player)] end
  2873.         local m_player = getplayer(player)
  2874.         local IP_Address = ""
  2875.         if m_player then
  2876.                 local machine_struct = getmachinestruct(player)
  2877.                 local machine_network = readdword(readdword(machine_struct, 0x0), 0x0)
  2878.                 local a = readbyte(machine_network, 0)
  2879.                 local b = readbyte(machine_network, 1)
  2880.                 local c = readbyte(machine_network, 2)
  2881.                 local d = readbyte(machine_network, 3)
  2882.                 if b then
  2883.                         IP_Address = string.format("%i.%i.%i.%i", a, b, c, d)
  2884.                 end
  2885.         end
  2886.         return IP_Address
  2887. end
  2888.  
  2889. Stickman = function(id, count)
  2890.         if count == 1 then
  2891.                 hprintf("    _._    ")
  2892.                 hprintf("   / O \\   ")
  2893.                 hprintf("   \| |/   ")
  2894.                 hprintf("O--+=-=+--O")
  2895.         elseif count == 2 then
  2896.                 svcmd("cls")
  2897.                 hprintf("   ,-O-,   ")
  2898.                 hprintf("O--=---=--O")
  2899.                 hprintf("    2-2    ")
  2900.                 hprintf("    - -    ")
  2901.         elseif count == 3 then
  2902.                 svcmd("cls")
  2903.                 hprintf("   ,_O_,   ")
  2904.                 hprintf("O--(---)--O")
  2905.                 hprintf("    >'>    ")
  2906.                 hprintf("    - -    ")
  2907.         elseif count == 4 then
  2908.                 svcmd("cls")
  2909.                 hprintf("   ._O_.   ")
  2910.                 hprintf("O--<-+->--O")
  2911.                 hprintf("     X     ")
  2912.                 hprintf("    / \\    ")
  2913.                 hprintf("   -   -   ")
  2914.         elseif count == 5 then
  2915.                 svcmd("cls")
  2916.                 hprintf("O--=-O-=--O")
  2917.                 hprintf("    '-'    ")
  2918.                 hprintf("     v     ")
  2919.                 hprintf("    / )    ")
  2920.                 hprintf("   ~  z    ")
  2921.         elseif count == 6 then
  2922.                 svcmd("cls")
  2923.                 hprintf("O--,---,--O")
  2924.                 hprintf("   \\ O /   ")
  2925.                 hprintf("    - -    ")
  2926.                 hprintf("     -     ")
  2927.                 hprintf("    / \    ")
  2928.                 hprintf("   =   =   ")
  2929.         elseif count == 7 then
  2930.                 svcmd("cls")
  2931.                 hprintf("O--=-O-=--O")
  2932.                 hprintf("    '-'    ")
  2933.                 hprintf("     v     ")
  2934.                 hprintf("    / )    ")
  2935.                 hprintf("   ~  z    ")
  2936.         elseif count == 8 then
  2937.                 svcmd("cls")
  2938.                 hprintf("   ._O_.   ")
  2939.                 hprintf("O--<-+->--O")
  2940.                 hprintf("     X     ")
  2941.                 hprintf("    / \\    ")
  2942.                 hprintf("   -   -   ")
  2943.         elseif count == 9 then
  2944.                 svcmd("cls")
  2945.                 hprintf("   ,_O_,   ")
  2946.                 hprintf("O--(---)--O")
  2947.                 hprintf("    >'>    ")
  2948.                 hprintf("    - -    ")
  2949.         elseif count == 10 then
  2950.                 svcmd("cls")
  2951.                 hprintf("   ,-O-,   ")
  2952.                 hprintf("O--=---=--O")
  2953.                 hprintf("    2-2    ")
  2954.                 hprintf("    - -    ")
  2955.         elseif count == 11 then
  2956.                 svcmd("cls")
  2957.                 hprintf("    _._    ")
  2958.                 hprintf("   / O \\   ")
  2959.                 hprintf("   \\| |/   ")
  2960.                 hprintf("O--+=-=+--O")
  2961.         elseif count >= 12 then
  2962.                 svcmd("cls")
  2963.                 return 0
  2964.         end
  2965.         return 1
  2966. end
  2967.  
  2968. resetweapons = function(player)
  2969.         local m_player = getplayer(player)
  2970.         local m_object = getobject(readdword(m_player, 0x34))
  2971.         if m_object then
  2972.                 if getobject(readdword(m_object, 0x118)) then return end
  2973.                 local x = readfloat(m_object, 0x5C)
  2974.                 local y = readfloat(m_object, 0x60)
  2975.                 local z = readfloat(m_object, 0x64)
  2976.                 objId = createobject("weap", "weapons\\pistol\\pistol", 0, 60, false, x+1.0, y, z + 2.0)
  2977.                 assignweapon(player, objId)
  2978.                 objId = createobject("weap", "weapons\\assault rifle\\assault rifle", 0, 60, false, x+1.0, y, z + 2.0)
  2979.                 assignweapon(player, objId)
  2980.         end
  2981. end
  2982.  
  2983. portalgunTimer = function(id, count, player_owner, m_object)
  2984.         if count == 500 then
  2985.                 return 0
  2986.         end
  2987.         local m_player = getplayer(player_owner)
  2988.         if m_player and m_object then
  2989.                 local obj_x_velocity = readfloat(m_object, 0x68)
  2990.                 local m_playerObjId = readdword(m_player, 0x34)
  2991.                 if obj_x_velocity == 0 then
  2992.                         local x = readfloat(m_object, 0x5C)
  2993.                         local y = readfloat(m_object, 0x60)
  2994.                         local z = readfloat(m_object, 0x64)
  2995.                         movobjcoords(m_playerObjId, x, y, z)
  2996.                         return 0
  2997.                 else
  2998.                         return 1
  2999.                 end
  3000.         end
  3001.         return 1
  3002. end
  3003.  
  3004. spawngunTimer = function(id, count, player_owner, m_object)
  3005.         local m_player = getplayer(player_owner)
  3006.         if m_player and m_object then
  3007.                 local x = readfloat(m_object, 0x5C)
  3008.                 local y = readfloat(m_object, 0x60)
  3009.                 local z = readfloat(m_object, 0x64)
  3010.                 createobject(objspawntype[gethash(player_owner)], objspawntag[gethash(player_owner)], 0, 60, false, x, y, z)
  3011.         end
  3012.         return 0
  3013. end
  3014.  
  3015. getvalidplayers = function(expression, player)
  3016.  
  3017.         if cur_players ~= 0 then
  3018.  
  3019.                 local players = {}
  3020.                 if expression == "*" then
  3021.                         for i = 0,15 do
  3022.                                 if getplayer(i) then
  3023.                                         table.insert(players, i)
  3024.                                 end
  3025.                         end
  3026.                 elseif expression == "me" then
  3027.                         if player ~= 0xFFFFFFFF and player ~= -1 and player then
  3028.                                 table.insert(players, player)
  3029.                         end
  3030.                 elseif string.sub(expression, 1, 3) == "red" then
  3031.                         for i = 0,15 do
  3032.                                 if getplayer(i) then
  3033.                                         local player_team = readdword(getplayer(i), 0x20)
  3034.                                         if player_team == 0 then
  3035.                                                 table.insert(players, i)
  3036.                                         end
  3037.                                 end
  3038.                         end
  3039.                 elseif string.sub(expression, 1, 4) == "blue" then
  3040.                         for i = 0,15 do
  3041.                                 if getplayer(i) then
  3042.                                         local player_team = readdword(getplayer(i), 0x20)
  3043.                                         if player_team == 1 then
  3044.                                                 table.insert(players, i)
  3045.                                         end
  3046.                                 end
  3047.                         end
  3048.                 elseif expression == "1" or expression == "2" or expression == "3" or expression == "4" or expression == "5" or expression == "6" or expression == "7" or expression == "8" or expression == "9" or expression == "10" or expression == "11" or expression == "12" or expression == "13" or expression == "14" or expression == "15" or expression == "16" then
  3049.                         if tonumber(expression) then
  3050.                                 local expression = tonumber(expression)
  3051.                                 if rresolveplayer(expression) then
  3052.                                         table.insert(players, rresolveplayer(expression))
  3053.                                 end
  3054.                         end
  3055.                 elseif expression == "random" then
  3056.                         if cur_players == 1 and player ~= 0xFFFFFFFF then table.insert(players, player) return players end
  3057.                         local bool = false
  3058.                         while not bool do
  3059.                                 num = math.random(0, 15)
  3060.                                 if getplayer(num) and num ~= player then
  3061.                                         bool = true
  3062.                                 end
  3063.                         end
  3064.                         table.insert(players, num)
  3065.                 else
  3066.                         for i = 0,15 do
  3067.                                 if getplayer(i) then
  3068.                                         if string.wild(getname(i), expression) == true then
  3069.                                                 table.insert(players, i)
  3070.                                         end
  3071.                                 end
  3072.                         end
  3073.                 end
  3074.  
  3075.                 if players[1] then
  3076.                         return players
  3077.                 end
  3078.         end
  3079.  
  3080.         return false
  3081.  
  3082. end
  3083.  
  3084. function pack(...)
  3085.         return arg
  3086. end
  3087.  
  3088. function string.wild(match, wild, case_sensative)
  3089.  
  3090.         if not case_sensative then
  3091.                 match, wild = string.lower(match), string.lower(wild)
  3092.         end
  3093.  
  3094.         -- Initial Checks
  3095.         if string.sub(wild, 1, 1) == "?" then wild = string.gsub(wild, "?", string.sub(match, 1, 1), 1) end
  3096.         if string.sub(wild, string.len(wild), string.len(wild)) == "?" then wild = string.gsub(wild, "?", string.sub(match, string.len(match), string.len(match)), 1) end
  3097.         if not string.find(wild, "*") and not string.find(wild, "?") and wild ~= match then return false end
  3098.         if string.sub(wild, 1, 1) ~= string.sub(match, 1, 1) and string.sub(wild, 1, 1) ~= "*" then return false end
  3099.         if string.sub(wild, string.len(wild), string.len(wild)) ~= string.sub(match, string.len(match), string.len(match)) and string.sub(wild, string.len(wild), string.len(wild)) ~= "*" then return false end
  3100.  
  3101.         local substrings = string.split(wild, "*")
  3102.         local begin = 1
  3103.  
  3104.         for k,v in ipairs(substrings) do
  3105.  
  3106.                 local sublength = string.len(v)
  3107.                 local temp_begin = begin
  3108.                 local temp_end = begin + sublength - 1
  3109.                 local matchsub = string.sub(match, begin, temp_end)
  3110.                 local bool
  3111.  
  3112.                 repeat
  3113.                         local wild = v
  3114.                         local indexes = pack(string.findchar(wild, "?"))
  3115.                         if #indexes > 0 then
  3116.                                 for _,i in ipairs(indexes) do
  3117.                                         wild = string.gsub(wild, "?", string.sub(matchsub, i, i), 1)
  3118.                                 end
  3119.                         end
  3120.                         if matchsub == wild then
  3121.                                 bool = true
  3122.                                 break
  3123.                         end
  3124.                         matchsub = string.sub(match, temp_begin, temp_end)
  3125.                         temp_begin = temp_begin + 1
  3126.                         temp_end = temp_end + 1
  3127.  
  3128.                 until temp_end >= string.len(match)
  3129.  
  3130.                 if not bool then
  3131.                         return false
  3132.                 end
  3133.  
  3134.                 begin = sublength + 1
  3135.         end
  3136.  
  3137.         return true
  3138. end
  3139.  
  3140. function string.findchar(str, char)
  3141.  
  3142.         local chars = string.split(str, "")
  3143.         local indexes = {}
  3144.         for k,v in ipairs(chars) do
  3145.                 if v == char then
  3146.                         table.insert(indexes, k)
  3147.                 end
  3148.         end
  3149.  
  3150.         return unpack(indexes)
  3151. end
  3152.  
  3153. delayMsg = function(id, count, msg, command, player)
  3154.         command = tostring(command)
  3155.         if string.sub(command, 1, 1) == "/" then
  3156.                 say(msg)
  3157.         elseif string.sub(command, 1, 1) == "\\" then
  3158.                 privatesay(player, msg)
  3159.         elseif player ~= 0xFFFFFFFF and player ~= -1 then
  3160.                 hprintf(msg, player)
  3161.         else
  3162.                 hprintf(msg)
  3163.         end
  3164.         return 0
  3165. end
  3166.  
  3167. sendresponse = function(message, command, player, log)
  3168.         if message == "" then
  3169.                 return
  3170.         end
  3171.         player = tonumber(player)
  3172.         if string.sub(command, 1, 1) == "/" then
  3173.                 registertimer(0, "delayMsg", message, command, player)
  3174.         elseif string.sub(command, 1, 1) == "\\" then
  3175.                 registertimer(0, "delayMsg", message, command, player)
  3176.         elseif tonumber(player) and player ~= 0xFFFFFFFF and player ~= -1 and player >= 0 and player < 16 then
  3177.                 hprintf(message, player)
  3178.         else
  3179.                 hprintf(message)
  3180.         end
  3181.         if not log and player ~= 0xFFFFFFFF and player ~= -1 and player then
  3182.                 WriteLog(profilepath .. "\\logs\\commands.log", "Response to " .. getname(player) .. ": " .. message)
  3183.         end
  3184. end
  3185.  
  3186. messages = {}
  3187.  
  3188. function hprint(player, message, time)
  3189.  
  3190.         time = time or 5
  3191.         local hash = gethash(player)
  3192.         if hash then
  3193.                 if string.len(message) > 75 then
  3194.                         message = wordwrap(message, 75, true)
  3195.                 end
  3196.                 table.insert(messages[hash], {["message"] = message, ["time"] = time})
  3197.         end
  3198. end
  3199.  
  3200. function setscorelimit(player, score)
  3201.         if tonumber(score) then
  3202.                 if gametype == 1 then -- CTF
  3203.                         if score >= 255 then
  3204.                                 writedword(gametype_base, 0x58, 255)
  3205.                         elseif score < 1 then
  3206.                                 writewordsigned(gametype_base, 0x58, 1)
  3207.                         else
  3208.                                 writewordsigned(gametype_base, 0x58, score)
  3209.                         end
  3210.                 elseif gametype == 2 then -- Slayer
  3211.                         if score >= 0x7FFFFFFF then
  3212.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, 0x7FFFFFFF)
  3213.                         elseif score <= -0x7FFFFFFF then
  3214.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, -0x7FFFFFFF)
  3215.                         else
  3216.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, score)
  3217.                         end
  3218.                 elseif gametype == 3 then -- Oddball
  3219.                         local oddball_game = readbyte(gametype_base, 0x8C)
  3220.                         if oddball_game == 0 or oddball_game == 1 then
  3221.                                 if score * 30 >= 0x7FFFFFFF then
  3222.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFFFF)
  3223.                                 elseif score * 30 <= -0x7FFFFFFF then
  3224.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -1 * 0x7FFFFFFF)
  3225.                                 else
  3226.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score * 30)
  3227.                                 end
  3228.                         else
  3229.                                 if score > 0x7FFFFC17 then
  3230.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFC17)
  3231.                                 elseif score <= -0x7FFFFC17 then
  3232.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -0x7FFFFC17)
  3233.                                 else
  3234.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score)
  3235.                                 end
  3236.                         end
  3237.                 elseif gametype == 4 then -- KOTH
  3238.                         local m_player = getplayer(player)
  3239.                         if score * 30 >= 0x7FFF then
  3240.                                 writewordsigned(m_player, 0xC4, 0x7FFF)
  3241.                         elseif score * 30 <= -0x7FFF then
  3242.                                 writewordsigned(m_player, 0xC4, -0x7FFF)
  3243.                         else
  3244.                                 writewordsigned(m_player, 0xC4, score * 30)
  3245.                         end
  3246.                 elseif gametype == 5 then -- Race
  3247.                         local m_player = getplayer(player)
  3248.                         if score >= 0x7FFF then
  3249.                                 writewordsigned(m_player + 0xC6, 0x0, 0x7FFF)
  3250.                         elseif score <= -0x7FFF then
  3251.                                 writewordsigned(m_player + 0xC6, 0x0, -0x7FFF)
  3252.                         else
  3253.                                 writewordsigned(m_player + 0xC6, 0x0, score)
  3254.                         end
  3255.                 end
  3256.         end
  3257. end
  3258.  
  3259. function setscore(player, score)
  3260.         if tonumber(score) then
  3261.                 if gametype == 1 then -- CTF
  3262.                         local m_player = getplayer(player)
  3263.                         if score >= 0x7FFF then
  3264.                                 writewordsigned(m_player+0xC8, 0x0, 0x7FFF)
  3265.                         elseif score <= -0x7FFF then
  3266.                                 writewordsigned(m_player+0xC8, 0x0, -0x7FFF)
  3267.                         else
  3268.                                 writewordsigned(m_player+0xC8, 0x0, score)
  3269.                         end
  3270.                 elseif gametype == 2 then -- Slayer
  3271.                         if score >= 0x7FFFFFFF then
  3272.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, 0x7FFFFFFF)
  3273.                         elseif score <= -0x7FFFFFFF then
  3274.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, -0x7FFFFFFF)
  3275.                         else
  3276.                                 writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, score)
  3277.                         end
  3278.                 elseif gametype == 3 then -- Oddball
  3279.                         local oddball_game = readbyte(gametype_base, 0x8C)
  3280.                         if oddball_game == 0 or oddball_game == 1 then
  3281.                                 if score * 30 >= 0x7FFFFFFF then
  3282.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFFFF)
  3283.                                 elseif score * 30 <= -0x7FFFFFFF then
  3284.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -1 * 0x7FFFFFFF)
  3285.                                 else
  3286.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score * 30)
  3287.                                 end
  3288.                         else
  3289.                                 if score > 0x7FFFFC17 then
  3290.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFC17)
  3291.                                 elseif score <= -0x7FFFFC17 then
  3292.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -0x7FFFFC17)
  3293.                                 else
  3294.                                         writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score)
  3295.                                 end
  3296.                         end
  3297.                 elseif gametype == 4 then -- KOTH
  3298.                         local m_player = getplayer(player)
  3299.                         if score * 30 >= 0x7FFF then
  3300.                                 writewordsigned(m_player, 0xC4, 0x7FFF)
  3301.                         elseif score * 30 <= -0x7FFF then
  3302.                                 writewordsigned(m_player, 0xC4, -0x7FFF)
  3303.                         else
  3304.                                 writewordsigned(m_player, 0xC4, score * 30)
  3305.                         end
  3306.                 elseif gametype == 5 then -- Race
  3307.                         local m_player = getplayer(player)
  3308.                         if score >= 0x7FFF then
  3309.                                 writewordsigned(m_player + 0xC6, 0x0, 0x7FFF)
  3310.                         elseif score <= -0x7FFF then
  3311.                                 writewordsigned(m_player + 0xC6, 0x0, -0x7FFF)
  3312.                         else
  3313.                                 writewordsigned(m_player + 0xC6, 0x0, score)
  3314.                         end
  3315.                 end
  3316.         end
  3317. end
  3318.  
  3319. function writewordsigned(address, offset, word)
  3320.         value = tonumber(word)
  3321.         if value == nil then value = tonumber(word, 16) end
  3322.         if value and value > 0x7FFF then
  3323.                 local max = 0xFFFF
  3324.                 local difference = max - value
  3325.                 value = -1 - difference
  3326.         end
  3327.         writeword(address, offset, value)
  3328. end
  3329.  
  3330. function writedwordsigned(address, offset, dword)
  3331.         value = tonumber(dword)
  3332.         if value == nil then value = tonumber(dword, 16) end
  3333.         if value and value > 0x7FFFFFFF then
  3334.                 local max = 0xFFFFFFFF
  3335.                 local difference = max - value
  3336.                 value = -1 - difference
  3337.         end
  3338.         writedword(address, offset, value)
  3339. end
  3340.  
  3341. function HprintTimer(id, count)
  3342.  
  3343.         if messages ~= {} then
  3344.                 for k,v in pairs(messages) do
  3345.                         if messages[k] ~= {} then
  3346.                                 for key,value in ipairs(messages[k]) do
  3347.                                         messages[k][key].time = messages[k][key].time - 0.334
  3348.                                         if messages[k][key].time < 0 then
  3349.                                                 table.remove(messages[k], key)
  3350.                                         end
  3351.                                 end
  3352.                         end
  3353.                 end
  3354.  
  3355.                 for k,v in pairs(messages) do
  3356.                         if #messages[k] > 0 then
  3357.                                 local player = hashtoplayer(k)
  3358.                                 for i = 1, 30 do
  3359.                                         hprintf(" ", player)
  3360.                                 end
  3361.                                 for key,value in ipairs(messages[k]) do
  3362.                                         hprintf(messages[k][key].message, player)
  3363.                                 end
  3364.                         end
  3365.                 end
  3366.         end
  3367.  
  3368.         return 1
  3369. end
  3370.  
  3371. function wordwrap(str, linelength, tabbed)
  3372.  
  3373.         local newstr = ""
  3374.         local count = 0
  3375.         local space_index = 0
  3376.         local begin = 1
  3377.  
  3378.         for i = 1, string.len(str) do
  3379.                 local sub = string.sub(str, i, i)
  3380.                 if sub == " " then
  3381.                         space_index = i
  3382.                 end
  3383.                 count = count + 1
  3384.                 if count == linelength then
  3385.                         newstr = newstr .. string.sub(str, begin, space_index) .. "\n"
  3386.                         begin = space_index + 1
  3387.                         count = 0
  3388.                         if tabbed then
  3389.                                 repeat
  3390.                                         newstr = newstr .. " "
  3391.                                         count = count + 1
  3392.                                 until count == math.floor(1 + linelength / 10)
  3393.                         end
  3394.                 end
  3395.  
  3396.                 if i == string.len(str) then
  3397.                         newstr = newstr .. string.sub(str, begin, string.len(str))
  3398.                         break
  3399.                 end
  3400.         end
  3401.  
  3402.         return newstr
  3403. end
  3404.  
  3405. -- String functions
  3406.  
  3407. function string.split(str, ...)
  3408.  
  3409.         local subs = {}
  3410.         local sub = ""
  3411.         local i = 1
  3412.  
  3413.         for _,v in ipairs(arg) do
  3414.                 if v == "" then
  3415.                         for x = 1, string.len(str) do
  3416.                                 table.insert(subs, string.sub(str, x, x))
  3417.                         end
  3418.  
  3419.                         return subs
  3420.                 end
  3421.         end
  3422.  
  3423.         for _,v in ipairs(arg) do
  3424.                 if string.sub(str, 1, 1) == v then
  3425.                         table.insert(subs, "")
  3426.                         break
  3427.                 end
  3428.         end
  3429.  
  3430.         while i <= string.len(str) do
  3431.  
  3432.                 local bool, bool2
  3433.  
  3434.                 for x = 1, #arg do
  3435.                         if arg[x] ~= "" then
  3436.                                 local length = string.len(arg[x])
  3437.                                 if string.sub(str, i, i + (length - 1)) == arg[x] then
  3438.                                         if i == string.len(str) then
  3439.                                                 bool2 = true
  3440.                                         else
  3441.                                                 bool = true
  3442.                                         end
  3443.  
  3444.                                         i = i + (length - 1)
  3445.                                         break
  3446.                                 end
  3447.                         else
  3448.                                 for q = 1, string.len(str) do
  3449.                                         subs = {}
  3450.                                         table.insert(subs, string.sub(str, q, q))
  3451.                                         i = string.len(str)
  3452.                                         break
  3453.                                 end
  3454.                         end
  3455.                 end
  3456.  
  3457.                 if not bool then
  3458.                         sub = sub .. string.sub(str, i, i)
  3459.                 end
  3460.  
  3461.                 if bool or i == string.len(str) then
  3462.                         if sub ~= "" then
  3463.                                 table.insert(subs, sub)
  3464.                                 sub = ""
  3465.                         end
  3466.                 end
  3467.  
  3468.                 if bool2 then
  3469.                         table.insert(subs, "")
  3470.                 end
  3471.  
  3472.                 i = i + 1
  3473.         end
  3474.  
  3475.         for k,v in ipairs(subs) do
  3476.                 for _,d in ipairs(arg) do
  3477.                         subs[k] = string.gsub(v, d, "")
  3478.                 end
  3479.         end
  3480.  
  3481.         return subs
  3482. end
  3483.  
  3484. -- Misc
  3485.  
  3486. function hashtoplayer(hash)
  3487.  
  3488.         for i = 0, 15 do
  3489.                 if gethash(i) == hash then return i end
  3490.         end
  3491. end
  3492.  
  3493. WriteChangeLog = function()
  3494.         local file = io.open("changelog.txt", "w")
  3495.         file:write("Changelog for Commands Script\n")
  3496.         file:write("\n")
  3497.         file:write("1.0\n")
  3498.         file:write("First Official Release (january or something)\n")
  3499.         file:write("-----------------------------------------------------------------------------------------------------------------\n")
  3500.         file:write("April 22, 2012\n")
  3501.         file:write("Commands Version 2.0\n")
  3502.         file:write("This is pretty much a rewrite of the entire script. So many new features were added. So many that I don't even want to make this changelog. Anyway, I'm forcing myself to make it. So here it is:\n")
  3503.         file:write("--Fixed /setname, it will change your name, but for others to see it it requires a rejoin.\n")
  3504.         file:write("--Added /os, this will give you an Overshield (syntax is /os [player])\n")
  3505.         file:write("--Fixed the admin system, before you had to do sv_reloadscripts after you added someone, that's been fixed.\n")
  3506.         file:write("--Added sv_revoke and /revoke. The syntax is /revoke [player]. This will take away someone's admin who is currently in the server.\n")
  3507.         file:write("--Added a command to view all admins on the server, syntax is: /a list\n")
  3508.         file:write("--Added a command to view the current admins in the server. Syntax is: /viewadmins\n")
  3509.         file:write("--Added a command to view the server specs (processor speed, model name, manufacturer). Syntax is /specs, or sv_specs in console\n")
  3510.         file:write("--Added another player expression. Now you are able to use 'random' as a player name! So like '/k random' would kick a random person\n")
  3511.         file:write("--Now includes logging. This will log directly to commands.log in the log folder\n")
  3512.         file:write("--Fixed access.ini not syncing with chat commands, meaning if you have sv_kick in your access level, you can now use /k in the chat.\n")
  3513.         file:write("--If you do not have an access file, this script will make one for you.\n")
  3514.         file:write("--Added version changing. You can change to any version of Halo. Syntax is: /version {version} or sv_version {version} in console.\n")
  3515.         file:write("--Added version check removal. You can enable or disable version checking. Having this disabled means that any person on any version can join your server (please note that your server will only appear on the server you specify in the version command)\n")
  3516.         file:write("--Added a defaults.txt. This text file gets called on server startup.\n")
  3517.         file:write("--Added hash check manipulation. You can now disable or enable hash checking (meaning that cracked versions can join your server if its disabled, but that also means everyone is unbannable if they spoof their key (which most people don't know how to do).\n")
  3518.         file:write("--Fixed a bug with /ammo, this now works correctly. Syntax is: /ammo [player] [type (1 or 2)] [ammo] or sv_setammo in console.\n")
  3519.         file:write("--Now includes output messages with the '/e' command.\n")
  3520.         file:write("--Fixed smiley's BOS commands, thanks to bvigil for telling me what it was supposed to do.\n")
  3521.         file:write("--Added a sv_commands and a /commands. This will show all the commands that exist for this script.\n")
  3522.         file:write("--Added a /hide and a /unhide command, these will make you totally hidden from everyone else in the server. It also removes you from the scoreboard, however, it only works with players that join after you execute it. People in the server at the time that you use it will still see you on the scoreboard.\n")
  3523.         file:write("--Fixed a bug with /tp and sv_teleport_pl, which were crashing when the other player was dead.\n")
  3524.         file:write("--Modified /timelimit and sv_timelimit. It will change the ingame timelimit (time remaining) as well as the timelimit for every game after that. This still breaks with sv_reloadscripts.\n")
  3525.         file:write("--Fixed /setplasmas, thank you sanity for the notice...\n")
  3526.         file:write("--Added a parameter to '/spd'. Syntax is /spd [player] {speed}. Doing /spd [player] will show you their current speed.\n")
  3527.         file:write("--Fixed a reported bug with /noweapons... I was never able to reproduce it, so I must have indirectly fixed it.\n")
  3528.         file:write("--Fixed /info which would crash when you used a player expression that was not a number.\n")
  3529.         file:write("--Added another parameter to '/t'. Syntax is '/t list', this will show you the list of teleports for the map.\n")
  3530.         file:write("--Fixed a couple of bugs with rtv and votekick (whoops)\n")
  3531.         file:write("--Added infinite nades to sv_infinite_ammo\n")
  3532.         file:write("--Fixed a bug with 'sv_mute' and '/mute'. You can no longer mute admins.\n")
  3533.         file:write("--Added a '/banlist' command to chat. This will show you the banlist.\n")
  3534.         file:write("--Added a '/alias' command to chat. This will show aliases of the player you pick. Kinda glitchy, oxide's fault, not mine.\n")
  3535.         file:write("--Added sv_rtv_needed [decimal 0 to 1]\n")
  3536.         file:write("--Added sv_votekick_needed [decimal 0 to 1]\n")
  3537.         file:write("--Added sv_rtv_enabled [true or false, 1 or 0]\n")
  3538.         file:write("--Added sv_votekick_enabled [true or false, 1 or 0]\n")
  3539.         file:write("--Fixed /st. This will set a teleport location to wherever you are standing. Syntax is: /st [teleport name]\n")
  3540.         file:write("--Fixed the spawngun. Syntax is /setmode (player) spawngun (object)\n")
  3541.         file:write("--sv_afk was changed to 'sv_setafk'. Thought it was a better name for the command.\n")
  3542.         file:write("--Added ipbanning. Syntax is sv_ipban, sv_ipbanlist, sv_ipunban, and for chat: /ipban, /ipbanlist, /ipunban.\n")
  3543.         file:write("--Fixed Smiley's BoS (Ban On Sight) system. I had to rewrite 80% of it to work with the new Phasor. It now also bans the person's IP.\n")
  3544.         file:write("--Added 'sv_launch' and '/launch'. Syntax is 'sv_launch [player]' or '/launch [player]'\n")
  3545.         file:write("--Added a control command. Syntax is 'sv_control [victim] [controller]' or '/c [victim] [controller]' in chat.\n")
  3546.         file:write("--Added a privatesay command. Syntax is 'sv_privatesay [player] [message]' or '/privatesay [player] [message]' in chat\n")
  3547.         file:write("--Added temp.txt managing, basically so values that you set the previous map won't be erased when the next map loads (like when you do sv_respawn_time 5, and it goes back to default everytime you reload the script)\n")
  3548.         file:write("--Added ipadminadding. You can add admins via IP now. Syntax is sv_ipadminadd (player) (nickname) (level) or /ipadminadd (player) (nickname) (level) in chat.\n")
  3549.         file:write("Sorry this took so long, it took a while to rewrite the whole script. Technically it's been done for a while, i was just waiting for Oxide to release phasor 059. But that won't happen until after june, and there's no way i'm keeping you all waiting. Hope you enjoy it.\n")
  3550.         file:write("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3551.         file:write("Commands Version 2.001\n")
  3552.         file:write("--Fixed /ipadminadd (whoops)\n")
  3553.         file:write("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3554.         file:write("Commands Version 2.2 (Released on June 1 2012)\n")
  3555.         file:write("--Added /balance, it executes sv_teams_balance in console\n")
  3556.         file:write("--Made it so that the sv_map and /m loads the commands script by default\n")
  3557.         file:write("--Added unique player tracking. It will keep track of the number of unique players who joined the server\n")
  3558.         file:write("--Get the number of unique players by doing /count\n")
  3559.         file:write("--Fixed /privatesay. It would only let you message one word before\n")
  3560.         file:write("--Added sv_privatesay. Looks like i forgot the sv_command for that\n")
  3561.         file:write("--Added private chat. Use @(player expression) to message someone\n")
  3562.         file:write("--Added /setcolor. Only works in FFA gametypes.\n")
  3563.         file:write("--Added namebanning to superban.\n")
  3564.         file:write("--Added a \\nameban command.\n")
  3565.         file:write("--Modified the showadminlist function to be a lot more useful\n")
  3566.         file:write("--Added ipadmin deleting (sorry lol)\n")
  3567.         file:write("--Bunch of bug fixes... i can't remember what else i did.\n")
  3568.         file:write("--Oh yea, I fixed votekick.\n")
  3569.         file:write("--Removed some of the spam when the script loads (it was an easy way to accomplish what i wanted at the time)\n")
  3570.         file:write("--Fixed access levels for the script. It kind of worked, but not really.\n")
  3571.         file:write("--Somehow you could die when deathless mode was enabled... i fixed that...\n")
  3572.         file:write("--Fixed an issue with /timelimit and sv_time_cur\n")
  3573.         file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3574.         file:write("Commands Version 2.201 (released on June 5th 2012)\n")
  3575.         file:write("This is mainly just a bug fix version\n")
  3576.         file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3577.         file:write("--Fixed /commands to show all of the commands.\n")
  3578.         file:write("--Fixed a weird problem with the /enter command (when you ejected it would crash your game)\n")
  3579.         file:write("--Fixed /a list (i forgot to check for the /, i was only checking for \\a list, so /a list wouldn't work)\n")
  3580.         file:write("--Fixed falldamage (and also made it so longer falls don't kill you)\n")
  3581.         file:write("--Fixed /hide, when you leave and another person rejoins with your player number, it will no longer hide them (thank you mitch... lol)\n")
  3582.         file:write("--Fixed a bug when loading this script first, it wouldn't let other scripts control the weapons being assigned on spawn (can't believe i didn't see it earlier, ty nuggets + others)\n")
  3583.         file:write("--Added a /setscore and sv_setscore command.\n")
  3584.         file:write("--New functionality to /hax and /unhax\n")
  3585.         file:write("--Modified setkills, setassists, and setdeaths to work a little cleaner\n")
  3586.         file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3587.         file:write("Commands Version 2.3 (released June 13th 2012\n")
  3588.         file:write("Mainly fixed up the admin system\n")
  3589.         file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
  3590.         file:write("--Fixed ipadmins. They can now use the rcon.\n")
  3591.         file:write("--Added a /crash [player] and a sv_crash [player] command. Do not use it when the game is ending... you've been warned...\n")
  3592.         file:write("--Added a /scorelimit and a sv_scorelimit command\n")
  3593.         file:write("--Modified the showadminlist command. Shows a lot more now.\n")
  3594.         file:write("--This script no longer uses Phasor admins, if it sees that you are, it will delete all of them and add them to mine, so if you see admin.txt\n")
  3595.         file:write("turned into admins.txt, don't worry, it's supposed to do that.\n")
  3596.         file:write("--Added a /a del command.\n")
  3597.         file:write("--Added sv_ipadminadd to the rcon\n")
  3598.         file:write("--This script enables CE devmode commands (cheat_deathless_player, cheat_medusa, etc)\n")
  3599.         file:write("--Added a patch that will allow new gametypes to be added without restarting the server\n")
  3600.         file:write("--Fixed a very small problem with the setcolor command.\n")
  3601.         file:write("--Fixed up the timelimit command :)\n")
  3602.         file:write("--IP admins no longer get removed when you unload the commands script\n")
  3603.         file:write("--Fixed the ipban command (whoops)\n")
  3604.         file:write("--Added textbanning. It's like the mute command except it's a permanent\n")
  3605.         file:write("--Fixed rcon commands so that the responses show up with the /e command\n")
  3606.         file:write("--I probably did more but I forgot lol\n")
  3607.         file:close()
  3608. end
  3609.  
  3610. round = function(val, decimal)
  3611.         if (decimal) then
  3612.                 return math.floor((val * 10^decimal) + 0.5) / (10^decimal)
  3613.         else
  3614.                 return math.floor(val+0.5)
  3615.         end
  3616. end
  3617.  
  3618. Command_AFK = function(executor, command, player, count)
  3619.         if count == 1 then
  3620.                 if executor ~= 0xFFFFFFFF then
  3621.                         local m_player = getplayer(executor)
  3622.  
  3623.                         --old afk code
  3624.                         --[[local player_respawn_time = readdword(m_player, 0x2c)
  3625.                         if player_respawn_time >= 20 then
  3626.                                 writedword(m_player, 0x2c, 1 * 33)
  3627.                                 sendresponse(getname(executor) .. " is no longer afk!", command, executor)
  3628.                         else
  3629.                                 kill(executor)
  3630.                                 writedword(m_player, 0x2c, 9999 * 33)
  3631.                                 sendresponse(getname(executor) .. " is now afk!", command, executor)
  3632.                         end--]]
  3633.                         local id = resolveplayer(executor)
  3634.                         afk[id][1] = true
  3635.                         sendresponse(getname(executor) .. " is now afk!", command, executor)
  3636.                 else
  3637.                         sendresponse("Invalid Player!", command, executor)
  3638.                 end
  3639.         elseif count == 2 then
  3640.                 local players = getvalidplayers(player, executor)
  3641.                 if players then
  3642.                         for i = 1,#players do
  3643.                                 --[[local m_player = getplayer(players[i])
  3644.                                 local player_respawn_time = readdword(m_player, 0x2c)
  3645.                                 if player_respawn_time >= 20 then
  3646.                                         writedword(m_player, 0x2c, 1 * 33)
  3647.                                         sendresponse(getname(players[i]) .. " is no longer afk!", command, executor)
  3648.                                 else
  3649.                                         kill(players[i])
  3650.                                         writedword(m_player, 0x2c, 9999 * 33)
  3651.                                         sendresponse(getname(players[i]) .. " is now afk!", command, executor)
  3652.                                 end--]]
  3653.                                 local id = resolveplayer(players[i])
  3654.                                 afk[id][1] = true
  3655.                                 sendresponse(getname(players[i]) .. " is now afk!", command, executor)
  3656.                         end
  3657.                 else
  3658.                         sendresponse("Invalid Player!", command, executor)
  3659.                 end
  3660.         else
  3661.                 sendresponse("Invalid Syntax: " .. command .. " {player}", command, executor)
  3662.         end
  3663. end
  3664.  
  3665. function Command_Adminadd(executor, command, player, nickname, level, count)
  3666.         if count == 4 and tonumber(level) then
  3667.                 local players = getvalidplayers(player, executor)
  3668.                 if players then
  3669.                         for i = 1,#players do
  3670.                                 if not admin_table[gethash(players[i])] then
  3671.                                         admin_table[gethash(players[i])] = {}
  3672.                                         admin_table[gethash(players[i])].level = level
  3673.                                         admin_table[gethash(players[i])].name = nickname
  3674.                                         sendresponse(getname(players[i]) .. " is now an admin!", command, executor)
  3675.                                 else
  3676.                                         sendresponse(getname(players[i]) .. " is already an admin!", command, executor)
  3677.                                 end
  3678.                         end
  3679.                 else
  3680.                         sendresponse("Invalid Player!", command, executor)
  3681.                 end
  3682.         else
  3683.                 sendresponse("Invalid Syntax: " .. command .. " [player] [nickname] [level]", command, executor)
  3684.         end
  3685. end
  3686.  
  3687. function Command_Ipadminadd(executor, command, player, nickname, level, count)
  3688.         if count == 4 then
  3689.                 local players = getvalidplayers(player, executor)
  3690.                 if players then
  3691.                         if not players[2] then
  3692.                                 local ip = getip(players[1])
  3693.                                 if ipadmins[ip] then
  3694.                                         sendresponse(getname(tostring(players[1])) .. " is already an IP admin!", command, executor)
  3695.                                 elseif not nickname:find(",") then
  3696.                                         ipadmins[ip] = ipadmins[ip] or {}
  3697.                                         ipadmins[ip].name = nickname
  3698.                                         ipadmins[ip].level = level
  3699.                                         sendresponse(getname(tostring(players[1])) .. " is now an IP admin!", tostring(command), tostring(executor))
  3700.                                         registertimer(0, "reloadadmins")
  3701.                                 else
  3702.                                         sendresponse("Nicknames must contain no commas.", command, executor)
  3703.                                 end
  3704.                         else
  3705.                                 sendresponse("You cannot add more than one admin with the same nickname!", command, executor)
  3706.                         end
  3707.                 else
  3708.                         sendresponse("Invalid Player!", command, executor)
  3709.                 end
  3710.         else
  3711.                 sendresponse("Invalid Syntax: " .. command .. " [player] [nickname] [level]", command, executor)
  3712.         end
  3713. end
  3714.  
  3715. function Command_Ipadmindel(executor, command, ID, count)
  3716.         if count == 2 then
  3717.                 local file = io.open(profilepath .. "\\ipadmins.txt")
  3718.                 if file then
  3719.                         ID = tonumber(ID) or 0
  3720.                         local admins = {}
  3721.                         local x = 1
  3722.                         for k,v in pairs(admin_table) do
  3723.                                 local name = admin_table[k].name
  3724.                                 local level = admin_table[k].level
  3725.                                 admins[name] = {k, "garbage", level}
  3726.                         end
  3727.                         for k,v in pairs(ipadmins) do
  3728.                                 local name = ipadmins[k].name
  3729.                                 local level = ipadmins[k].level
  3730.                                 if admins[name] and admins[name] ~= {} then
  3731.                                         admins[name][2] = k
  3732.                                 else
  3733.                                         admins[name] = {"garbage", k, level}
  3734.                                 end
  3735.                         end
  3736.  
  3737.                         local bool
  3738.                         for k,v in pairs(admins) do
  3739.                                 if x == ID then
  3740.                                         if admins[k][2] ~= "garbage" then
  3741.                                                 sendresponse(tostring(ipadmins[admins[k][2]].name) .. " is no longer an IP admin!", command, executor)
  3742.                                                 ipadmins[admins[k][2]] = nil
  3743.                                         else
  3744.                                                 sendresponse(tostring(k) .. " is not an IP admin.", command, executor)
  3745.                                         end
  3746.                                         bool = true
  3747.                                         break
  3748.                                 else
  3749.                                         x = x + 1
  3750.                                 end
  3751.                         end
  3752.                         file:close()
  3753.                         if not bool then
  3754.                                 sendresponse("There are no admins with an ID of " .. ID, command, executor)
  3755.                         end
  3756.                 else
  3757.                         sendresponse("There are no IP admins on this server.", command, executor)
  3758.                 end
  3759.         else
  3760.                 sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
  3761.         end
  3762. end
  3763.  
  3764. function Command_Admindel(executor, command, ID, count)
  3765.         if (count == 2 and command == "sv_admin_del") or count == 3 then
  3766.                 local file = io.open(profilepath .. "\\admins.txt")
  3767.                 if file then
  3768.                         ID = tonumber(ID) or 0
  3769.                         local admins = {}
  3770.                         local x = 1
  3771.                         for k,v in pairs(admin_table) do
  3772.                                 local name = admin_table[k].name
  3773.                                 local level = admin_table[k].level
  3774.                                 admins[name] = {k, "garbage", level}
  3775.                         end
  3776.                         for k,v in pairs(ipadmins) do
  3777.                                 local name = ipadmins[k].name
  3778.                                 local level = ipadmins[k].level
  3779.                                 if admins[name] and admins[name] ~= {} then
  3780.                                         admins[name][2] = "ip"
  3781.                                 else
  3782.                                         admins[name] = {"garbage", k, level}
  3783.                                 end
  3784.                         end
  3785.  
  3786.                         local bool
  3787.                         for k,v in pairs(admins) do
  3788.                                 if x == ID then
  3789.                                         if admins[k][1] ~= "garbage" then
  3790.                                                 sendresponse(tostring(admin_table[admins[k][1]].name) .. " is no longer a hash admin!", command, executor)
  3791.                                                 admin_table[admins[k][1]] = nil
  3792.                                         else
  3793.                                                 sendresponse(tostring(k) .. " is not a hash admin.", command, executor)
  3794.                                         end
  3795.                                         bool = true
  3796.                                         break
  3797.                                 else
  3798.                                         x = x + 1
  3799.                                 end
  3800.                         end
  3801.                         file:close()
  3802.                         if not bool then
  3803.                                 sendresponse("There are no admins with an ID of " .. ID, command, executor)
  3804.                         end
  3805.                 else
  3806.                         sendresponse("There are no hash admins on this server.", command, executor)
  3807.                 end
  3808.         else
  3809.                 sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
  3810.         end
  3811. end
  3812.  
  3813. function Command_Setammo(executor, command, player, type, ammo, count)
  3814.         if count == 4 and tonumber(type) and tonumber(ammo) then
  3815.                 local players = getvalidplayers(player, executor)
  3816.                 if players then
  3817.                         for i = 1,#players do
  3818.                                 local m_object = getobject(getplayerobjectid(players[i]))
  3819.                                 if m_object then
  3820.                                         local m_weaponId = readdword(m_object, 0x118)
  3821.                                         if getobject(m_weaponId) then
  3822.                                                 local m_weapon = getobject(m_weaponId)
  3823.                                                 if type == "1" then -- unloaded
  3824.                                                         writedword(m_weapon, 0x2B6, tonumber(ammo))
  3825.                                                         sendresponse(getname(players[i]) .. " had their unloaded ammo changed to " .. ammo, command, executor)
  3826.                                                 elseif type == "2" then -- loaded
  3827.                                                         writedword(m_weapon, 0x2B8, tonumber(ammo))
  3828.                                                         updateammo(m_weaponId)
  3829.                                                         sendresponse(getname(players[i]) .. " had their loaded ammo changed to " .. ammo, command, executor)
  3830.                                                 else
  3831.                                                         sendresponse("Invalid type: 1 for unloaded, 2 for loaded ammo", command, executor)
  3832.                                                 end
  3833.                                         else
  3834.                                                 sendresponse(getname(players[i]) .. " is not holding any weapons!", command, executor)
  3835.                                         end
  3836.                                 else
  3837.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  3838.                                 end
  3839.                         end
  3840.                 else
  3841.                         sendresponse("Invalid Player!", command, executor)
  3842.                 end
  3843.         else
  3844.                 sendresponse("Invalid Syntax: " .. command .. " [player] [type] [ammo]", command, executor)
  3845.         end
  3846. end
  3847.  
  3848. function Command_Ban(executor, command, player, time, count)
  3849.         if count == 2 then
  3850.                 local players = getvalidplayers(player, executor)
  3851.                 if players then
  3852.                         for i = 1,#players do
  3853.                                 svcmd("sv_ban " .. resolveplayer(players[i]), executor)
  3854.                                 sendresponse(getname(players[i]) .. " has been banned from the server!", "/", executor)
  3855.                         end
  3856.                 else
  3857.                         sendresponse("Invalid Player!", command, executor)
  3858.                 end
  3859.         elseif count == 3 and tonumber(time) then
  3860.                 local players = getvalidplayers(player, executor)
  3861.                 if players then
  3862.                         for i = 1,#players do
  3863.                                 svcmd("sv_ban " .. resolveplayer(players[i]) .. " " .. time)
  3864.                                 sendresponse(getname(players[i]) .. " has been banned from the server!", "/", executor)
  3865.                         end
  3866.                 else
  3867.                         sendresponse("Invalid Player!", command, executor)
  3868.                 end
  3869.         else
  3870.                 sendresponse("Invalid Syntax: " .. command .. " [player] {time}", command, executor)
  3871.         end
  3872. end
  3873.  
  3874. function Command_Bos(executor, command, player, count)
  3875.         if count == 2 then
  3876.  
  3877.                 local player_number = tonumber(player)
  3878.                 local bos_entry = bos_table[player_number]
  3879.                 local words = {}
  3880.  
  3881.                 if bos_entry == nil then
  3882.                         sendresponse("Invalid Player", command, executor)
  3883.                 else
  3884.  
  3885.                         local count = gettokencount(bos_entry, ",")
  3886.  
  3887.                         for i = 1,count do
  3888.                                 local word = gettoken(bos_entry, ",", i-1)
  3889.                                 table.insert(words, word)
  3890.                         end
  3891.  
  3892.                         local name3 = words[1]
  3893.                         local hash3 = words[2]
  3894.                         local ip3 = words[3]
  3895.  
  3896.                         sendresponse("Adding " .. name3 .. " to BoS.", command, executor)
  3897.                         sendresponse("Entry: " .. name3 .. " - " .. hash3 .. " - " .. ip3, command, executor)
  3898.                         table.insert(boslog_table, bos_entry)
  3899.  
  3900.                 end
  3901.  
  3902.         else
  3903.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  3904.         end
  3905. end
  3906.  
  3907. function Command_Unbos(executor, command, ID, count)
  3908.         if count == 2 then
  3909.  
  3910.                 local entry = boslog_table[tonumber(ID)]
  3911.                 local words = {}
  3912.  
  3913.                 if entry == nil then
  3914.                         sendresponse("Invalid Entry", command, executor)
  3915.                 else
  3916.  
  3917.                         local count = gettokencount(entry, ",")
  3918.  
  3919.                         for i = 1,count do
  3920.                                 local word = gettoken(entry, ",", i-1)
  3921.                                 table.insert(words, word)
  3922.                         end
  3923.  
  3924.                         local name = words[1]
  3925.                         local hash = words[2]
  3926.                         local IP = words[3]
  3927.  
  3928.                         sendresponse("Removing " .. name .. " - " .. hash .. " from BoS.", command, executor)
  3929.                         table.remove(boslog_table, tonumber(ID))
  3930.  
  3931.                 end
  3932.  
  3933.         else
  3934.                 sendresponse("Invalid Syntax: " .. command .. " [entry]", command, executor)
  3935.         end
  3936. end
  3937.  
  3938.  
  3939. function DelayEject(id, count, player)
  3940.         exitvehicle(player)
  3941.         return 0
  3942. end
  3943.  
  3944. function Command_Control(executor, command, victim, Controller, count)
  3945.         if count == 3 then
  3946.                 local victims = getvalidplayers(victim)
  3947.                 local controller = getvalidplayers(Controller)
  3948.                 if victims and controller then
  3949.                         if controller[2] == nil then
  3950.                                 for i = 1,#victims do
  3951.                                         local id = resolveplayer(controller[1])
  3952.                                         local m_playerObjId = getplayerobjectid(controller[1])
  3953.                                         if victims[i] ~= controller[1] then
  3954.                                                 table.insert(control_table[id], victims[i])
  3955.                                                 sendresponse(getname(victims[i]) .. " is now being controlled by " .. getname(controller[1]), command, executor)
  3956.                                                 local m_object = getobject(getplayerobjectid(victims[i]))
  3957.                                                 if m_object then
  3958.                                                         local m_vehicleId = readdword(m_object, 0x11C)
  3959.                                                         local m_vehicle = getobject(m_vehicleId)
  3960.                                                         if m_vehicle then
  3961.                                                                 local seat = readword(m_vehicle, 0x120)
  3962.                                                                 exitvehicle(victims[i])
  3963.                                                                 entervehicle(controller[i], m_vehicleId, seat)
  3964.                                                                 local x,y,z = getobjectcoords(m_playerObjId)
  3965.                                                                 local vehid = createobject("vehi", "vehicles\\ghost\\ghost_mp", 0, 30, false, x, y, z+5)
  3966.                                                                 entervehicle(controller[i], vehid, 0)
  3967.                                                                 registertimer(200, "DelayEject", controller[1])
  3968.                                                                 movobjcoords(m_playerObjId, x, y, z+0.5)
  3969.                                                                 entervehicle(victims[i], m_vehicleId, seat)
  3970.                                                         end
  3971.                                                 end
  3972.                                         elseif victims[i] == controller[1] then
  3973.                                                 local bool = false
  3974.                                                 for j = 1,16 do
  3975.                                                         for k = 1,16 do
  3976.                                                                 if control_table[j][k] == victims[i] then
  3977.                                                                         control_table[j][k] = nil
  3978.                                                                         bool = true
  3979.                                                                         break
  3980.                                                                 end
  3981.                                                         end
  3982.                                                         if bool then
  3983.                                                                 break
  3984.                                                         end
  3985.                                                 end
  3986.                                                 local m_object = getobject(getplayerobjectid(controller[1]))
  3987.                                                 local m_vehicleId = readdword(m_object, 0x11C)
  3988.                                                 local m_vehicle = getobject(m_vehicleId)
  3989.                                                 if m_vehicle then
  3990.                                                         local seat = readword(m_object, 0x120)
  3991.                                                         entervehicle(controller[1], m_vehicleId, 0)
  3992.                                                         entervehicle(controller[1], m_vehicleId, seat)
  3993.                                                         sendresponse(getname(controller[1]) .. " is now being controlled by " .. getname(controller[1]), command, executor)
  3994.                                                 else
  3995.                                                         sendresponse(getname(controller[1]) .. " is no longer being controlled!", command, executor)
  3996.                                                 end
  3997.                                         end
  3998.                                 end
  3999.                         else
  4000.                                 sendresponse("Victims can only be controlled by one person.", command, executor)
  4001.                         end
  4002.                 else
  4003.                         sendresponse("Invalid Player!", command, executor)
  4004.                 end
  4005.         else
  4006.                 sendresponse("Invalid Syntax: " .. command .. " [victims] [controller]", command, executor)
  4007.         end
  4008. end
  4009.  
  4010. function Command_Commands(executor, command, count)
  4011.         if count == 1 then
  4012.                 local commands = ""
  4013.                 for i = 1,#commands_table do
  4014.                         commands = commands .. "   " .. commands_table[i]
  4015.                         if commands:len() >= 100 then
  4016.                                 sendresponse(commands, command, executor)
  4017.                                 commands = ""
  4018.                         end
  4019.                 end
  4020.         else
  4021.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4022.         end
  4023. end
  4024.  
  4025. function Command_Count(executor, command, count)
  4026.         if count == 1 then
  4027.                 sendresponse("There are " .. tostring(uniques) .. " unique users that have been to this server!", command, executor)
  4028.         else
  4029.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4030.         end
  4031. end
  4032.  
  4033. function Command_Kick(executor, command, player, count)
  4034.         if count == 2 then
  4035.                 local players = getvalidplayers(player, executor)
  4036.                 if players then
  4037.                         for i = 1,#players do
  4038.                                 svcmd("sv_kick " .. resolveplayer(players[i]))
  4039.                                 sendresponse(getname(players[i]) .. " has been kicked from the server!", "/", executor)
  4040.                         end
  4041.                 else
  4042.                         sendresponse("Invalid Player!", command, executor)
  4043.                 end
  4044.         else
  4045.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4046.         end
  4047. end
  4048.  
  4049. function Command_Deathless(executor, command, boolean, count)
  4050.         if count == 1 then
  4051.                 if deathless then
  4052.                         sendresponse("Deathless is currently enabled.", command, executor)
  4053.                 else
  4054.                         sendresponse("Deathless is currently disabled", command, executor)
  4055.                 end
  4056.         elseif count == 2 then
  4057.                 if (boolean == "1" or boolean == "true") and not deathless then
  4058.                         for c = 0,15 do
  4059.                                 if getplayer(c) then
  4060.                                         local m_player = getplayer(c)
  4061.                                         local m_playerObjId = readdword(m_player, 0x34)
  4062.                                         local m_object = getobject(m_playerObjId)
  4063.                                         local obj_health = readfloat(m_object, 0xE0)
  4064.                                         local obj_shields = readfloat(m_object, 0xE4)
  4065.                                         writefloat(m_object, 0xE0, 99999999)
  4066.                                         writefloat(m_object, 0xE4, 99999999)
  4067.                                 end
  4068.                         end
  4069.                         sendresponse("Deathless player is now on. You cannot die.", command, executor)
  4070.                         deathless = true
  4071.                 elseif boolean == "1" or boolean == "true" then
  4072.                         sendresponse("Deathless is already enabled!", command, executor)
  4073.                 elseif (boolean == "0" or boolean == "false") and deathless then
  4074.                         for c = 0,15 do
  4075.                                 if getplayer(c) then
  4076.                                         local m_player = getplayer(c)
  4077.                                         local m_playerObjId = readdword(m_player, 0x34)
  4078.                                         local m_object = getobject(m_playerObjId)
  4079.                                         local obj_health = readfloat(m_object, 0xE0)
  4080.                                         local obj_shields = readfloat(m_object, 0xE4)
  4081.                                         writefloat(m_object, 0xE0, 1)
  4082.                                         writefloat(m_object, 0xE4, 1)
  4083.                                 end
  4084.                         end
  4085.                         sendresponse("Deathless player is now off.", command, executor)
  4086.                         deathless = false
  4087.                 elseif deathless == nil then
  4088.                         sendresponse("Deathless player is now off.", command, executor)
  4089.                         deathless = false
  4090.                 elseif boolean == "0" or boolean == "false" then
  4091.                         sendresponse("Deathless is already disabled!", command, executor)
  4092.                 else
  4093.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  4094.                 end
  4095.         else
  4096.                 sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
  4097.         end
  4098. end
  4099.  
  4100. function Command_Execute(executor, command)
  4101.         sendresponse("Executed " .. string.sub(command, 4), command, executor)
  4102.         sendresponse(svcmd(string.sub(command, 4)), command, executor)
  4103. end
  4104.  
  4105. function Command_Setmode(executor, command, player, Mode, object, count)
  4106.         if player == nil then
  4107.                 sendresponse("Invalid Syntax: " .. command .. " [player] [mode] {object (for spawngun only)}", command, executor)
  4108.                 return
  4109.         end
  4110.         local players = getvalidplayers(player, executor)
  4111.         if players then
  4112.                 if count == 3 then
  4113.                         for i = 1,#players do
  4114.                                 if Mode == "destroy" then
  4115.                                         mode[gethash(players[i])] = "destroy"
  4116.                                         sendresponse(getname(players[i]) .. " is now in destroy mode!", command, executor)
  4117.                                 elseif Mode == "portalgun" then
  4118.                                         mode[gethash(players[i])] = "portalgun"
  4119.                                         sendresponse(getname(players[i]) .. " is now in portalgun mode!", command, executor)
  4120.                                 elseif Mode == "entergun" then
  4121.                                         mode[gethash(players[i])] = "entergun"
  4122.                                         sendresponse(getname(players[i]) .. " is now in entergun mode!", command, executor)
  4123.                                 elseif Mode == "controlgun" then
  4124.                                         mode[gethash(players[i])] = "controlgun"
  4125.                                         sendresponse(getname(players[i]) .. " is now in controlgun mode!", command, executor)
  4126.                                 elseif Mode == "normal" or Mode == "none" or Mode == "regular" then
  4127.                                         objspawntype[gethash(players[i])] = nil
  4128.                                         objspawntag[gethash(players[i])] = nil
  4129.                                         mode[gethash(players[i])] = nil
  4130.                                         sendresponse(getname(players[i]) .. " is now in normal mode!", command, executor)
  4131.                                 else
  4132.                                         sendresponse("Invalid Mode!", command, executor)
  4133.                                 end
  4134.                         end
  4135.                 elseif count == 4 then
  4136.                         for i = 1,#players do
  4137.                                 if Mode == "spawngun" then
  4138.                                         local objexists = false
  4139.                                         --local
  4140.                                         objspawntype[gethash(players[i])] = nil
  4141.                                         objspawntag[gethash(players[i])] = nil
  4142.                                         mode[gethash(players[i])] = nil
  4143.                                         for j = 1,#objects do
  4144.                                                 if object == objects[j][1] then
  4145.                                                         mode[gethash(players[i])] = "spawngun"
  4146.                                                         objspawntype[gethash(players[i])] = objects[j][2]
  4147.                                                         objspawntag[gethash(players[i])] = objects[j][3]
  4148.                                                         sendresponse(getname(players[i]) .. " is now spawning " .. objects[j][3] .. "!", command, executor)
  4149.                                                         objexists = true
  4150.                                                         break
  4151.                                                 end
  4152.                                         end
  4153.                                         if objexists == false then
  4154.                                                 sendresponse("Object does not exist. Make sure you are spelling it right.", command, executor)
  4155.                                         end
  4156.                                 end
  4157.                         end
  4158.                 else
  4159.                         sendresponse("Invalid Syntax: " .. command .. " [player] [mode] {object}", command, executor)
  4160.                 end
  4161.         else
  4162.                 sendresponse("Invalid Player!", command, executor)
  4163.         end
  4164. end
  4165.  
  4166. function Command_Eject(executor, command, player, count)
  4167.         if count == 2 then
  4168.                 local players = getvalidplayers(player, executor)
  4169.                 if players then
  4170.                         for i = 1,#players do
  4171.                                 local m_player = getplayer(players[i])
  4172.                                 local m_object = getobject(getplayerobjectid(players[i]))
  4173.                                 local m_vehicleId = readdword(m_object, 0x11C)
  4174.                                 if m_object then
  4175.                                         if m_vehicleId ~= 0xffffffff then
  4176.                                                 exitvehicle(players[i])
  4177.                                                 sendresponse("Ejecting " .. getname(players[i]) .. " from his/her vehicle!", command, executor)
  4178.                                         else
  4179.                                                 sendresponse("Error! " .. getname(players[i]) .. " is not in a vehicle!", command, executor)
  4180.                                         end
  4181.                                 else
  4182.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4183.                                 end
  4184.                         end
  4185.                 else
  4186.                         sendresponse("Invalid Player", command, executor)
  4187.                 end
  4188.         else
  4189.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4190.         end
  4191. end
  4192.  
  4193. function Command_Getloc(executor, command, player, count)
  4194.         if count == 2 then
  4195.                 local players = getvalidplayers(player, executor)
  4196.                 if players then
  4197.                         for i = 1,#players do
  4198.                                 local m_playerObjId = getplayerobjectid(players[i])
  4199.                                 if getobject(m_playerObjId) then
  4200.                                         local x,y,z = getobjectcoords(m_playerObjId)
  4201.                                         x = round(x, 2)
  4202.                                         y = round(y, 2)
  4203.                                         z = round(z, 2)
  4204.                                         sendresponse(getname(players[i]) .. "'s coords are: X: " .. x .. "  Y: " .. y .. "  Z: " .. z, command, executor)
  4205.                                 else
  4206.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4207.                                 end
  4208.                         end
  4209.                 else
  4210.                         sendresponse("Invalid Player!", command, executor)
  4211.                 end
  4212.         else
  4213.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4214.         end
  4215. end
  4216.  
  4217. function Command_Follow(executor, command, player, count)
  4218.         if count == 2 then
  4219.                 local players = getvalidplayers(player, executor)
  4220.                 if players then
  4221.                         for i = 1,#players do
  4222.                                 sendresponse(getname(executor) .. " is now following " .. getname(players[i]), command, executor)
  4223.                                 local id = resolveplayer(executor)
  4224.                                 follow[id] = registertimer(20, "FollowTimer", executor, players[i])
  4225.                         end
  4226.                 elseif player == "stop" or player == "none" then
  4227.                         local id = resolveplayer(executor)
  4228.                         if follow[id] then
  4229.                                 sendresponse(getname(executor) .. " is no longer following", command, executor)
  4230.                                 removetimer(follow[id])
  4231.                                 follow[id] = nil
  4232.                         end
  4233.                 else
  4234.                         sendresponse("Invalid Player!", command, executor)
  4235.                 end
  4236.         else
  4237.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4238.         end
  4239. end
  4240.  
  4241. function Command_Falldamage(executor, command, boolean, count)
  4242.         if count == 1 then
  4243.                 if falldamage then
  4244.                         sendresponse("Fall damage is currently on", command, executor)
  4245.                 else
  4246.                         sendresponse("Fall damage is currently off", command, executor)
  4247.                 end
  4248.         elseif count == 2 then
  4249.                 if (boolean == "1" or boolean == "true") and not falldamage then
  4250.                         falldamage = true
  4251.                         sendresponse("Fall damage is now on!", command, executor)
  4252.                 elseif (boolean == "1" or boolean == "true") then
  4253.                         sendresponse("Fall damage is already on!", command, executor)
  4254.                 elseif boolean ~= "0" and boolean ~= "false" then
  4255.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  4256.                 elseif (boolean == "0" or boolean == "false") and (falldamage or falldamage == nil) then
  4257.                         falldamage = false
  4258.                         sendresponse("Fall damage is now off!", command, executor)
  4259.                 elseif boolean == "0" or boolean == "false" then
  4260.                         sendresponse("Fall damage is already off!", command, executor)
  4261.                 else
  4262.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  4263.                 end
  4264.         else
  4265.                 sendresponse("Invalid Syntax: " .. command .. " [boolean]", command, executor)
  4266.         end
  4267. end
  4268.  
  4269. function Command_Ghost(executor, command, player, count)
  4270.         if count == 1 then
  4271.                 local m_object = getobject(getplayerobjectid(executor))
  4272.                 if m_object then
  4273.                         writebit(m_object, 0x10, 7, 1)
  4274.                         sendresponse("You are now a ghost!", command, executor)
  4275.                 else
  4276.                         sendresponse("You cannot become a ghost while dead!", command, executor)
  4277.                 end
  4278.         elseif count == 2 then
  4279.                 local players = getvalidplayers(player, executor)
  4280.                 if players then
  4281.                         for i = 1,#players do
  4282.                                 local m_object = getobject(getplayerobjectid(players[i]))
  4283.                                 if m_object then
  4284.                                         writebit(m_object, 0x10, 7, 1)
  4285.                                         sendresponse(getname(players[i]) .. " is now a ghost!", command, executor)
  4286.                                         sendresponse("You are now a ghost.", "\\", players[i])
  4287.                                 else
  4288.                                         sendresponse("You cannot ghost " .. getname(players[i]) .. " because " .. getname(players[i]) .. " is dead!", command, executor)
  4289.                                 end
  4290.                         end
  4291.                 else
  4292.                         sendresponse("Invalid Player!", command, executor)
  4293.                 end
  4294.         else
  4295.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4296.         end
  4297. end
  4298.  
  4299. function Command_Hide(executor, command, player, count)
  4300.         if count == 2 then
  4301.                 local players = getvalidplayers(player, executor)
  4302.                 if players then
  4303.                         for i = 1,#players do
  4304.                                 local id = resolveplayer(players[i])
  4305.                                 if hidden[id] == nil then
  4306.                                         sendresponse(getname(players[i]) .. " is now hidden!", command, executor)
  4307.                                         hidden[id] = true
  4308.                                 else
  4309.                                         sendresponse(getname(players[i]) .. " is already hidden!", command, executor)
  4310.                                 end
  4311.                         end
  4312.                 else
  4313.                         sendresponse("Invalid Player!", command, executor)
  4314.                 end
  4315.         else
  4316.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4317.         end
  4318. end
  4319.  
  4320. function Command_Unhide(executor, command, player, count)
  4321.         if count == 2 then
  4322.                 local players = getvalidplayers(player, executor)
  4323.                 if players then
  4324.                         for i = 1,#players do
  4325.                                 local id = resolveplayer(players[i])
  4326.                                 if hidden[id] then
  4327.                                         sendresponse(getname(players[i]) .. " is no longer hidden!", command, executor)
  4328.                                         hidden[id] = nil
  4329.                                 else
  4330.                                         sendresponse(getname(players[i]) .. " was never hidden!", command, executor)
  4331.                                 end
  4332.                         end
  4333.                 else
  4334.                         sendresponse("Invalid Player!", command, executor)
  4335.                 end
  4336.         else
  4337.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4338.         end
  4339. end
  4340.  
  4341. function Command_Unban(executor, command, id, count)
  4342.         if count == 2 and tonumber(id) then
  4343.                 local response = svcmd("sv_unban " .. tonumber(id), executor)
  4344.                 if response then
  4345.                         if string.find(response, "Unbanning") then
  4346.                                 sendresponse(response, command, executor)
  4347.                         else
  4348.                                 sendresponse("That ID has not been banned.", command, executor)
  4349.                         end
  4350.                 else
  4351.                         sendresponse("An unknown error has occured getting the reply from svcmd.", command, executor)
  4352.                 end
  4353.         else
  4354.                 sendresponse("Invalid Syntax: " .. command .. " [Banlist ID]", command, executor)
  4355.         end
  4356. end
  4357.  
  4358. function Command_Unghost(executor, command, player, count)
  4359.         if count == 1 then
  4360.                 local m_object = getobject(getplayerobjectid(executor))
  4361.                 if m_object then
  4362.                         writebit(m_object, 0x10, 7, 0)
  4363.                         sendresponse("You are no longer a ghost.", command, executor)
  4364.                 else
  4365.                         sendresponse("You cannot unghost while dead!", command, executor)
  4366.                 end
  4367.         elseif count == 2 then
  4368.                 local players = getvalidplayers(player, executor)
  4369.                 if players then
  4370.                         for i = 1,#players do
  4371.                                 local m_object = getobject(getplayerobjectid(players[i]))
  4372.                                 if m_object then
  4373.                                         writebit(m_object, 0x10, 7, 0)
  4374.                                         sendresponse(getname(players[i]) .. " is no longer a ghost!", command, executor)
  4375.                                         sendresponse("You are no longer a ghost.", "\\", players[i])
  4376.                                 else
  4377.                                         sendresponse("You cannot unghost " .. getname(players[i]) .. " because " .. getname(players[i]) .. " is dead!", command, executor)
  4378.                                 end
  4379.                         end
  4380.                 else
  4381.                         sendresponse("Invalid Player!")
  4382.                 end
  4383.         else
  4384.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4385.         end
  4386. end
  4387.  
  4388. function Command_Godmode(executor, command, player, count)
  4389.         if count == 2 then
  4390.                 if deathless ~= 1 then
  4391.                         local players = getvalidplayers(player, executor)
  4392.                         if players then
  4393.                                 for i = 1,#players do
  4394.                                         local m_player = getplayer(players[i])
  4395.                                         local m_playerObjId = readdword(m_player, 0x34)
  4396.                                         local m_object = getobject(m_playerObjId)
  4397.                                         if m_object then
  4398.                                                 local obj_health = readfloat(m_object, 0xE0)
  4399.                                                 local obj_shields = readfloat(m_object, 0xE4)
  4400.                                                 writefloat(m_object, 0xE0, 99999999)
  4401.                                                 writefloat(m_object, 0xE4, 99999999)
  4402.                                                 sendresponse(getname(players[i]) .. " has been given godmode!", command, executor)
  4403.                                                 sendresponse("You have been given godmode.", "\\", players[i])
  4404.                                         else
  4405.                                                 sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4406.                                         end
  4407.                                 end
  4408.                         else
  4409.                                 sendresponse("Invalid Player", command, executor)
  4410.                         end
  4411.                 else
  4412.                         sendresponse("Deathless is enabled! You cannot give out godmode!", command, executor)
  4413.                 end
  4414.         else
  4415.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4416.         end
  4417. end
  4418.  
  4419. function Command_Setscore(executor, command, player, score, count)
  4420.         if count == 3 and tonumber(score) then
  4421.                 local players = getvalidplayers(player, executor)
  4422.                 if players then
  4423.                         for i = 1,#players do
  4424.                                 setscore(players[i], tonumber(score))
  4425.                                 sendresponse(getname(players[i]) .. " had their score set to " .. score .. "!", command, executor)
  4426.                         end
  4427.                 else
  4428.                         sendresponse("Invalid Player!", command, executor)
  4429.                 end
  4430.         elseif count == 1 then
  4431.                 sendresponse("Syntax: " .. command .. " [player] [score]", command, executor)
  4432.         else
  4433.                 sendresponse("Invalid Syntax: " .. command .. " [player] [score]", command, executor)
  4434.         end
  4435. end
  4436.  
  4437. function Command_Hax(executor, command, player, count)
  4438.         if count == 2 then
  4439.                 local players = getvalidplayers(player, executor)
  4440.                 if players then
  4441.                         for i = 1,#players do
  4442.                                 local m_player = getplayer(players[i])
  4443.                                 setscore(players[i], 9999)
  4444.                                 writeword(m_player, 0x9C, 9999)
  4445.                                 writeword(m_player, 0xA4, 9999)
  4446.                                 writeword(m_player, 0xAC, 9999)
  4447.                                 writeword(m_player, 0xAE, 9999)
  4448.                                 writeword(m_player, 0xB0, 9999)
  4449.                                 sendresponse(getname(players[i]) .. " has been haxed!", command, executor)
  4450.                         end
  4451.                 end
  4452.         else
  4453.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4454.         end
  4455. end
  4456.  
  4457. function Command_Heal(executor, command, player, count)
  4458.         if count == 2 then
  4459.                 local players = getvalidplayers(player, executor)
  4460.                 if players then
  4461.                         for i = 1,#players do
  4462.                                 local m_player = getplayer(players[i])
  4463.                                 local m_playerObjId = readdword(m_player, 0x34)
  4464.                                 local m_object = getobject(m_playerObjId)
  4465.                                 if m_object then
  4466.                                         local obj_health = readfloat(m_object, 0xE0)
  4467.                                         local obj_shields = readfloat(m_object, 0xE4)
  4468.                                         writefloat(m_object, 0xE0, 1)
  4469.                                         writefloat(m_object, 0xE4, 1)
  4470.                                         sendresponse(getname(players[i]) .. " has been healed!", command, executor)
  4471.                                         sendresponse("You have been healed!", "\\", players[i], command, executor)
  4472.                                 else
  4473.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4474.                                 end
  4475.                         end
  4476.                 else
  4477.                         sendresponse("Invalid Player", command, executor)
  4478.                 end
  4479.         else
  4480.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4481.         end
  4482. end
  4483.  
  4484. function Command_Ungod(executor, command, player, count)
  4485.         if count == 2 then
  4486.                 local players = getvalidplayers(player, executor)
  4487.                 if players then
  4488.                         for i = 1,#players do
  4489.                                 local m_player = getplayer(players[i])
  4490.                                 local m_playerObjId = readdword(m_player, 0x34)
  4491.                                 local m_object = getobject(m_playerObjId)
  4492.                                 if m_object then
  4493.                                         local obj_health = readfloat(m_object, 0xE0)
  4494.                                         local obj_shields = readfloat(m_object, 0xE4)
  4495.                                         writefloat(m_object, 0xE0, 1)
  4496.                                         writefloat(m_object, 0xE4, 1)
  4497.                                         sendresponse(getname(players[i]) .. " is no longer in godmode", command, executor)
  4498.                                         sendresponse("You are no longer in godmode.", "\\", players[i], command, executor)
  4499.                                 else
  4500.                                         sendresponse("Error! The selected player is dead!", command, executor)
  4501.                                 end
  4502.                         end
  4503.                 else
  4504.                         sendresponse("Invalid Player", command, executor)
  4505.                 end
  4506.         else
  4507.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4508.         end
  4509. end
  4510.  
  4511. function Command_Hitler(executor, command, count)
  4512.         if count == 1 then
  4513.                 for i = 0,15 do
  4514.                         if getplayer(i) then
  4515.                                 if getobject(getplayerobjectid(i)) then
  4516.                                         kill(i)
  4517.                                         sendresponse(getname(i) .. " was given a lethal injection!", command, executor)
  4518.                                 end
  4519.                         end
  4520.                 end
  4521.         else
  4522.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4523.         end
  4524. end
  4525.  
  4526. function Command_Infammo(executor, command, boolean, count)
  4527.         if count == 1 then
  4528.                 if infammo then
  4529.                         sendresponse("Infinite ammo is currently enabled", command, executor)
  4530.                 else
  4531.                         sendresponse("Infinite ammo is currently disabled", command, executor)
  4532.                 end
  4533.         elseif count == 2 then
  4534.                 if (boolean == "1" or boolean == "true") and not infammo then
  4535.                         nadetimer = registertimer(300, "nadeTimer")
  4536.                         for c = 0,15 do
  4537.                                 if getplayer(c) then
  4538.                                         local m_ObjId = readdword(m_player, 0x34)
  4539.                                         local m_Object = getobject(m_ObjId)
  4540.                                         if m_Object then
  4541.                                                 for i = 0,3 do
  4542.                                                         local m_weaponId = readdword(m_Object, 0x2F8 + (i*4))
  4543.                                                         if m_weaponId ~= 0xFFFFFFFF then
  4544.                                                                 local m_weapon = getobject(m_weaponId)
  4545.                                                                 writeword(m_weapon, 0x2B6, 9999) -- unloaded clip to 9999
  4546.                                                                 --writeword(m_weapon, 0x2B8, 9999) -- loaded clip to 9999
  4547.                                                                 --updateammo(m_weaponId)
  4548.                                                         end
  4549.                                                 end
  4550.                                         end
  4551.                                 end
  4552.                         end
  4553.                         infammo = true
  4554.                         sendresponse("Infinite Ammo is now enabled!", command, executor)
  4555.                 elseif (boolean == "1" or boolean == "true") then
  4556.                         sendresponse("Infammo is already enabled!", command, executor)
  4557.                 elseif boolean ~= "0" and boolean ~= "false" then
  4558.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  4559.                 elseif (boolean == "0" or boolean == "false") and infammo then
  4560.                         for c = 0,15 do
  4561.                                 if getplayer(c) then
  4562.                                         local m_player = getplayer(c)
  4563.                                         local m_ObjId = readdword(m_player, 0x34)
  4564.                                         local m_Object = getobject(m_ObjId)
  4565.                                         if m_player and m_Object then
  4566.                                                 writebyte(m_Object, 0x31E, 0) -- set frags to 4
  4567.                                                 writebyte(m_Object, 0x31F, 0) -- set plasmas to 4
  4568.                                         end
  4569.                                 end
  4570.                         end
  4571.                         infammo = false
  4572.                         sendresponse("Infinite Ammo is now disabled!", command, executor)
  4573.                 elseif infammo == nil then
  4574.                         sendresponse("Infinite Ammo is now disabled!", command, executor)
  4575.                         infammo = false
  4576.                 elseif boolean == "0" or boolean == "false" then
  4577.                         sendresponse("Infammo is already disabled!", command, executor)
  4578.                 else
  4579.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  4580.                 end
  4581.         else
  4582.                 sendresponse("Invalid Syntax: " .. command .. " [boolean]", command, executor)
  4583.         end
  4584. end
  4585.  
  4586. function Command_Superban(executor, command, player, count)
  4587.         if count == 2 and tonumber(command) == nil then
  4588.                 local players = getvalidplayers(player, executor)
  4589.                 if players then
  4590.                         for i = 1,#players do
  4591.                                 table.insert(name_bans, getname(players[i]))
  4592.                                 local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a")
  4593.                                 local id = resolveplayer(players[i])
  4594.                                 ip_banlist[getname(players[i])] = getip(players[i])
  4595.                                 banlist:write(tostring(getname(players[i])) .. "," .. tostring(ip_banlist[getname(players[i])]) .. "\n")
  4596.                                 banlist:close()
  4597.                                 local file = io.open(profilepath .. "\\namebans.txt", "w")
  4598.                                 for i = 1,#name_bans do
  4599.                                         file:write(name_bans[i] .. "\n")
  4600.                                 end
  4601.                                 file:close()
  4602.                                 sendresponse(getname(players[i]) .. " has been superbanned from the server!", command, executor)
  4603.                                 svcmd("sv_ban " .. resolveplayer(players[i]))
  4604.                         end
  4605.                 else
  4606.                         sendresponse("Invalid Player!", command, executor)
  4607.                 end
  4608.         else
  4609.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4610.         end
  4611. end
  4612.  
  4613. function Command_Nameban(executor, command, player, count)
  4614.         if count == 2 and tonumber(command) == nil then
  4615.                 local players = getvalidplayers(player, executor)
  4616.                 if players then
  4617.                         for i = 1,#players do
  4618.                                 local name = getname(players[i])
  4619.                                 local bool = true
  4620.                                 for i = 1,#name_bans do
  4621.                                         if name_bans[i] == name then bool = false break end
  4622.                                 end
  4623.                                 if bool then
  4624.                                         table.insert(name_bans, name)
  4625.                                         Ipban(players[i])
  4626.                                         sendresponse(name .. " has been name banned from the server!", command, executor)
  4627.                                         local file = io.open(profilepath .. "\\namebans.txt", "w")
  4628.                                         for i = 1,#name_bans do
  4629.                                                 file:write(name_bans[i] .. "\n")
  4630.                                         end
  4631.                                         file:close()
  4632.                                 end
  4633.                         end
  4634.                 else
  4635.                         sendresponse("Invalid Player!", command, executor)
  4636.                 end
  4637.         else
  4638.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4639.         end
  4640. end
  4641.  
  4642. function Command_Namebanlist(executor, command, count)
  4643.         if count == 1 then
  4644.                 if name_bans == {} or name_bans == nil or #name_bans == 0 then
  4645.                         sendresponse("There are no names banned from the server.", command, executor)
  4646.                         return
  4647.                 end
  4648.                 for i = 1,#name_bans do
  4649.                         sendresponse("[" .. i .. "] " .. name_bans[i], command, executor)
  4650.                 end
  4651.         else
  4652.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4653.         end
  4654. end
  4655.  
  4656. function Command_Nameunban(executor, command, ID, count)
  4657.         if count == 2 then
  4658.                 local ID = tonumber(ID)
  4659.                 if name_bans[ID] then
  4660.                         sendresponse(name_bans[ID] .. " has been unbanned from the server!", command, executor)
  4661.                         name_bans[ID] = nil
  4662.                         local file = io.open(profilepath .. "\\namebans.txt", "w")
  4663.                         for i = 1,#name_bans do
  4664.                                 if name_bans[i] then
  4665.                                         file:write(name_bans[i] .. "\n")
  4666.                                 end
  4667.                         end
  4668.                         file:close()
  4669.                 else
  4670.                         sendresponse("That name has not been banned.", command, executor)
  4671.                 end
  4672.         else
  4673.                 sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
  4674.         end
  4675. end
  4676.  
  4677.  
  4678. function Command_Ipban(executor, command, player, count)
  4679.         if count == 2 then
  4680.                 local players = getvalidplayers(player, executor)
  4681.                 if players then
  4682.                         for i = 1,#players do
  4683.                                 local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a")
  4684.                                 local id = resolveplayer(players[i])
  4685.                                 ip_banlist[getname(players[i])] = getip(players[i])
  4686.                                 banlist:write(tostring(getname(players[i])) .. "," .. tostring(getip(players[i])) .. "\n")
  4687.                                 banlist:close()
  4688.                                 Ipban(players[i])
  4689.                                 sendresponse(getname(players[i]) .. " has been IP banned from the server!", "/", executor)
  4690.                         end
  4691.                 else
  4692.                         sendresponse("Invalid Player!", command, executor)
  4693.                 end
  4694.         else
  4695.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4696.         end
  4697. end
  4698.  
  4699. function Command_Ipbanlist(executor, command, count)
  4700.         if count == 1 then
  4701.                 local banlist = io.open(profilepath .. "\\ipbanlist.txt")
  4702.                 local j = 1
  4703.                 local bool = false
  4704.                 if banlist then
  4705.                         sendresponse("[Num - Name - IP]", command, executor)
  4706.                         for line in banlist:lines() do
  4707.                                 if line and line ~= "" then
  4708.                                         local count = gettokencount(line, ",")
  4709.                                         local words = {}
  4710.                                         for i = 1,count do
  4711.                                                 local word = gettoken(line, ",", i - 1)
  4712.                                                 table.insert(words, word)
  4713.                                         end
  4714.                                         sendresponse("[" .. tostring(j) .. " - " .. tostring(words[1]) .. " - " .. tostring(words[2]) .. "]", command, executor)
  4715.                                         j = j + 1
  4716.                                         bool = true
  4717.                                 end
  4718.                         end
  4719.                         banlist:close()
  4720.                         if not bool then
  4721.                                 sendresponse("The ipbanlist is empty!", command, executor)
  4722.                         end
  4723.                 else
  4724.                         sendresponse("The ipbanlist is empty!", command, executor)
  4725.                 end
  4726.         else
  4727.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4728.         end
  4729. end
  4730.  
  4731. function RefreshIPBanlist(id, count)
  4732.  
  4733.         ip_banlist = {}
  4734.  
  4735.         for line in io.lines(string.format("%s\\ipbanlist.txt", profilepath)) do
  4736.                 local words = {}
  4737.                 local count = gettokencount(line, ",")
  4738.                 for i = 1,count do
  4739.                         local word = gettoken(line, ",", i - 1)
  4740.                         table.insert(words, word)
  4741.                 end
  4742.                 ip_banlist[tostring(words[1])] = words[2]
  4743.         end
  4744.  
  4745.         return 0
  4746.  
  4747. end
  4748.  
  4749. function Command_Ipunban(executor, command, ID, count)
  4750.         local bool = false
  4751.         if count == 2 and tonumber(ID) then
  4752.                 local file = io.open(profilepath .. "\\ipbanlist.txt", "r")
  4753.                 local Lines = {}
  4754.                 if file then
  4755.                         for line in file:lines() do
  4756.                                 if line ~= "" then
  4757.                                         table.insert(Lines, line)
  4758.                                 end
  4759.                         end
  4760.                         file:close()
  4761.                         file = io.open(string.format("%s\\ipbanlist.txt", profilepath), "w")
  4762.                         ID = tonumber(ID)
  4763.                         for i = 1,#Lines do
  4764.                                 if i ~= ID then
  4765.                                         file:write(tostring(Lines[i]) .. "\n")
  4766.                                 else
  4767.                                         bool = true
  4768.                                 end
  4769.                         end
  4770.  
  4771.                         file:close()
  4772.                         registertimer(500, "RefreshIPBanlist")
  4773.                 else
  4774.                         sendresponse(tostring(ID) .. " is not a valid banlist ID", command, executor)
  4775.                         return
  4776.                 end
  4777.  
  4778.                 if bool then
  4779.                         sendresponse(gettoken(tostring(Lines[ID]), ",", 0) .. " has been unbanned from the IP banlist!", command, executor)
  4780.                 else
  4781.                         sendresponse(tostring(ID) .. " is not a valid banlist ID!", command, executor)
  4782.                 end
  4783.         else
  4784.                 sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
  4785.         end
  4786. end
  4787.  
  4788. function Command_Privatesay(executor, args, count)
  4789.         if count >= 3 and tonumber(args[1]) == nil then
  4790.                 local players = getvalidplayers(args[2], executor)
  4791.                 if players then
  4792.                         local message = ""
  4793.                         for i = 3,#args do
  4794.                                 message = message .. args[i] .. " "
  4795.                         end
  4796.                         for i = 1,#players do
  4797.                                 privatesay(players[i], tostring(message))
  4798.                         end
  4799.                         sendresponse("Private messages sent.", command, executor)
  4800.                 else
  4801.                         sendresponse("Invalid Player!", command, executor)
  4802.                 end
  4803.         else
  4804.                 sendresponse("Invalid Syntax: " .. command .. " [player] [message]", command, executor)
  4805.         end
  4806. end
  4807.  
  4808. function Command_Write(executor, command, type, struct, offset, value, player, count)
  4809.         local offset = tonumber(offset)
  4810.         if count > 4 and count < 7 and tonumber(type) == nil and tonumber(struct) == nil and offset then
  4811.                 local players = getvalidplayers(player, executor)
  4812.                 if players then
  4813.                         for i = 1,#players do
  4814.                                 if struct == "player" then
  4815.                                         struct = getplayer(players[i])
  4816.                                 elseif struct == "object" then
  4817.                                         struct = getobject(getplayerobjectid(players[i]))
  4818.                                         if struct == nil then sendresponse(getname(players[i]) .. " is not alive.", command, executor) return end
  4819.                                 elseif getobject(getplayerobjectid(players[i])) == nil then
  4820.                                         sendresponse(getname(players[i]) .. " is not alive.", command, executor)
  4821.                                         return
  4822.                                 elseif struct == "weapon" then
  4823.                                         local m_object = getobject(getplayerobjectid(players[i]))
  4824.                                         struct = getobject(readdword(m_object, 0x118))
  4825.                                         if struct == nil then sendresponse("Error! " .. getname(players[i]) .. " is not holding a weapon!", command, executor) return end
  4826.                                 elseif tonumber(struct) == nil then
  4827.                                         sendresponse("Invalid Struct. Valid structs are: player, object, and weapon", command, executor)
  4828.                                         return
  4829.                                 end
  4830.                                 if value then
  4831.                                         if type == "byte" then
  4832.                                                 writebyte(struct, offset, value)
  4833.                                         elseif type == "float" then
  4834.                                                 writefloat(struct, offset, value)
  4835.                                         elseif type == "word" then
  4836.                                                 writeword(struct, offset, value)
  4837.                                         elseif type == "dword" then
  4838.                                                 writedword(struct, offset, value)
  4839.                                         else
  4840.                                                 sendresponse("Invalid Type. Valid types are byte, float, word, and dword", command, executor)
  4841.                                                 return
  4842.                                         end
  4843.                                         sendresponse("Writing " .. tostring(value) .. " to struct " .. tostring(struct) .. " at offset " .. tostring(offset) .. " was a success!", command, executor)
  4844.                                 end
  4845.                         end
  4846.                 else
  4847.                         sendresponse("Invalid Player!", command, executor)
  4848.                 end
  4849.         else
  4850.                 sendresponse("Invalid Syntax: " .. command .. " [type] [struct] [offset] [value] [player]", command, executor)
  4851.         end
  4852. end
  4853.  
  4854. function Command_Invis(executor, command, player, time, count)
  4855.         if count == 2 then
  4856.                 local players = getvalidplayers(player, executor)
  4857.                 if players then
  4858.                         for i = 1,#players do
  4859.                                 if getobject(getplayerobjectid(players[i])) and ghost_table[gethash(players[i])] == nil then
  4860.                                         ghost_table[gethash(players[i])] = true
  4861.                                         sendresponse(getname(players[i]) .. " is now invisible!", command, executor)
  4862.                                 elseif ghost_table[gethash(players[i])] then
  4863.                                         sendresponse("Error! " .. getname(players[i]) .. " is already invisible!", command, executor)
  4864.                                 else
  4865.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4866.                                 end
  4867.                         end
  4868.                 else
  4869.                         sendresponse("Invalid Player", command, executor)
  4870.                 end
  4871.         elseif count == 3 and tonumber(time) then
  4872.                 local players = getvalidplayers(player, executor)
  4873.                 if players then
  4874.                         for i = 1,#players do
  4875.                                 if getobject(getplayerobjectid(players[i])) and ghost_table[gethash(players[i])] == nil then
  4876.                                         ghost_table[gethash(players[i])] = tonumber(time)
  4877.                                         sendresponse(getname(players[i]) .. " is now invisible for " .. time .. " seconds!", command, executor)
  4878.                                         privatesay(players[i], "You are now invisible for " .. time .. " seconds.")
  4879.                                 elseif ghost_table[gethash(players[i])] then
  4880.                                         sendresponse("Error! " .. getname(players[i]) .. " is already invisible!", command, executor)
  4881.                                 else
  4882.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4883.                                 end
  4884.                         end
  4885.                 else
  4886.                         sendresponse("Invalid Player", command, executor)
  4887.                 end
  4888.         else
  4889.                 sendresponse("Invalid Syntax: " .. command .. " [player] {time}", command, executor)
  4890.         end
  4891. end
  4892.  
  4893. function Command_Move(executor, command, player, X, Y, Z, count)
  4894.         if count == 5 then
  4895.                 local players = getvalidplayers(player, executor)
  4896.                 if players then
  4897.                         for i = 1,#players do
  4898.                                 local m_playerObjId = getplayerobjectid(players[i])
  4899.                                 if m_playerObjId ~= 0xFFFFFFFF then
  4900.                                         local m_objectId = 0xFFFFFFFF
  4901.                                         local m_vehicleId = readdword(getobject(m_playerObjId), 0x11C)
  4902.                                         if m_vehicleId ~= 0xFFFFFFFF then
  4903.                                                 m_objectId = m_vehicleId
  4904.                                         elseif m_playerObjId ~= 0xFFFFFFFF then
  4905.                                                 m_objectId = m_playerObjId
  4906.                                         end
  4907.                                         if m_objectId ~= 0xFFFFFFFF then
  4908.                                                 local x,y,z = getobjectcoords(m_objectId)
  4909.                                                 movobjcoords(m_objectId, x+X, y+Y, z+Z)
  4910.                                                 sendresponse(getname(players[i]) .. " has been moved!", command, executor)
  4911.                                                 privatesay(players[i], "You have been moved.")
  4912.                                         end
  4913.                                 else
  4914.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  4915.                                 end
  4916.                         end
  4917.                 else
  4918.                         sendresponse("Invalid Player", command, executor)
  4919.                 end
  4920.         else
  4921.                 sendresponse("Invalid Syntax: " .. command .. " [player] [x] [y] [z]", command, executor)
  4922.         end
  4923. end
  4924.  
  4925. function Command_Kill(executor, command, player, count)
  4926.         if executor == 0xFFFFFFFF then return end
  4927.         if count == 2 then
  4928.                 local players = getvalidplayers(player, executor)
  4929.                 if players then
  4930.                         for i = 1,#players do
  4931.                                 kill(players[i])
  4932.                                 sendresponse(getname(players[i]) .. " has been killed!", command, executor)
  4933.                         end
  4934.                 else
  4935.                         sendresponse("Invalid Player!", command, executor)
  4936.                 end
  4937.         else
  4938.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4939.         end
  4940. end
  4941.  
  4942. function Command_lo3(executor, command, count)
  4943.         if count == 1 then
  4944.                 lo3timer = registertimer(2000, "lo3Timer")
  4945.                 sendresponse("Live on three.", command, executor)
  4946.         else
  4947.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  4948.         end
  4949. end
  4950.  
  4951. function Command_Crash(executor, command, player, count)
  4952.         if count == 2 and not gameend then
  4953.                 local players = getvalidplayers(player, executor)
  4954.                 if players then
  4955.                         for i = 1,#players do
  4956.                                 local m_objectId = createobject("vehi", "vehicles\\warthog\\mp_warthog", 0, 0, false, 0, 1, 2)
  4957.                                 for j = 0,20 do
  4958.                                         entervehicle(players[i], m_objectId, j)
  4959.                                         exitvehicle(players[i])
  4960.                                 end
  4961.                                 destroyobject(m_objectId)
  4962.                                 sendresponse(getname(players[i]) .. " had their game crashed by an admin!", command, executor)
  4963.                         end
  4964.                 else
  4965.                         sendresponse("Invalid Player!", command, executor)
  4966.                 end
  4967.         elseif gameend then
  4968.                 sendresposne("You cannot crash a player while the game is ended. Wait until next game.", command, executor)
  4969.         else
  4970.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  4971.         end
  4972. end
  4973.  
  4974. function Command_Map(executor, command)
  4975.         local args = {}
  4976.         local count = getcmdtokencount(command)
  4977.         for i = 1,count do
  4978.                 local word = getcmdtoken(command, i - 1)
  4979.                 word = string.lower(word)
  4980.                 table.insert(args, word)
  4981.         end
  4982.  
  4983.         if count > 2 and tonumber(args) == nil then
  4984.                 local found = false
  4985.                 local arguments = ""
  4986.                 for i = 4,#args do
  4987.                         if arguments == nil then
  4988.                                 arguments = args[i]
  4989.                         else
  4990.                                 arguments = arguments .. " " .. args[i]
  4991.                         end
  4992.                         if args[i] == "commands" and args[i] ~= args[1] and args[i] ~= args[2] and args[i] ~= args[3] then
  4993.                                 found = true
  4994.                         end
  4995.                 end
  4996.  
  4997.                 if not found then
  4998.                         arguments = arguments .. " commands"
  4999.                 end
  5000.                 arguments = string.gsub(arguments, "  ", " ")
  5001.                 if tonumber(arguments) == nil then
  5002.                         local response = ""
  5003.                         if string.sub(args[1], 1, 2) ~= "sv" then
  5004.                                 response = svcmd("sv_map " .. args[2] ..  " \"" .. args[3] .. "\" " .. tostring(arguments), executor)
  5005.                         else
  5006.                                 svcmd("sv_map " .. args[2] ..  " \"" .. args[3] .. "\" " .. tostring(arguments), executor)
  5007.                         end
  5008.                         if response == "" or response == nil then return end
  5009.                         sendresponse(response, args[1], executor)
  5010.                 else
  5011.                         sendresponse("Unknown error occured (wtf?)", args[1], executor)
  5012.                 end
  5013.         else
  5014.                 sendresponse("Invalid Syntax: " .. args[1] .. " [map] [gametype] {script1} {script2}...", args[1], executor)
  5015.         end
  5016. end
  5017.  
  5018. function Command_StartMapcycle(executor, command, count)
  5019.         if count == 1 then
  5020.                 sendresponse(svcmd("sv_mapcycle_begin"), command, executor)
  5021.         else
  5022.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5023.         end
  5024. end
  5025.  
  5026. function Command_Mapnext(executor, command, count)
  5027.         if count == 1 then
  5028.                 sendresponse(svcmd("sv_map_next"), command, executor)
  5029.         else
  5030.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5031.         end
  5032. end
  5033.  
  5034. function Command_Mute(executor, command, player, count)
  5035.         if count == 2 then
  5036.                 local players = getvalidplayers(player, executor)
  5037.                 if players then
  5038.                         for i = 1,#players do
  5039.                                 local hash = gethash(players[i])
  5040.                                 local mute
  5041.                                 if admin_table[hash] or ipadmins[getip(players[i])] then
  5042.                                         mute = true
  5043.                                         break
  5044.                                 end
  5045.                                 if not mute then
  5046.                                         if not mute_table[hash] and not spamtimeout_table[hash] then
  5047.                                                 mute_table[hash] = true
  5048.                                                 sendresponse(getname(players[i]) .. " was muted by an admin!", command, executor)
  5049.                                         else
  5050.                                                 sendresponse(getname(players[i]) .. " has already been muted.", command, executor)
  5051.                                         end
  5052.                                 else
  5053.                                         sendresponse("Admins cannot be muted.", command, executor)
  5054.                                 end
  5055.                         end
  5056.                 else
  5057.                         sendresponse("Invalid Player", command, executor)
  5058.                 end
  5059.         else
  5060.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5061.         end
  5062. end
  5063.  
  5064. function Command_Nuke(executor, command, player, count)
  5065.         if count == 2 then
  5066.                 local players = getvalidplayers(player, executor)
  5067.                 if players then
  5068.                         for i = 1,#players do
  5069.                                 local name = getname(players[i])
  5070.                                 local m_objectId = getplayerobjectid(players[i])
  5071.                                 if m_objectId ~= 0xFFFFFFFF then
  5072.                                         local m_object = getobject(m_objectId)
  5073.                                         local x,y,z = getobjectcoords(m_objectId)
  5074.                                         for j = 1,5 do
  5075.                                                 local nukeproj = createobject("eqip", "weapons\\frag grenade\\frag grenade", m_objectId, 0, false, x, y, z+10)
  5076.                                                 table.insert(nukes, nukeproj)
  5077.                                                 local m_proj = getobject(nukeproj)
  5078.                                                 --writefloat(m_proj, 0x70, -5)
  5079.                                         end
  5080.                                 else
  5081.                                         sendresponse("Cannot nuke " .. name .. " because they are dead", command, executor)
  5082.                                 end
  5083.                         end
  5084.                 else
  5085.                         sendresponse("Invalid Player!", command, executor)
  5086.                 end
  5087.         elseif count == 1 then
  5088.                 sendresponse("Syntax: " .. command .. " [player]", command, executor)
  5089.         else
  5090.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5091.         end
  5092. end
  5093.  
  5094. function Command_Noweapons(executor, command, boolean, count)
  5095.         if count == 1 then
  5096.                 if noweapons then
  5097.                         sendresponse("Noweapons mode is currently enabled.", command, executor)
  5098.                 else
  5099.                         sendresponse("Noweapons mode is currently disabled.", command, executor)
  5100.                 end
  5101.         elseif count == 2 then
  5102.                 if (boolean == "1" or boolean == "true") and not noweapons then
  5103.                         for i = 0,15 do
  5104.                                 if getplayer(i) then
  5105.                                         local m_object = getobject(getplayerobjectid(i))
  5106.                                         if m_object then
  5107.                                                 for j = 0,3 do
  5108.                                                         local weap_id = readdword(m_object, 0x2F8 + (j*4))
  5109.                                                         if getobject(weap_id) then
  5110.                                                                 destroyobject(weap_id)
  5111.                                                         end
  5112.                                                 end
  5113.                                         end
  5114.                                 end
  5115.                         end
  5116.                         sendresponse("Noweapons is now on. You cannot pick up weapons.", command, executor)
  5117.                         noweapons = true
  5118.                 elseif boolean == "1" or boolean == "true" then
  5119.                         sendresponse("Noweapons is already enabled!", command, executor)
  5120.                 elseif boolean ~= "0" and boolean ~= "false" then
  5121.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  5122.                 elseif (boolean == "0" or boolean == "false") and noweapons then
  5123.                         for i = 0,15 do
  5124.                                 if getplayer(i) and getplayerobjectid(i) ~= 0xFFFFFFFF then
  5125.                                         local hash = gethash(i)
  5126.                                         if Noweapons[hash] then Noweapons[hash] = nil end
  5127.                                         resetweapons(i)
  5128.                                 end
  5129.                         end
  5130.                         sendresponse("Noweapons mode is now off.", command, executor)
  5131.                         noweapons = false
  5132.                 elseif noweapons == nil then
  5133.                         sendresponse("Noweapons mode is now off.", command, executor)
  5134.                         noweapons = false
  5135.                 elseif boolean == "0" or boolean == "false" then
  5136.                         sendresponse("Noweapons is already disabled!", command, executor)
  5137.                 else
  5138.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  5139.                 end
  5140.         else
  5141.                 sendresponse("Invalid Syntax: " .. command .. " [boolean]", command, executor)
  5142.         end
  5143. end
  5144.  
  5145. function Command_Takeweapons(executor, command, player, count)
  5146.         if count == 2 then
  5147.                 local players = getvalidplayers(player, executor)
  5148.                 if players then
  5149.                         for i = 1,#players do
  5150.                                 local hash = gethash(players[i])
  5151.                                 if Noweapons[hash] == nil then
  5152.                                         Noweapons[hash] = 1
  5153.                                         local m_object = getobject(getplayerobjectid(players[i]))
  5154.                                         if m_object then
  5155.                                                 for j = 0,3 do
  5156.                                                         local m_weaponId = readdword(m_object, 0x2F8 + j*4)
  5157.                                                         local m_weapon = getobject(m_weaponId)
  5158.                                                         if m_weapon then
  5159.                                                                 destroyobject(m_weaponId)
  5160.                                                         end
  5161.                                                 end
  5162.                                         end
  5163.                                         sendresponse(getname(players[i]) .. " now has no weapons!", command, executor)
  5164.                                 else
  5165.                                         sendresponse(getname(players[i]) .. " already has no weapons!", command, executor)
  5166.                                 end
  5167.                         end
  5168.                 else
  5169.                         sendresponse("Invalid Player!", command, executor)
  5170.                 end
  5171.         else
  5172.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5173.         end
  5174. end
  5175.  
  5176. function Command_Textban(executor, command, player, count)
  5177.         if count == 2 then
  5178.                 local players = getvalidplayers(player, executor)
  5179.                 local file = io.open(string.format("%s\\textbanlist.txt", profilepath), "a")
  5180.                 if players then
  5181.                         for i = 1,#players do
  5182.                                 local name = getname(players[i])
  5183.                                 local ip = getip(players[i])
  5184.                                 local hash = gethash(players[i])
  5185.                                 if admin_table[hash] or ipadmins[ip] then
  5186.                                         sendresponse("Admins cannot be banned from the chat.", command, executor)
  5187.                                 else
  5188.                                         mute_banlist[name] = {ip, hash}
  5189.                                         file:write(tostring(name) .. "," .. tostring(hash) .. "," .. tostring(ip) .. "\n")
  5190.                                         sendresponse(tostring(name) .. " has been banned from the chat!", command, executor)
  5191.                                 end
  5192.                         end
  5193.                 else
  5194.                         sendresponse("Invalid Player!", command, executor)
  5195.                 end
  5196.                 file:close()
  5197.         elseif count == 1 then
  5198.                 sendresponse("Syntax: " .. command .. " [player]", command, executor)
  5199.         else
  5200.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5201.         end
  5202. end
  5203.  
  5204. function Command_Textbanlist(executor, command, count)
  5205.         if count == 1 then
  5206.                 local banlist = io.open(profilepath .. "\\textbanlist.txt")
  5207.                 local j = 1
  5208.                 local bool = false
  5209.                 if banlist then
  5210.                         sendresponse("[Num - Name - Hash - IP]", command, executor)
  5211.                         for line in banlist:lines() do
  5212.                                 if line and line ~= "" then
  5213.                                         local count = gettokencount(line, ",")
  5214.                                         local words = {}
  5215.                                         for i = 1,count do
  5216.                                                 local word = gettoken(line, ",", i - 1)
  5217.                                                 table.insert(words, word)
  5218.                                         end
  5219.                                         sendresponse("[" .. tostring(j) .. " - " .. tostring(words[1]) .. " - " .. tostring(words[2]) .. " - " .. tostring(words[3]) .. "]", command, executor)
  5220.                                         j = j + 1
  5221.                                         bool = true
  5222.                                 end
  5223.                         end
  5224.                         banlist:close()
  5225.                         if not bool then
  5226.                                 sendresponse("The textbanlist is empty!", command, executor)
  5227.                         end
  5228.                 else
  5229.                         sendresponse("The textbanlist is empty!", command, executor)
  5230.                 end
  5231.         else
  5232.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5233.         end
  5234. end
  5235.  
  5236. function RefreshTextBanlist(id, count)
  5237.  
  5238.         mute_banlist = {}
  5239.  
  5240.         for line in io.lines(string.format("%s\\textbanlist.txt", profilepath)) do
  5241.                 local words = {}
  5242.                 local count = gettokencount(line, ",")
  5243.                 for i = 1,count do
  5244.                         local word = gettoken(line, ",", i - 1)
  5245.                         table.insert(words, word)
  5246.                 end
  5247.                 mute_banlist[tostring(words[1])] = {words[2], words[3]}
  5248.         end
  5249.  
  5250.         return 0
  5251.  
  5252. end
  5253.  
  5254. function Command_Textunban(executor, command, ID, count)
  5255.         local bool = false
  5256.         if count == 2 and tonumber(ID) then
  5257.                 local file = io.open(profilepath .. "\\textbanlist.txt", "r")
  5258.                 local Lines = {}
  5259.                 if file then
  5260.                         for line in file:lines() do
  5261.                                 if line ~= "" then
  5262.                                         table.insert(Lines, line)
  5263.                                 end
  5264.                         end
  5265.                         file:close()
  5266.                         file = io.open(string.format("%s\\textbanlist.txt", profilepath), "w")
  5267.                         ID = tonumber(ID)
  5268.                         for i = 1,#Lines do
  5269.                                 if i ~= ID then
  5270.                                         file:write(tostring(Lines[i]) .. "\n")
  5271.                                 else
  5272.                                         bool = true
  5273.                                 end
  5274.                         end
  5275.                         file:close()
  5276.                         registertimer(500, "RefreshTextBanlist")
  5277.                 else
  5278.                         sendresponse(tostring(ID) .. " is not a valid banlist ID", command, executor)
  5279.                         return
  5280.                 end
  5281.  
  5282.                 if bool then
  5283.                         sendresponse(gettoken(tostring(Lines[ID]), ",", 0) .. " has been unbanned from the chat!", command, executor)
  5284.                 else
  5285.                         sendresponse(tostring(ID) .. " is not a valid banlist ID!", command, executor)
  5286.                 end
  5287.         else
  5288.                 sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
  5289.         end
  5290. end
  5291.  
  5292. function Command_Resetweapons(executor, command, player, count)
  5293.         if count == 2 then
  5294.                 local players = getvalidplayers(player, executor)
  5295.                 if players then
  5296.                         for i = 1,#players do
  5297.                                 local hash = gethash(players[i])
  5298.                                 if Noweapons[hash] then
  5299.                                         Noweapons[hash] = nil
  5300.                                         local m_object = getobject(getplayerobjectid(players[i]))
  5301.                                         if m_object then
  5302.                                                 resetweapons(players[i])
  5303.                                                 sendresponse(getname(players[i]) .. " had their weapons reset!", command, executor)
  5304.                                         end
  5305.                                 else
  5306.                                         sendresponse(getname(players[i]) .. " never had their weapons taken away!", command, executor)
  5307.                                 end
  5308.                         end
  5309.                 else
  5310.                         sendresponse("Invalid Player!", command, executor)
  5311.                 end
  5312.         else
  5313.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5314.         end
  5315. end
  5316.  
  5317. function Command_Setpassword(executor, command, password, count)
  5318.         if count == 1 then
  5319.                 local response = svcmd("sv_password")
  5320.                 if response then
  5321.                         sendresponse(response, command, executor)
  5322.                 else
  5323.                         sendresponse("Critical error." .. passwrd .. "'", command, executor)
  5324.                 end
  5325.         elseif count == 2 then
  5326.                 if password == "" then
  5327.                         svcmd('sv_password ""')
  5328.                         sendresponse("Password has been taken off", command, executor)
  5329.                         passwrd = nil
  5330.                 elseif passwrd then
  5331.                         svcmd('sv_password ' .. password)
  5332.                         sendresponse("The password is now " .. password, command, executor)
  5333.                         passwrd = password
  5334.                 else
  5335.                         sendresponse("An internal error has occured.\nPlease inform the developer «¬EpºWizard", command, executor)
  5336.                 end
  5337.         else
  5338.                 sendresponse("Invalid Syntax: " .. command .. " {password}", command, executor)
  5339.         end
  5340. end
  5341.  
  5342. function Command_Getplayerlist(executor, command, count)
  5343.         if count == 1 then
  5344.                 local message = svcmd("sv_players")
  5345.                 sendresponse(message, command, executor)
  5346.         else
  5347.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5348.         end
  5349. end
  5350.  
  5351. function Command_Mapreset(executor, command, count)
  5352.         if count == 1 then
  5353.                 sendresponse("The map has been reset", command, executor)
  5354.                 svcmd("sv_map_reset")
  5355.         else
  5356.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5357.         end
  5358. end
  5359.  
  5360. function Command_Viewadmins(executor, command, count)
  5361.         if count == 1 then
  5362.                 sendresponse("The current admins in the server are listed below:", command, executor)
  5363.                 sendresponse("[Level] Name: Admin types", command, executor)
  5364.                 local admins = {}
  5365.                 for i = 0,15 do
  5366.                         local hash = gethash(i)
  5367.                         if hash then
  5368.                                 local name = getname(i)
  5369.                                 if admin_table[hash] then
  5370.                                         admins[name] = {"hash", "notip", admin_table[hash].level}
  5371.                                 end
  5372.                                 if ipadmins[getip(i)] then
  5373.                                         if admins[name] and admins[name] ~= {} then
  5374.                                                 admins[name][2] = "ip"
  5375.                                         else
  5376.                                                 admins[name] = {"nothash", "ip", ipadmins[getip(i)].level}
  5377.                                         end
  5378.                                 end
  5379.                         end
  5380.                 end
  5381.                 for k,v in pairs(admins) do
  5382.                         local message = ""
  5383.                         if admins[k][1] == "hash" and admins[k][2] == "ip" then
  5384.                                 message = "[" .. admins[k][3] .. "] " .. k .. ": Hash Admin  IP Admin"
  5385.                         elseif admins[k][1] == "hash" then
  5386.                                 message = "[" .. admins[k][3] .. "] " .. k .. ": Hash Admin"
  5387.                         elseif admins[k][2] == "ip" then
  5388.                                 message = "[" .. admins[k][3] .. "] " .. k .. ": IP Admin"
  5389.                         end
  5390.                         sendresponse(message, command, executor)
  5391.                 end
  5392.         else
  5393.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5394.         end
  5395. end
  5396.  
  5397. function Command_Adminrevoke(executor, command, player, count, type)
  5398.         if count == 2 then
  5399.                 local players = getvalidplayers(player, executor)
  5400.                 if players then
  5401.                         for j = 1,#players do
  5402.                                 local hash = gethash(players[j])
  5403.                                 local ip = getip(players[j])
  5404.                                 if ipadmins[ip] or admin_table[hash] then
  5405.                                         admin_table[hash] = nil
  5406.                                         ipadmins[ip] = nil
  5407.                                         sendresponse(getname(players[j]) .. " is no longer an admin!", command, executor)
  5408.                                 else
  5409.                                         sendresponse("Error! " .. getname(players[j]) .. " is not an admin!", command, executor)
  5410.                                 end
  5411.                         end
  5412.                 else
  5413.                         sendresponse("Invalid Player!", command, executor)
  5414.                 end
  5415.         else
  5416.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  5417.         end
  5418. end
  5419.  
  5420. function reloadadmins(id, count)
  5421.  
  5422.         local file = io.open(string.format("%s\\admin.txt", profilepath), "r")
  5423.         if file then
  5424.                 for line in file:lines() do
  5425.                         local words = {}
  5426.                         local count = gettokencount(line, ",")
  5427.                         for i = 1,count do
  5428.                                 local word = gettoken(line, ",", i - 1)
  5429.                                 table.insert(words, word)
  5430.                         end
  5431.                         if not admin_table[words[2]] then admin_table[words[2]] = {} end
  5432.                         admin_table[words[2]].name = words[1]
  5433.                         admin_table[words[2]].level = words[3]
  5434.                         if count == 4 and tonumber(words[3]) then
  5435.                                 if not ipadmins[words[4]] then ipadmins[words[4]] = {} end
  5436.                                 ipadmins[words[4]].name = words[1]
  5437.                                 ipadmins[words[4]].level = words[3]
  5438.                         end
  5439.                 end
  5440.                 file:close()
  5441.         end
  5442.         file = io.open(profilepath .. "\\ipadmins.txt", "r")
  5443.         if file then
  5444.                 for line in file:lines() do
  5445.                         local words = {}
  5446.                         local count = gettokencount(line, ",")
  5447.                         for i = 1,count do
  5448.                                 local word = gettoken(line, ",", i - 1)
  5449.                                 table.insert(words, word)
  5450.                         end
  5451.                         if not ipadmins[words[2]] then ipadmins[words[2]] = {} end
  5452.                         ipadmins[words[2]].name = words[1]
  5453.                         ipadmins[words[2]].level = words[3]
  5454.                 end
  5455.                 file:close()
  5456.         end
  5457.  
  5458.         return 0
  5459.  
  5460. end
  5461.  
  5462. function Command_Banlist(executor, command, count)
  5463.         if count == 1 then
  5464.                 sendresponse(svcmd("sv_banlist"), command, executor)
  5465.         else
  5466.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5467.         end
  5468. end
  5469.  
  5470. function Command_Resp(executor, command, player, time, count)
  5471.         if count == 3 and tonumber(time) then
  5472.                 local players = getvalidplayers(player, executor)
  5473.                 if players then
  5474.                         for i = 1,#players do
  5475.                                 local m_player = getplayer(players[i])
  5476.                                 writedword(m_player, 0x2c, time * 33)
  5477.                                 sendresponse("Setting " .. getname(players[i]) .. "'s respawn time to " .. time .. " seconds!", command, executor)
  5478.                         end
  5479.                 else
  5480.                         sendresponse("Invalid Player", command, executor)
  5481.                 end
  5482.         else
  5483.                 sendresponse("Invalid Syntax: " .. command .. " [player] [time]", command, executor)
  5484.         end
  5485. end
  5486.  
  5487. function Command_Timelimit(executor, command, time, count)
  5488.         if count == 1 then
  5489.                 local time_passed = readdword(readdword(gametime_base, 0x0), 0xC) / 1800
  5490.                 local timelimit = readdword(gametype_base, 0x78) / 1800
  5491.                 local time_left = timelimit - time_passed
  5492.                 local Timelimit = readdword(timelimit_address, 0x0)
  5493.                 sendresponse("Current Timelimit is " .. Timelimit .. " minutes. Time remaining: " .. tostring(round(time_left, 0)) .. " minutes.", command, executor)
  5494.         elseif count == 2 and tonumber(time) then
  5495.                 settimelimit(time)
  5496.                 sendresponse("Timelimit set to " .. time .. " minutes!", command, executor)
  5497.         else
  5498.                 sendresponse("Invalid Syntax: " .. command .. " {time}", command, executor)
  5499.         end
  5500. end
  5501.  
  5502. function Command_Setassists(executor, command, player, assists, count)
  5503.         if count == 3 and tonumber(assists) then
  5504.                 local players = getvalidplayers(player, executor)
  5505.                 if players then
  5506.                         for i = 1,#players do
  5507.                                 local m_player = getplayer(players[i])
  5508.                                 local Assists = tonumber(assists)
  5509.                                 if Assists > 0x7FFF then
  5510.                                         writewordsigned(m_player, 0xA4, 0x7FFF)
  5511.                                 elseif Assists < -0x7FFF then
  5512.                                         writewordsigned(m_player, 0xA4, -0x7FFF)
  5513.                                 else
  5514.                                         writewordsigned(m_player, 0xA4, Assists)
  5515.                                 end
  5516.                                 sendresponse(getname(players[i]) .. " had their assists set to " .. assists, command, executor)
  5517.                         end
  5518.                 else
  5519.                         sendresponse("Invalid Player", command, executor)
  5520.                 end
  5521.         else
  5522.                 regstertimer(0, "delayMsg", "Invalid Syntax: " .. command .. " [player] [assists]", command, executor)
  5523.         end
  5524. end
  5525.  
  5526. function Command_Setdeaths(executor, command, player, deaths, count)
  5527.         if count == 3 and tonumber(deaths) then
  5528.                 local players = getvalidplayers(player, executor)
  5529.                 if players then
  5530.                         for i = 1,#players do
  5531.                                 local m_player = getplayer(players[i])
  5532.                                 Deaths = tonumber(deaths)
  5533.                                 if Deaths > 0x7FFF then
  5534.                                         writewordsigned(m_player, 0xAE, 0x7FFF)
  5535.                                 elseif Deaths < -0x7FFF then
  5536.                                         writewordsigned(m_player, 0xAE, -0x7FFF)
  5537.                                 else
  5538.                                         writewordsigned(m_player, 0xAE, Deaths)
  5539.                                 end
  5540.                                 sendresponse(getname(players[i]) .. " had their deaths set to " .. deaths, command, executor)
  5541.                         end
  5542.                 else
  5543.                         sendresponse("Invalid Player", command, executor)
  5544.                 end
  5545.         else
  5546.                 regstertimer(0, "delayMsg", "Invalid Syntax: " .. command .. " [player] [deaths]", command, executor)
  5547.         end
  5548. end
  5549.  
  5550. function Command_Setfrags(executor, command, player, frags, count)
  5551.         if count == 3 and tonumber(frags) then
  5552.                 local players = getvalidplayers(player, executor)
  5553.                 if players then
  5554.                         for i = 1,#players do
  5555.                                 local m_object = getobject(getplayerobjectid(players[i]))
  5556.                                 if m_object then
  5557.                                         writebyte(m_object, 0x31E, frags)
  5558.                                         sendresponse("Setting " .. getname(players[i]) .. "'s frag grenades to " .. frags, command, executor)
  5559.                                         sendresponse("Your frag grenades were set to " .. frags, "\\", players[i])
  5560.                                 else
  5561.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  5562.                                 end
  5563.                         end
  5564.                 else
  5565.                         sendresponse("Invalid Player", command, executor)
  5566.                 end
  5567.         else
  5568.                 sendresponse("Invalid Syntax: " .. command .. " [player] [amount]", command, executor)
  5569.         end
  5570. end
  5571.  
  5572. function Command_Setname(executor, command, player, name, count)
  5573.         if count == 2 then
  5574.                 local players = getvalidplayers(player, executor)
  5575.                 if players then
  5576.                         for i = 1,#players do
  5577.                                 local m_player = getplayer(players[i])
  5578.                                 local name2 = getname(players[i])
  5579.                                 local player_name = readstring(m_player, 0x4, 11)
  5580.                                 local player_name2 = readstring(m_player, 0x48, 11)
  5581.                                 local player_name3 = tostring(readtagname(name_base+players[i]*4))
  5582.                                 if tostring(player_name) == tostring(player_name2) and tostring(player_name) == tostring(player_name3) then
  5583.                                         sendresponse(name2 .. "'s current name is " .. tostring(player_name), command, executor)
  5584.                                 else
  5585.                                         sendresponse("An unknown error has occured.", command, executor)
  5586.                                 end
  5587.                         end
  5588.                 else
  5589.                         sendresponse("Invalid Player!", command, executor)
  5590.                 end
  5591.         elseif count == 3 then
  5592.                 local players = getvalidplayers(player, executor)
  5593.                 if players then
  5594.                         for i = 1,#players do
  5595.                                 if players[2] == nil then
  5596.                                         local name2 = getname(players[i])
  5597.                                         local m_player = getplayer(players[i])
  5598.                                         local player_name = tostring(readtagname(name_base+players[i]*4))
  5599.                                         local length = string.len(name2)
  5600.                                         if string.len(name) < length then
  5601.                                                 for i = string.len(name),length do
  5602.                                                         name = name .. " "
  5603.                                                 end
  5604.                                         end
  5605.                                         --writestring(tostring(name), m_player, 0x4, 0x2)
  5606.                                         --writestring(tostring(name), m_player, 0x48, 0x2)
  5607.                                         writestring(tostring(name), name_base, 0x20*players[i], 0x2)
  5608.                                         sendresponse(name2 .. "'s name has been changed to " .. name, command, executor)
  5609.                                 else
  5610.                                         sendresponse("You cannot change multiple people's name at once.", command, executor)
  5611.                                 end
  5612.                         end
  5613.                 else
  5614.                         sendresponse("Invalid Player!", command, executor)
  5615.                 end
  5616.         else
  5617.                 sendresponse("Invalid Syntax: " .. command .. " [player] {name}", command, executor)
  5618.         end
  5619. end
  5620.  
  5621.  
  5622. function Command_Setkills(executor, command, player, kills, count)
  5623.         if count == 3 then
  5624.                 local players = getvalidplayers(player, executor)
  5625.                 if players then
  5626.                         for i = 1,#players do
  5627.                                 local m_player = getplayer(players[i])
  5628.                                 kills = tonumber(kills)
  5629.                                 if kills > 0x7FFF then
  5630.                                         writewordsigned(m_player, 0x9C, 0x7FFF)
  5631.                                 elseif kills < -0x7FFF then
  5632.                                         writewordsigned(m_player, 0x9C, -0x7FFF)
  5633.                                 else
  5634.                                         writewordsigned(m_player, 0x9C, kills)
  5635.                                 end
  5636.                                 sendresponse(getname(players[i]) .. " had their kills set to " .. kills, command, executor)
  5637.                         end
  5638.                 else
  5639.                         sendresponse("Invalid Player", command, executor)
  5640.                 end
  5641.         else
  5642.                 sendresponse("Invalid Syntax: " .. command .. " [player] [kills]", command, executor)
  5643.         end
  5644. end
  5645.  
  5646. function Command_Setresp(executor, command, time, count)
  5647.         if count == 2 then
  5648.                 if time == "default" then
  5649.                         respset = false
  5650.                         sendresponse("Respawn time set to the gametype's default setting!", command, executor)
  5651.                 elseif tonumber(time) then
  5652.                         resptime = time
  5653.                         respset = true
  5654.                         sendresponse("Respawn time set to " .. time .. " seconds!", command, executor)
  5655.                 elseif respset == nil then
  5656.                         sendresponse("Respawn time not set. Defaulting to gametype's default setting.", command, executor)
  5657.                 else
  5658.                         sendresponse("Invalid Syntax: " .. command .. " [seconds]", command, executor)
  5659.                 end
  5660.         else
  5661.                 sendresponse("Invalid Syntax: " .. command .. " [seconds]", command, executor)
  5662.         end
  5663. end
  5664.  
  5665. Command_Setplasmas = function(executor, command, player, plasmas, count)
  5666.         if count == 3 and tonumber(plasmas) then
  5667.                 local players = getvalidplayers(player, executor)
  5668.                 if players then
  5669.                         for i = 1,#players do
  5670.                                 local m_object = getobject(getplayerobjectid(players[i]))
  5671.                                 if m_object then
  5672.                                         writebyte(m_object, 0x31F, plasmas)
  5673.                                         sendresponse("Setting " .. getname(players[i]) .. "'s plasma grenades to " .. plasmas, command, executor)
  5674.                                 else
  5675.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  5676.                                 end
  5677.                         end
  5678.                 else
  5679.                         sendresponse("Invalid Player", command, executor)
  5680.                 end
  5681.         else
  5682.                 sendresponse("Invalid Syntax: sv_setplasmas [player] [amount]", command, executor)
  5683.         end
  5684. end
  5685.  
  5686. GetGameAddresses = function()
  5687.         local map_header_version = readbyte(0x630e74, 0x4)
  5688.         if map_header_version == 7 then
  5689.                 ctf_globals = 0x639B98 -- Confirmed.
  5690.                 oddball_globals = 0x639E18 -- Confirmed.
  5691.                 slayer_globals = 0x63A0E8
  5692.                 name_base = 0x745D4A
  5693.                 specs_addr = 0x662D04
  5694.                 map_addr = 0x698F21
  5695.                 hashcheck_addr = 0x59c280
  5696.                 versioncheck_addr = 0x5152E7
  5697.                 map_pointer = 0x63525c
  5698.                 gametype_base = 0x671340
  5699.                 gametime_base = 0x671420
  5700.                 machine_pointer = 0x745BA0
  5701.                 version_address = 0x5DF840
  5702.                 timelimit_address = 0x626630
  5703.                 profilepath = 0x6A0A99
  5704.                 special_chars = 0x517D6B -- special chars in svname patch
  5705.                 gametype_patch = 0x481F3C -- gametype patch
  5706.                 devmode_patch1 = 0x4A4DBF -- devmode
  5707.                 devmode_patch2 = 0x4A4E7F -- devmode
  5708.                 return "PC"
  5709.         else
  5710.                 ctf_globals = 0x5BDBB8 -- Confirmed.
  5711.                 oddball_globals = 0x5BDE78 -- Confirmed.
  5712.                 slayer_globals = 0x5BE108
  5713.                 name_base = 0x6C7B6A
  5714.                 specs_addr = 0x5E6E63
  5715.                 map_addr = 0x61D151
  5716.                 hashcheck_addr = 0x530130
  5717.                 versioncheck_addr = 0x4CB587
  5718.                 map_pointer = 0x5B927C
  5719.                 gametype_base = 0x5F5498
  5720.                 gametime_base = 0x5F55BC
  5721.                 machine_pointer = 0x6C7980
  5722.                 version_address = 0x564B34
  5723.                 gametype_patch = 0x45E50C
  5724.                 devmode_patch1 = 0x47DF0C
  5725.                 devmode_patch2 = 0x47DFBC -- devmode
  5726.                 return "CE"
  5727.         end
  5728. end
  5729.  
  5730. function Command_Setspeed(executor, command, player, speed, count)
  5731.         if count == 2 then
  5732.                 local players = getvalidplayers(player, executor)
  5733.                 if players then
  5734.                         for i = 1,#players do
  5735.                                 local m_player = getplayer(players[i])
  5736.                                 local cur_speed = readfloat(m_player, 0x6C)
  5737.                                 sendresponse(getname(players[i]) .. "'s speed is currently " .. cur_speed, command, executor)
  5738.                         end
  5739.                 else
  5740.                         sendresponse("Invalid Player!", command, executor)
  5741.                 end
  5742.         elseif count == 3 and tonumber(speed) then
  5743.                 local players = getvalidplayers(player, executor)
  5744.                 if players then
  5745.                         for i = 1,#players do
  5746.                                 setspeed(players[i], speed)
  5747.                                 sendresponse(getname(players[i]) .. " had their speed changed to " .. speed, command, executor)
  5748.                         end
  5749.                 else
  5750.                         sendresponse("Invalid Player!", command, executor)
  5751.                 end
  5752.         else
  5753.                 sendresponse("Invalid Syntax: " .. command .. " [player] {speed}", command, executor)
  5754.         end
  5755. end
  5756.  
  5757. function Command_Specs(executor, command, count)
  5758.         if count == 1 then
  5759.                 local specs = readtagname(specs_addr)
  5760.                 sendresponse("The server specs are: " .. tostring(specs), command, executor)
  5761.         else
  5762.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  5763.         end
  5764. end
  5765.  
  5766. function Command_Spawn(executor, command, object, player, amount, resptime, recycle, type, count)
  5767.         local bool = true
  5768.         if type == "enter" then
  5769.                 if count == 2 then
  5770.                         if executor ~= 0xFFFFFFFF then
  5771.                                 player = resolveplayer(executor)
  5772.                         else
  5773.                                 sendresponse("what are you doing, the server isn't a player, it can't enter a vehicle...", command, executor)
  5774.                                 return
  5775.                         end
  5776.                 elseif count == 3 then
  5777.                         if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then
  5778.                                 player = resolveplayer(executor)
  5779.                         end
  5780.                 else
  5781.                         sendresponse("Invalid Syntax: " .. command .. " [vehicle] {player}", command, executor)
  5782.                         return
  5783.                 end
  5784.                 message = command .. " " .. object .. " " .. player
  5785.         elseif type == "give" then
  5786.                 if count == 2 then
  5787.                         if executor ~= 0xFFFFFFFF then
  5788.                                 player = resolveplayer(executor)
  5789.                         else
  5790.                                 sendresponse("what are you doing, the server isn't a player, it can't be given a weapon...", command, executor)
  5791.                                 return
  5792.                         end
  5793.                 elseif count == 3 then
  5794.                         if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then
  5795.                                 player = resolveplayer(executor)
  5796.                         end
  5797.                 else
  5798.                         sendresponse("Invalid Syntax: " .. command .. " [weapon] {player}", command, executor)
  5799.                         return
  5800.                 end
  5801.                 message = command .. " " .. object .. " " .. player
  5802.         elseif type == "spawn" then
  5803.                 if count == 2 then
  5804.                         if executor ~= 0xFFFFFFFF then
  5805.                                 message = command .. " " .. object .. " " .. resolveplayer(executor)
  5806.                         else
  5807.                                 sendresponse("what are you doing, the server isn't a player, you can't spawn at its locations...", command, executor)
  5808.                                 return
  5809.                         end
  5810.                 elseif count == 3 then
  5811.                         if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then
  5812.                                 player = resolveplayer(executor)
  5813.                         end
  5814.                         message = command .. " " .. object .. " " .. player
  5815.                 elseif count == 4 then
  5816.                         message = command .. " " .. object .. " " .. player .. " " .. amount
  5817.                 elseif count == 5 then
  5818.                         message = command .. " " .. object .. " " .. player .. " " .. amount .. " " .. resptime
  5819.                 elseif count == 6 then
  5820.                         message = command .. " " .. object .. " " .. player .. " " .. amount .. " " .. resptime .. " " .. recycle
  5821.                 else
  5822.                         sendresponse("Invalid Syntax: " .. command .. " [object] {player} {amount} {resptime} {recycle}", command, executor)
  5823.                         return
  5824.                 end
  5825.         else
  5826.                 sendresponse("An unknown error has occured.", command, executor)
  5827.         end
  5828.         if type == "spawn" then
  5829.                 bool = true
  5830.                 if object == "cyborg" or object == "bot" or object == "mastercheif" or object == "biped" or object == "bipd" then
  5831.                         Spawn(message, "Cyborg", "bipd", "characters\\cyborg_mp\\cyborg_mp", executor, type)
  5832.                 elseif object == "captain" or object == "keyes" then
  5833.                         Spawn(message, "Captain Keyes", "bipd", "characters\\captain\\captain", executor, type)
  5834.                 elseif object == "cortana" then
  5835.                         Spawn(message, "Cortana", "bipd", "characters\\cortana\\cortana", executor, type)
  5836.                 elseif object == "cortana2" then
  5837.                         Spawn(message, "Cortana2", "bipd", "characters\\cortana\\halo_enhanced\\halo_enhanced", executor, type)
  5838.                 elseif object == "crewman" then
  5839.                         Spawn(message, "Crewman", "bipd", "characters\\crewman\\crewman", executor, type)
  5840.                 elseif object == "elite" then
  5841.                         Spawn(message, "elite", "bipd", "characters\\elite\\elite", executor, type)
  5842.                 elseif object == "elite2" then
  5843.                         Spawn(message, "Elite Special", "bipd", "characters\\elite\\elite special", executor, type)
  5844.                 elseif object == "engineer" then
  5845.                         Spawn(message, "Engineer", "bipd", "characters\\engineer\\engineer", executor, type)
  5846.                 elseif object == "flood" then
  5847.                         Spawn(message, "Flood Captain", "bipd", "characters\\flood_captain\\flood_captain", executor, type)
  5848.                 elseif object == "flood2" then
  5849.                         Spawn(message, "Flood Infection", "bipd", "characters\\flood_infection\\flood_infection", executor, type)
  5850.                 elseif object == "flood3" then
  5851.                         Spawn(message, "Flood Carrier", "bipd", "characters\\floodcarrier\\floodcarrier", executor, type)
  5852.                 elseif object == "floodelite" then
  5853.                         Spawn(message, "FloodCombat Elite", "bipd", "characters\\floodcombat elite\\floodcombat elite", executor, type)
  5854.                 elseif object == "floodhuman" then
  5855.                         Spawn(message, "FloodCombat Human", "bipd", "characters\\floodcombat_human\\floodcombat_human", executor, type)
  5856.                 elseif object == "pedobear" or object == "grunt" then
  5857.                         Spawn(message, "Pedobear", "bipd", "characters\\grunt\\grunt", executor, type)
  5858.                 elseif object == "hunter" then
  5859.                         Spawn(message, "Hunter", "bipd", "characters\\hunter\\hunter", executor, type)
  5860.                 elseif object == "marine" then
  5861.                         Spawn(message, "Marine", "bipd", "characters\\marine\\marine", executor, type)
  5862.                 elseif object == "marinesuicide" or object == "marine2" then
  5863.                         Spawn(message, "Marine Suicidal", "bipd", "characters\\marine_suicidal\\marine_suicidal", executor, type)
  5864.                 elseif object == "monitor" then
  5865.                         Spawn(message, "Monitor", "bipd", "characters\\monitor\\monitor", executor, type)
  5866.                 elseif object == "sentinel" then
  5867.                         Spawn(message, "Sentinel", "bipd", "characters\\sentinel\\sentinel", executor, type)
  5868.                 elseif object == "johnson" then
  5869.                         Spawn(message, "Sgt. Johnson", "bipd", "characters\\johnson\\johnson", executor, type)
  5870.                 --Objects with 'eqip' tags
  5871.                 elseif object == "camo" or object == "camouflage" then
  5872.                         Spawn(message, "Camouflage", "eqip", "powerups\\active camouflage", executor, type)
  5873.                 elseif object == "dblspd" then
  5874.                         Spawn(message, "Double Speed", "eqip", "powerups\\double speed", executor, type)
  5875.                 elseif object == "fullspec" then
  5876.                         Spawn(message, "Full-Spectrum Vision", "eqip", "powerups\\full-spectrum vision", executor, type)
  5877.                 elseif object == "fnade" or object == "nades" then
  5878.                         Spawn(message, "Frag Grenade", "eqip", "weapons\\frag grenade\\frag grenade", executor, type)
  5879.                 elseif object == "pnade" then
  5880.                         Spawn(message, "Plasma Grenade", "eqip", "weapons\\plasma grenade\\plasma grenade", executor, type)
  5881.                 elseif object == "overshield" or object == "os" then
  5882.                         Spawn(message, "Overshield", "eqip", "powerups\\over shield", executor, type)
  5883.                 elseif object == "rifleammo" then
  5884.                         Spawn(message, "Assault Rifle Ammo", "eqip", "powerups\\assault rifle ammo\\assault rifle ammo", executor, type)
  5885.                 elseif object == "healthpack" then
  5886.                         Spawn(message, "Health Pack", "eqip", "powerups\\health pack", executor, type)
  5887.                 elseif object == "needlerammo" then
  5888.                         Spawn(message, "Needler Ammo", "eqip", "powerups\\needler ammo\\needler ammo", executor, type)
  5889.                 elseif object == "pistolammo" then
  5890.                         Spawn(message, "Pistol Ammo", "eqip", "powerups\\pistol ammo\\pistol ammo", executor, type)
  5891.                 elseif object == "rocketammo" then
  5892.                         Spawn(message, "Rocket Ammo", "eqip", "powerups\\rocket launcher ammo\\rocket launcher ammo", executor, type)
  5893.                 elseif object == "shottyammo" then
  5894.                         Spawn(message, "Shotgun Ammo", "eqip", "powerups\\shotgun ammo\\shotgun ammo", executor, type)
  5895.                 elseif object == "sniperammo" then
  5896.                         Spawn(message, "Sniper Ammo", "eqip", "powerups\\sniper rifle ammo\\sniper rifle ammo", executor, type)
  5897.                 elseif object == "flameammo" then
  5898.                         Spawn(message, "Flamethrower Ammo", "eqip", "powerups\\flamethrower ammo\\flamethrower ammo", executor, type)
  5899.                 else
  5900.                         bool = false
  5901.                 end
  5902.                 if bool then
  5903.                         return
  5904.                 end
  5905.         end
  5906.         if type ~= "enter" then
  5907.                 bool = true
  5908.                 --Objects with 'weap' tag
  5909.                 if object == "energysword" or object == "esword" then
  5910.                         Spawn(message, "Energy Sword", "weap", "weapons\\energy sword\\energy sword", executor, type)
  5911.                 elseif object == "ball" or object == "oddball" then
  5912.                         Spawn(message, "Oddball", "weap", "weapons\\ball\\ball", executor, type)
  5913.                 elseif object == "flag" then
  5914.                         Spawn(message, "Flag", "weap", "weapons\\flag\\flag", executor, type)
  5915.                 elseif object == "frg" or object == "fuelrod" or object == "rod" or object == "plasmacannon" then
  5916.                         Spawn(message, "Fuel Rod", "weap", "weapons\\plasma_cannon\\plasma_cannon", executor, type)
  5917.                 elseif object == "ggun" or object == "gravitygun" then
  5918.                         Spawn(message, "Gravity Gun", "weap", "weapons\\gravity rifle\\gravity rifle", executor, type)
  5919.                 elseif object == "needler" then
  5920.                         Spawn(message, "Needler", "weap", "weapons\\needler\\mp_needler", executor, type)
  5921.                 elseif object == "pistol" then
  5922.                         Spawn(message, "Pistol", "weap", "weapons\\pistol\\pistol", executor, type)
  5923.                 elseif object == "ppistol" or object == "plasmapistol" then
  5924.                         Spawn(message, "Plasma Pistol", "weap", "weapons\\plasma pistol\\plasma pistol", executor, type)
  5925.                 elseif object == "prifle" or object == "plasmarifle" then
  5926.                         Spawn(message, "Plasma Rifle", "weap", "weapons\\plasma rifle\\plasma rifle", executor, type)
  5927.                 elseif object == "rifle" or object == "arifle" or object == "assaultrifle" then
  5928.                         Spawn(message, "Assault Rifle", "weap", "weapons\\assault rifle\\assault rifle", executor, type)
  5929.                 elseif object == "rocket" or object == "rocketlauncher" or object == "rox" then
  5930.                         Spawn(message, "Rocket Launcher", "weap", "weapons\\rocket launcher\\rocket launcher", executor, type)
  5931.                 elseif object == "shotty" or object == "shotgun" then
  5932.                         Spawn(message, "Shotgun", "weap", "weapons\\shotgun\\shotgun", executor, type)
  5933.                 elseif object == "sniper" then
  5934.                         Spawn(message, "Sniper Rifle", "weap", "weapons\\sniper rifle\\sniper rifle", executor, type)
  5935.                 else
  5936.                         bool = false
  5937.                 end
  5938.                 if bool then
  5939.                         return
  5940.                 end
  5941.         end
  5942.         if type ~= "give" then
  5943.                 bool = true
  5944.                 --Objects with 'vehi' tag
  5945.                 if object == "wraith" then
  5946.                         Spawn(message, "Wraith", "vehi", "vehicles\\wraith\\wraith", executor, type)
  5947.                 elseif object == "peli" or object == "pelican" then
  5948.                         Spawn(message, "Pelican", "vehi", "vehicles\\pelican\\pelican", executor, type)
  5949.                 elseif object == "ghost" then
  5950.                         Spawn(message, "Ghost", "vehi", "vehicles\\ghost\\ghost_mp", executor, type)
  5951.                 elseif object == "hog" or object == "warthog" then
  5952.                         Spawn(message, "Warthog", "vehi", "vehicles\\warthog\\mp_warthog", executor, type)
  5953.                 elseif object == "rhog" or object == "rocketwarthog" then
  5954.                         Spawn(message, "Rocket Warthog", "vehi", "vehicles\\rwarthog\\rwarthog", executor, type)
  5955.                 elseif object == "shee" or object == "banshee" then
  5956.                         Spawn(message, "Banshee", "vehi", "vehicles\\banshee\\banshee_mp", executor, type)
  5957.                 elseif object == "tank" or object == "scorpion" then
  5958.                         Spawn(message, "Tank", "vehi", "vehicles\\scorpion\\scorpion_mp", executor, type)
  5959.                 elseif object == "turret" or object == "shade" then
  5960.                         Spawn(message, "Gun Turret", "vehi", "vehicles\\c gun turret\\c gun turret_mp", executor, type)
  5961.                 else
  5962.                         bool = false
  5963.                 end
  5964.                 if bool then
  5965.                         return
  5966.                 end
  5967.         end
  5968.         if bool == false then
  5969.                 if type == "give" then
  5970.                         sendresponse("Invalid Weapon!", command, executor)
  5971.                 elseif type == "enter" then
  5972.                         sendresponse("Invalid Vehicle!", command, executor)
  5973.                 elseif type == "spawn" then
  5974.                         sendresponse("Invalid Object!", command, executor)
  5975.                 end
  5976.         end
  5977. end
  5978.  
  5979. function Command_Setteleport(executor, command, locname, player, count)
  5980.         if count == 2 then
  5981.                 player = tostring(resolveplayer(executor))
  5982.         elseif count ~= 3 then
  5983.                 sendresponse("Invalid Syntax: " .. command .. " [locname] [player]", command, executor)
  5984.                 return
  5985.         end
  5986.         local players = getvalidplayers(player, executor)
  5987.         if players then
  5988.                 for i = 1,#players do
  5989.                         if getobject(getplayerobjectid(players[i])) then
  5990.                                 response = svcmd("sv_teleport_add " .. tostring(locname), players[i])
  5991.                                 if response == nil then say("This command does not work on 057") return end
  5992.                                 if string.find(response, "corresponds") then
  5993.                                         sendresponse("Teleport location " .. locname .. " now corresponds to " .. getname(players[i]) .. "'s location!", command, executor)
  5994.                                 else
  5995.                                         say(tostring(response))
  5996.                                         sendresponse(locname .. " is already added!", command, executor)
  5997.                                 end
  5998.                         else
  5999.                                 sendresponse("Cannot add teleport because the player is dead.", command, executor)
  6000.                         end
  6001.                 end
  6002.         else
  6003.                 sendresponse("Invalid Player!", command, executor)
  6004.         end
  6005. end
  6006.  
  6007. function Command_ShowTeleportList(executor, command, count)
  6008.         if count == 2 then
  6009.                 local file = io.open(profilepath .. "\\data\\locations.txt", "r")
  6010.                 if file then
  6011.                         local map = readtagname(map_addr)
  6012.                         local response = ""
  6013.                         for line in file:lines() do
  6014.                                 local count = gettokencount(line, ",")
  6015.                                 words = {}
  6016.                                 for i=1,count do
  6017.                                         local word = gettoken(line, ",", i - 1)
  6018.                                         word = string.lower(word)
  6019.                                         table.insert(words, word)
  6020.                                 end
  6021.                                 if string.lower(tostring(words[1])) == string.lower(tostring(map)) then
  6022.                                         if response == "" then
  6023.                                                 response = tostring(words[2])
  6024.                                         else
  6025.                                                 response = response .. ", " .. tostring(words[2])
  6026.                                         end
  6027.                                 end
  6028.                         end
  6029.                         sendresponse("Current teleport locations for this map\n" .. tostring(response), command, executor)
  6030.                 else
  6031.                         sendresponse("There are no teleports added for this map.", command, executor)
  6032.                 end
  6033.         else
  6034.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  6035.         end
  6036. end
  6037.  
  6038. function Command_Teledelete(executor, command, location, count)
  6039.         if count == 3 then
  6040.                 local file = io.open(profilepath .. "\\data\\locations.txt", "r")
  6041.                 if file then
  6042.                         local bool = false
  6043.                         local map = readtagname(map_addr)
  6044.                         for line in file:lines() do
  6045.                                 local count = gettokencount(line, ",")
  6046.                                 words = {}
  6047.                                 for i=1,count do
  6048.                                         local word = gettoken(line, ",", i - 1)
  6049.                                         word = string.lower(word)
  6050.                                         table.insert(words, word)
  6051.                                 end
  6052.                                 if tostring(words[2]) == tostring(location) and tostring(words[1]) == tostring(map) then
  6053.                                         bool = true
  6054.                                         break
  6055.                                 end
  6056.                         end
  6057.                         if bool then
  6058.                                 svcmd("sv_teleport_del " .. tostring(location))
  6059.                                 sendresponse("Teleport location " .. tostring(location) .. " has been successfully removed from this map.", command, executor)
  6060.                         else
  6061.                                 sendresponse("Location does not exist on this map!", command, executor)
  6062.                         end
  6063.                 else
  6064.                         sendresponse("There are no teleports added for this map.", command, executor)
  6065.                 end
  6066.         else
  6067.                 sendresponse("Invalid Syntax: " .. command .. " [location]", command, executor)
  6068.         end
  6069. end
  6070.  
  6071. function Command_Alias(executor, command, player, count)
  6072.         if count == 2 then
  6073.                 local players = getvalidplayers(player, executor)
  6074.                 if players then
  6075.                         for i = 1,#players do
  6076.                                 sendresponse(svcmd("sv_alias " .. resolveplayer(players[i]), executor), command, executor)
  6077.                         end
  6078.                 else
  6079.                         sendresponse("Invalid Player!", command, executor)
  6080.                 end
  6081.         else
  6082.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6083.         end
  6084. end
  6085.  
  6086. function Command_Suspend(executor, command, player, time, count)
  6087.         local players = getvalidplayers(player, executor)
  6088.         if players then
  6089.                 for i = 1,#players do
  6090.                         if suspend_table[gethash(players[i])] == nil then
  6091.                                 local m_player = getplayer(players[i])
  6092.                                 local player_respawn_time = readdword(m_player, 0x2c)
  6093.                                 if count == 2 then
  6094.                                         kill(players[i])
  6095.                                         writedword(m_player, 0x2C, 2592000)
  6096.                                         suspend_table[gethash(players[i])] = 2
  6097.                                         sendresponse(getname(players[i]) .. " was suspended by an admin!", command, executor)
  6098.                                 elseif count == 3 then
  6099.                                         kill(players[i])
  6100.                                         writedword(m_player, 0x2C, time * 30)
  6101.                                         suspend_table[gethash(players[i])] = 1
  6102.                                         if tonumber(time) == 1 then
  6103.                                                 sendresponse(getname(players[i]) .. " was suspended by an admin for " .. time .. " second!", command, executor)
  6104.                                         else
  6105.                                                 sendresponse(getname(players[i]) .. " was suspended by an admin for " .. time .. " seconds!", command, executor)
  6106.                                         end
  6107.                                 else
  6108.                                         sendresponse("Invalid Syntax: sv_suspend [player] {time}", command, executor)
  6109.                                 end
  6110.                         else
  6111.                                 sendresponse(getname(players[i]) .. " has already been suspended.", command, executor)
  6112.                         end
  6113.                 end
  6114.         else
  6115.                 sendresponse("Invalid Player!", command, executor)
  6116.         end
  6117. end
  6118.  
  6119. function Command_Teleport(executor, command, player, location, count)
  6120.         if count == 3 then
  6121.                 local players = getvalidplayers(player, executor)
  6122.                 if players then
  6123.                         for i = 1,#players do
  6124.                                 local response = svcmd("sv_teleport " .. resolveplayer(players[i]) .. " " .. location, executor)
  6125.                                 if string.find(response, "valid") then
  6126.                                         sendresponse("Location '" .. tostring(location) .. "' does not exist for this map!", command, executor)
  6127.                                 else
  6128.                                         sendresponse("Teleporting " .. getname(players[i]) .. " to location '" .. location .. "'", command, executor)
  6129.                                 end
  6130.                         end
  6131.                 else
  6132.                         sendresponse("Invalid Player!", command, executor)
  6133.                 end
  6134.         else
  6135.                 sendresponse("Invalid Syntax: " .. command .. " [player] [location]", command, executor)
  6136.         end
  6137. end
  6138.  
  6139. function Command_Teletoplayer(executor, command, player, player2, count)
  6140.         if count == 3 then
  6141.                 local players = getvalidplayers(player, executor)
  6142.                 if players then
  6143.                         for i = 1,#players do
  6144.                                 local name = getname(players[i])
  6145.                                 local m_player = getplayer(players[i])
  6146.                                 local m_playerObjId = readdword(m_player, 0x34)
  6147.                                 local m_object = getobject(m_playerObjId)
  6148.                                 if m_object then
  6149.                                         local m_vehicle = getobject(readdword(m_object, 0x11C))
  6150.                                         local players2 = getvalidplayers(player2, executor)
  6151.                                         if players2 then
  6152.                                                 if players2[2] == nil and players[i] ~= players2[1] and getobject(getplayerobjectid(players2[1])) then
  6153.                                                         local t_name = getname(players2[1])
  6154.                                                         local player_x_coord,player_y_coord,player_z_coord = getobjectcoords(getplayerobjectid(players2[1]))
  6155.                                                         if m_vehicle then
  6156.                                                                 writefloat(m_vehicle, 0x5C, player_x_coord)
  6157.                                                                 writefloat(m_vehicle, 0x60, player_y_coord)
  6158.                                                                 writefloat(m_vehicle, 0x64, player_z_coord + 1.5)
  6159.                                                                 sendresponse(name .. " was teleported to " .. t_name, command, executor)
  6160.                                                         elseif tonumber(player_z_coord) then
  6161.                                                                 movobjcoords(m_playerObjId, player_x_coord, player_y_coord, player_z_coord+1)
  6162.                                                                 sendresponse(name .. " was teleported to " .. t_name, command, executor)
  6163.                                                         end
  6164.                                                 elseif getobject(getplayerobjectid(players2[1])) == nil then
  6165.                                                         sendresponse("The player you are trying to teleport to is dead!", command, executor)
  6166.                                                 elseif player[2] then
  6167.                                                         sendresponse("You cannot teleport to multiple people.", command, executor)
  6168.                                                 end
  6169.                                         else
  6170.                                                 sendresponse("Invalid Player!", command, executor)
  6171.                                         end
  6172.                                 else
  6173.                                         sendresponse("The player(s) you are trying to teleport are dead", command, executor)
  6174.                                 end
  6175.                         end
  6176.                 else
  6177.                         sendresponse("Invalid Player!", command, executor)
  6178.                 end
  6179.         else
  6180.                 sendresponse("Invalid Syntax: " .. command .. " [player] [player]", command, executor)
  6181.         end
  6182. end
  6183.  
  6184. function Command_Changeteam(executor, command, player, count)
  6185.         if count == 2 then
  6186.                 local players = getvalidplayers(player, executor)
  6187.                 if players then
  6188.                         for i = 1,#players do
  6189.                                 changeteam(players[i], false)
  6190.                                 kill(players[i])
  6191.                                 sendresponse(getname(players[i]) .. " has been forced to change teams!", command, executor)
  6192.                         end
  6193.                 else
  6194.                         sendresponse("Invalid Player!", command, executor)
  6195.                 end
  6196.         else
  6197.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6198.         end
  6199. end
  6200.  
  6201. Command_BalanceTeams = function(executor, command, count)
  6202.         if count == 1 then
  6203.                 local response = svcmd("sv_teams_balance")
  6204.                 sendresponse(tostring(response), command, executor)
  6205.         else
  6206.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  6207.         end
  6208. end
  6209.  
  6210. function Command_Unhax(executor, command, player, count)
  6211.         if count == 2 then
  6212.                 local players = getvalidplayers(player, executor)
  6213.                 if players then
  6214.                         for i = 1,#players do
  6215.                                 local m_player = getplayer(players[i])
  6216.                                 setscore(players[i], 0)
  6217.                                 writeword(m_player, 0x9C, 0)
  6218.                                 writeword(m_player, 0xA4, 0)
  6219.                                 writeword(m_player, 0xAC, 0)
  6220.                                 writeword(m_player, 0xAE, 0)
  6221.                                 writeword(m_player, 0xB0, 0)
  6222.                                 sendresponse(getname(players[i]) .. " has been unhaxed!", command, executor)
  6223.                         end
  6224.                 else
  6225.                         sendresponse("Invalid Player!", command, executor)
  6226.                 end
  6227.         else
  6228.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6229.         end
  6230. end
  6231.  
  6232. function Command_Unmute(executor, command, player, count)
  6233.         if count == 2 then
  6234.                 local players = getvalidplayers(player, executor)
  6235.                 if players then
  6236.                         for i = 1,#players do
  6237.                                 local hash = gethash(i)
  6238.                                 if mute_table[hash] or spam_table[hash] ~= 0 then
  6239.                                         mute_table[hash] = nil
  6240.                                         spamtimeout_table[hash] = nil
  6241.                                         spam_table[hash] = 0
  6242.                                         sendresponse(getname(players[i]) .. " has been unmuted!", command, executor)
  6243.                                 else
  6244.                                         sendresponse(getname(players[i]) .. " has not been muted.", command, executor)
  6245.                                 end
  6246.                         end
  6247.                 else
  6248.                         sendresponse("Invalid Player!", command, executor)
  6249.                 end
  6250.         else
  6251.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6252.         end
  6253. end
  6254.  
  6255. function Command_Uninvis(executor, command, player, count)
  6256.         if count == 2 and tonumber(command) == nil then
  6257.                 local players = getvalidplayers(player, executor)
  6258.                 if players then
  6259.                         for i = 1,#players do
  6260.                                 local hash = gethash(players[i])
  6261.                                 if ghost_table[hash] == nil then
  6262.                                         sendresponse(getname(players[i]) .. " is not invisible!", command, executor)
  6263.                                 else
  6264.                                         ghost_table[hash] = nil
  6265.                                         sendresponse(getname(players[i]) .. " is no longer invisible!", command, executor)
  6266.                                 end
  6267.                         end
  6268.                 else
  6269.                         sendresponse("Invalid Player!", command, executor)
  6270.                 end
  6271.         else
  6272.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6273.         end
  6274. end
  6275.  
  6276. function Command_Unsuspend(executor, command, player, count)
  6277.         if count == 2 then
  6278.                 local players = getvalidplayers(player, executor)
  6279.                 if players then
  6280.                         for i = 1,#players do
  6281.                                 local m_player = getplayer(players[i])
  6282.                                 if suspend_table[gethash(players[i])] then
  6283.                                         writedword(m_player, 0x2C, 0)
  6284.                                         sendresponse(getname(players[i]) .. " has been unsuspended!", command, executor)
  6285.                                 else
  6286.                                         sendresponse(getname(players[i]) .. " has not been suspended.", command, executor)
  6287.                                 end
  6288.                         end
  6289.                 else
  6290.                         sendresponse("Invalid Player!")
  6291.                 end
  6292.         else
  6293.                 sendresponse("Invalid Syntax: " .. command .. " [player]")
  6294.         end
  6295. end
  6296.  
  6297. function Command_RTVEnabled(executor, command, boolean, count)
  6298.         if count == 1 then
  6299.                 if rockthevote then
  6300.                         sendresponse("RTV is currently enabled.", command, executor)
  6301.                 else
  6302.                         sendresponse("RTV is currently disabled.", command, executor)
  6303.                 end
  6304.         elseif count == 2 then
  6305.                 if (boolean == "1" or boolean == "true") and rockthevote ~= true then
  6306.                         rockthevote = true
  6307.                         if rtv_required == nil then
  6308.                                 rtv_required = 0.6
  6309.                         end
  6310.                         sendresponse("RockTheVote is now enabled! The default percentage needed is 60%.", command, executor)
  6311.                         sendresponse("Change this with sv_rtv_needed", command, executor)
  6312.                 elseif (boolean == "1" or boolean == "true") then
  6313.                         sendresponse("RockTheVote is already enabled!", command, executor)
  6314.                 elseif (boolean ~= "0" and boolean ~= "false") then
  6315.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6316.                 elseif (boolean == "0" or boolean == "false") and rockthevote then
  6317.                         rockthevote = false
  6318.                         sendresponse("RockTheVote is now disabled!", command, executor)
  6319.                 elseif (boolean == "0" or boolean == "false") then
  6320.                         sendresponse("RockTheVote is already disabled!", command, executor)
  6321.                 else
  6322.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6323.                 end
  6324.         else
  6325.                 sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
  6326.         end
  6327. end
  6328.  
  6329. function Command_RTVRequired(executor, command, percent, count)
  6330.         if count == 1 then
  6331.                 sendresponse(tostring(rtv_required*100) .. "% votes required for RTV")
  6332.         elseif count == 2 and tonumber(percent) then
  6333.                 if tonumber(percent) <= 1 then
  6334.                         sendresponse("Votes required for RTV has been set to " .. tonumber(percent) * 100 .. "%", command, executor)
  6335.                         rtv_required = tonumber(percent)
  6336.                 end
  6337.         else
  6338.                 sendresponse("Invalid Syntax: " .. command .. " [votes required (as a decimal)]", command, executor)
  6339.         end
  6340. end
  6341.  
  6342. function Command_VotekickEnabled(executor, command, boolean, count)
  6343.         if count == 1 then
  6344.                 if votekick_allowed then
  6345.                         sendresponse("VoteKick is currently enabled.", command, executor)
  6346.                 else
  6347.                         sendresponse("VoteKick is currently disabled.", command, executor)
  6348.                 end
  6349.         elseif count == 2 then
  6350.                 if (boolean == "1" or boolean == "true") and not votekick_allowed then
  6351.                         votekick_allowed = true
  6352.                         if votekick_required == nil then
  6353.                                 votekick_required = 0.7
  6354.                         end
  6355.                         sendresponse("VoteKick is now enabled! The default percentage needed is 70%.", command, executor)
  6356.                         sendresponse("Change this with sv_votekick_needed", command, executor)
  6357.                 elseif (boolean == "1" or boolean == "true") then
  6358.                         sendresponse("VoteKick is already enabled!", command, executor)
  6359.                 elseif (boolean ~= "0" and boolean ~= "false") then
  6360.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6361.                 elseif (boolean == "0" or boolean == "false") and votekick_allowed then
  6362.                         votekick_allowed = false
  6363.                         sendresponse("VoteKick is now disabled!", command, executor)
  6364.                 elseif (boolean == "0" or boolean == "false") then
  6365.                         sendresponse("VoteKick is already disabled!", command, executor)
  6366.                 else
  6367.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6368.                 end
  6369.         else
  6370.                 sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
  6371.         end
  6372. end
  6373.  
  6374. function Command_VotekickRequired(executor, command, percent, count)
  6375.         if count == 1 then
  6376.                 sendresponse(tostring(votekick_required*100) .. "% votes required for VoteKick", command, executor)
  6377.         elseif count == 2 and tonumber(percent) then
  6378.                 if tonumber(percent) <= 1 then
  6379.                         sendresponse("Votes required for VoteKick has been set to " .. tonumber(percent) * 100 .. "%", command, executor)
  6380.                         votekick_required = tonumber(percent)
  6381.                 end
  6382.         else
  6383.                 sendresponse("Invalid Syntax: " .. command .. " [votes required (as a decimal)]", command, executor)
  6384.         end
  6385. end
  6386.  
  6387. function Command_VotekickAction(executor, command, action, count)
  6388.         if count == 1 then
  6389.                 sendresponse("The current action for people who are votekicked is '" .. tostring(votekick_action) .. "'", command, executor)
  6390.                 sendresponse("Valid actions are 'kick' and 'ban'", command, executor)
  6391.         elseif count == 2 and (action == "kick" or action == "ban") then
  6392.                 sendresponse("The current VoteKick action has been changed to '" .. action .. "'", command, executor)
  6393.                 votekick_action = tostring(action)
  6394.         else
  6395.                 sendresponse("Invalid Syntax: " .. command .. " {action}", command, executor)
  6396.         end
  6397. end
  6398.  
  6399. function Command_Hashcheck(executor, command, boolean, count)
  6400.         if count == 1 then
  6401.                 if hash_check then
  6402.                         sendresponse("Hash Checking is currently on", command, executor)
  6403.                 else
  6404.                         sendresponse("Hash Checking is currently off", command, executor)
  6405.                 end
  6406.         elseif count == 2 then
  6407.                 if (boolean == "1" or boolean == "true") and hash_check ~= true then
  6408.                         hash_check = true
  6409.                         writebyte(hashcheck_addr, 0, 0x74)
  6410.                         sendresponse("Hash Checking is now enabled!", command, executor)
  6411.                 elseif (boolean == "1" or boolean == "true") then
  6412.                         sendresponse("Hash Checking is already enabled!", command, executor)
  6413.                 elseif (boolean ~= "0" and boolean ~= "false") then
  6414.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6415.                 elseif (boolean == "0" or boolean == "false") and hash_check then
  6416.                         hash_check = false
  6417.                         writebyte(hashcheck_addr, 0, 0xEB)
  6418.                         sendresponse("Hash Checking is now disabled!", command, executor)
  6419.                 elseif hash_check == nil then
  6420.                         hash_check = false
  6421.                         writebyte(hashcheck_addr, 0, 0xEB)
  6422.                         sendresponse("Hash Checking is now disabled!", command, executor)
  6423.                 elseif (boolean == "0" or boolean == "false") then
  6424.                         sendresponse("Hash Checking is already disabled!", command, executor)
  6425.                 else
  6426.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6427.                 end
  6428.         else
  6429.                 sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
  6430.         end
  6431. end
  6432.  
  6433. function Command_Versioncheck(executor, command, boolean, count)
  6434.         if count == 1 then
  6435.                 if version_check then
  6436.                         sendresponse("Version Checking is currently on", command, executor)
  6437.                 else
  6438.                         sendresponse("Version Checking is currently off", command, executor)
  6439.                 end
  6440.         elseif count == 2 then
  6441.                 if (boolean == "1" or boolean == "true") and version_check ~= true then
  6442.                         version_check = true
  6443.                         writebyte(versioncheck_addr, 0, 0x7D)
  6444.                         sendresponse("Version Checking is now enabled!", command, executor)
  6445.                 elseif (boolean == "1" or boolean == "true") then
  6446.                         sendresponse("Version Checking is already enabled!", command, executor)
  6447.                 elseif (boolean ~= "0" and boolean ~= "false") then
  6448.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6449.                 elseif (boolean == "0" or boolean == "false") and version_check then
  6450.                         version_check = false
  6451.                         writebyte(versioncheck_addr, 0, 0xEB)
  6452.                         sendresponse("Version Checking is now disabled!", command, executor)
  6453.                 elseif version_check == nil then
  6454.                         version_check = false
  6455.                         sendresponse("Version Checking is now disabled!", command, executor)
  6456.                         writebyte(versioncheck_addr, 0x0, 0xEB)
  6457.                 elseif (boolean == "0" or boolean == "false") and readbyte(versioncheck_addr, 0) == 0xEB then
  6458.                         sendresponse("Version Checking is already disabled!", command, executor)
  6459.                 else
  6460.                         sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
  6461.                 end
  6462.         else
  6463.                 sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
  6464.         end
  6465. end
  6466.  
  6467. function Command_Version(executor, command, version, count)
  6468.         if count == 1 then
  6469.                 sendresponse("The current version is " .. tostring(Version), command, executor)
  6470.         elseif count == 2 and tonumber(version) then
  6471.                 if game == "PC" then
  6472.                         local bool
  6473.                         if version == "1.00" or version == "00" or version == "0" then
  6474.                                 Version = "01.00.00.0564"
  6475.                                 writestring("01.00.00.0564", 0x5DF840)
  6476.                         elseif version == "1.01" or version == "01" or version == "1" then
  6477.                                 Version = "01.00.01.0580"
  6478.                                 writestring("01.00.01.0580", 0x5DF840)
  6479.                         elseif version == "1.02" or version == "02" or version == "2" then
  6480.                                 Version = "01.00.02.0581"
  6481.                                 writestring("01.00.02.0581", 0x5DF840)
  6482.                         elseif version == "1.03" or version == "03" or version == "3" then
  6483.                                 Version = "01.00.03.0605"
  6484.                                 writestring("01.00.03.0605", 0x5DF840)
  6485.                         elseif version == "1.04" or version == "04" or version == "4" then
  6486.                                 Version = "01.00.04.0607"
  6487.                                 writestring("01.00.04.0607", 0x5DF840)
  6488.                         elseif version == "1.05" or version == "05" or version == "5" then
  6489.                                 Version = "01.00.05.0610"
  6490.                                 writestring("01.00.05.0610", 0x5DF840)
  6491.                         elseif version == "1.06" or version == "06" or version == "6" then
  6492.                                 Version = "01.00.06.0612"
  6493.                                 writestring("01.00.06.0612", 0x5DF840)
  6494.                         elseif version == "1.07" or version == "07" or version == "7" then
  6495.                                 Version = "01.00.07.0613"
  6496.                                 writestring("01.00.07.0613", 0x5DF840)
  6497.                         elseif version == "1.08" or version == "08" or version == "8" then
  6498.                                 Version = "01.00.08.0615"
  6499.                                 writestring("01.00.08.0615", 0x5DF840)
  6500.                         elseif version == "1.09" or version == "09" or version == "9" then
  6501.                                 Version = "01.00.09.0620"
  6502.                                 writestring("01.00.09.0620", 0x5DF840)
  6503.                         else
  6504.                                 bool = true
  6505.                         end
  6506.                         if not bool then
  6507.                                 sendresponse("Server version has been changed to " .. tostring(Version) .. "!", command, executor)
  6508.                         else
  6509.                                 sendresponse("That is an invalid server version.", command, executor)
  6510.                         end
  6511.                 elseif tonumber(version) then
  6512.                         local bool = true
  6513.                         if version == "1.00" or version == "00" or version == "0" then
  6514.                                 Version = "01.00.00.0609"
  6515.                                 writestring("01.00.00.0609", 0x564B34)
  6516.                         elseif version == "1.01" or version == "01" or version == "1" then
  6517.                                 Version = "01.00.01.0580"
  6518.                                 writestring("01.00.01.0580", 0x564B34)
  6519.                         elseif version == "1.02" or version == "02" or version == "2" then
  6520.                                 Version = "01.00.02.0581"
  6521.                                 writestring("01.00.02.0580", 0x564B34)
  6522.                         elseif version == "1.07" or version == "07" or version == "7" then
  6523.                                 Version = "01.00.07.0613"
  6524.                                 writestring("01.00.07.0613", 0x564B34)
  6525.                         elseif version == "1.08" or version == "08" or version == "8" then
  6526.                                 Version = "01.00.08.0616"
  6527.                                 writestring("01.00.08.0616", 0x564B34)
  6528.                         elseif version == "1.09" or version == "09" or version == "9" then
  6529.                                 Version = "01.00.09.0620"
  6530.                                 writestring("01.00.09.0620", 0x564B34)
  6531.                         else
  6532.                                 bool = true
  6533.                         end
  6534.                         if not bool then
  6535.                                 sendresponse("Server version has been changed to " .. tostring(Version) .. "!", command, executor)
  6536.                         else
  6537.                                 sendresponse("That is an invalid server version.", command, executor)
  6538.                         end
  6539.                 end
  6540.         else
  6541.                 sendresponse("Invalid Syntax: " .. command .. " {version}", command, executor)
  6542.         end
  6543. end
  6544.  
  6545. function Command_Setcolor(executor, command, player, color, count)
  6546.         if count == 2 then
  6547.                 local players = getvalidplayers(player, executor)
  6548.                 if players then
  6549.                         for i = 1,#players do
  6550.                                 sendresponse(getname(players[i]) .. " is currently " .. getcolor(players[i]), command, executor)
  6551.                         end
  6552.                 else
  6553.                         sendresponse("Invalid Player!", command, executor)
  6554.                 end
  6555.         elseif count == 3 then
  6556.                 local players = getvalidplayers(player, executor)
  6557.                 if players then
  6558.                         for i = 1,#players do
  6559.                                 local m_player = getplayer(players[i])
  6560.                                 local m_objectId = getplayerobjectid(players[i])
  6561.                                 local x,y,z = getobjectcoords(m_objectId)
  6562.                                 if color == "white" then
  6563.                                         writebyte(m_player, 0x60, 0)
  6564.                                 elseif color == "black" then
  6565.                                         writebyte(m_player, 0x60, 1)
  6566.                                 elseif color == "red" then
  6567.                                         writebyte(m_player, 0x60, 2)
  6568.                                 elseif color == "blue" then
  6569.                                         writebyte(m_player, 0x60, 3)
  6570.                                 elseif color == "gray" then
  6571.                                         writebyte(m_player, 0x60, 4)
  6572.                                 elseif color == "yellow" then
  6573.                                         writebyte(m_player, 0x60, 5)
  6574.                                 elseif color == "green" then
  6575.                                         writebyte(m_player, 0x60, 6)
  6576.                                 elseif color == "pink" then
  6577.                                         writebyte(m_player, 0x60, 7)
  6578.                                 elseif color == "purple" then
  6579.                                         writebyte(m_player, 0x60, 8)
  6580.                                 elseif color == "cyan" then
  6581.                                         writebyte(m_player, 0x60, 9)
  6582.                                 elseif color == "cobalt" then
  6583.                                         writebyte(m_player, 0x60, 10)
  6584.                                 elseif color == "orange" then
  6585.                                         writebyte(m_player, 0x60, 11)
  6586.                                 elseif color == "teal" then
  6587.                                         writebyte(m_player, 0x60, 12)
  6588.                                 elseif color == "sage" then
  6589.                                         writebyte(m_player, 0x60, 13)
  6590.                                 elseif color == "brown" then
  6591.                                         writebyte(m_player, 0x60, 14)
  6592.                                 elseif color == "tan" then
  6593.                                         writebyte(m_player, 0x60, 15)
  6594.                                 elseif color == "maroon" then
  6595.                                         writebyte(m_player, 0x60, 16)
  6596.                                 elseif color == "salmon" then
  6597.                                         writebyte(m_player, 0x60, 17)
  6598.                                 else
  6599.                                         sendresponse("Invalid Color", command, executor)
  6600.                                         return
  6601.                                 end
  6602.                                 sendresponse(getname(players[i]) .. " had their color changed to " .. color .. "!", command, executor)
  6603.                                 if m_objectId ~= 0xFFFFFFFF then
  6604.                                         destroyobject(m_objectId)
  6605.                                         if colorspawn == nil then colorspawn = {} end
  6606.                                         if colorspawn[players[i]] == nil then colorspawn[players[i]] = {} end
  6607.                                         colorspawn[players[i]][1] = x
  6608.                                         colorspawn[players[i]][2] = y
  6609.                                         colorspawn[players[i]][3] = z
  6610.                                 end
  6611.                         end
  6612.                 else
  6613.                         sendresponse("Invalid Player!", command, executor)
  6614.                 end
  6615.         else
  6616.                 sendresponse("Invalid Syntax: " .. command .. " [player] {color}", command, executor)
  6617.         end
  6618. end
  6619.  
  6620.  
  6621. function Command_Boslist(executor, command, count)
  6622.         if count == 1 then
  6623.                 sendresponse("[Num Name - Hash - IP]", command, executor)
  6624.  
  6625.                 for k,v in pairs(boslog_table) do
  6626.                         if v then
  6627.  
  6628.                                 local words = {}
  6629.  
  6630.                                 local count = gettokencount(v, ",")
  6631.  
  6632.                                 for i = 1,count do
  6633.                                         local word = gettoken(v, ",", i-1)
  6634.                                         table.insert(words, word)
  6635.                                 end
  6636.  
  6637.                                 local name = words[1]
  6638.                                 local hash = words[2]
  6639.                                 local ip = words[3]
  6640.  
  6641.                                 sendresponse("[" .. k .. " " .. name .. " - " .. hash .. " - " .. ip .. "]", command, executor)
  6642.  
  6643.                         end
  6644.                 end
  6645.         else
  6646.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  6647.         end
  6648. end
  6649.  
  6650. function Command_Overshield(executor, command, player, count)
  6651.         if count == 2 then
  6652.                 local players = getvalidplayers(player, executor)
  6653.                 if players then
  6654.                         for i = 1,#players do
  6655.                                 local m_playerObjId = getplayerobjectid(players[i])
  6656.                                 local m_object = getobject(m_playerObjId)
  6657.                                 if m_object then
  6658.                                         local m_vehicleId = readdword(m_object, 0x11C)
  6659.                                         if m_vehicleId == 0xFFFFFFFF then
  6660.                                                 local obj_shields = readfloat(m_object, 0xE4)
  6661.                                                 if obj_shields <= 1 then
  6662.                                                         local x,y,z = getobjectcoords(m_playerObjId)
  6663.                                                         createobject("eqip", "powerups\\over shield", 0, 0, false, x, y, z+0.5)
  6664.                                                         sendresponse(getname(players[i]) .. " has been given an overshield!", command, executor)
  6665.                                                 else
  6666.                                                         sendresponse(getname(players[i]) .. " already has an overshield!", command, executor)
  6667.                                                 end
  6668.                                         else
  6669.                                                 writefloat(m_object, 0xE4, 3)
  6670.                                         end
  6671.                                 else
  6672.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  6673.                                 end
  6674.                         end
  6675.                 else
  6676.                         sendresponse("Invalid Player!", command, executor)
  6677.                 end
  6678.         else
  6679.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6680.         end
  6681. end
  6682.  
  6683. function Command_Info(executor, command, player, count)
  6684.         if count == 2 then
  6685.                 local players = getvalidplayers(player, executor)
  6686.                 if players then
  6687.                         for i = 1,#players do
  6688.                                 local player_number = resolveplayer(players[i])
  6689.                                 local m_player = getplayer(players[i])
  6690.                                 local hash = gethash(players[i])
  6691.  
  6692.                                 local m_playerObjId = readdword(m_player, 0x34)
  6693.                                 local m_object = getobject(m_playerObjId)
  6694.                                 if m_object then
  6695.  
  6696.                                         local player_name = readstring(m_player, 0x4)
  6697.                                         local player_team = readdword(m_player, 0x20)
  6698.                                         local player_respawn_time = readdword(m_player, 0x2C)
  6699.                                         local player_invis_time = readword(m_player, 0x68)
  6700.                                         local player_speed = readfloat(m_player, 0x6C)
  6701.                                         local player_objective_mode = readbyte(m_player, 0x74)
  6702.                                         local player_objective_mode2 = readbyte(m_player, 0x7A)
  6703.                                         local player_killstreak = readword(m_player, 0x96)
  6704.                                         local player_kills = readword(m_player, 0x9C)
  6705.                                         local player_assists = readword(m_player, 0xA4)
  6706.                                         local player_betrays = readword(m_player, 0xAC)
  6707.                                         local player_deaths = readword(m_player, 0xAE)
  6708.                                         local player_suicides = readword(m_player, 0xB0)
  6709.                                         local player_ping = readword(m_player, 0xDC)
  6710.                                         local player_x_coord = readfloat(m_player, 0xF8)
  6711.                                         local player_y_coord = readfloat(m_player, 0xFC)
  6712.                                         local player_z_coord = readfloat(m_player, 0x100)
  6713.  
  6714.                                         local obj_max_health = readfloat(m_object, 0xD8)
  6715.                                         local obj_max_shields = readfloat(m_object, 0xDC)
  6716.                                         local obj_health = readfloat(m_object, 0xE0)
  6717.                                         local obj_shields = readfloat(m_object, 0xE4)
  6718.                                         local obj_flashlight_mode = readbyte(m_object, 0x206)
  6719.                                         local obj_crouch = readbyte(m_object, 0x2A0)
  6720.                                         local obj_weap_type = readbyte(m_object, 0x2F2)
  6721.                                         local obj_nade_type = readbyte(m_object, 0x31C)
  6722.                                         local obj_primary_nades = readbyte(m_object, 0x31E)
  6723.                                         local obj_secondary_nades = readbyte(m_object, 0x31F)
  6724.                                         local obj_flashlight_level = readfloat(m_object, 0x344)
  6725.                                         local obj_invis_scale = readfloat(m_object, 0x37C)
  6726.                                         local obj_airborne = readbyte(m_object, 0x4CC)
  6727.  
  6728.                                         local obj_primary_weap_id = readdword(m_object, 0x2F8)
  6729.                                         local obj_secondary_weap_id = readdword(m_object, 0x2FC)
  6730.                                         local primary_weap = getobject(obj_primary_weap_id)
  6731.                                         local secondary_weap = getobject(obj_secondary_weap_id)
  6732.  
  6733.                                         local m_vehicle = getobject(readdword(m_object, 0x11C))
  6734.                                         if obj_crouch == 1 or obj_crouch == 5 or obj_crouch == 6 or obj_crouch == 13 or obj_crouch == 17 then
  6735.                                                 primary_weap = getobject(readdword(m_vehicle, 0x2F8))
  6736.                                         end
  6737.  
  6738.                                         local primary_weap_heat = readfloat(primary_weap, 0x23C)
  6739.                                         local primary_weap_age = readfloat(primary_weap, 0x240)
  6740.                                         local primary_weap_ammo = readword(primary_weap, 0x2B6)
  6741.                                         local primary_weap_clip = readword(primary_weap, 0x2B8)
  6742.                                         local secondary_weap_heat = readfloat(secondary_weap, 0x23C)
  6743.                                         local secondary_weap_age = readfloat(secondary_weap, 0x240)
  6744.                                         local secondary_weap_ammo = readword(secondary_weap, 0x2B6)
  6745.                                         local secondary_weap_clip = readword(secondary_weap, 0x2B8)
  6746.  
  6747.                                         local teamsize = getteamsize(player_team)
  6748.  
  6749.                                         if player_team == 0 then
  6750.                                                 player_team = "Red"
  6751.                                         elseif player_team == 1 then
  6752.                                                 player_team = "Blue"
  6753.                                         else
  6754.                                                 player_team = "Hidden"
  6755.                                         end
  6756.  
  6757.                                         if player_objective_mode == 0x22 and player_objective_mode2 == 0x71 then
  6758.                                                 player_objective_mode = "Hill"
  6759.                                         elseif player_objective_mode == 0x23 and player_objective_mode2 == 0x71 then
  6760.                                                 player_objective_mode = "Juggernaut"
  6761.                                         elseif player_objective_mode == 0x23 and player_objective_mode2 == 0x72 then
  6762.                                                 player_objective_mode = "It"
  6763.                                         elseif player_objectivemode == 0x29 and player_objective_mode2 == 0x70 then
  6764.                                                 player_objective_mode = "Ball"
  6765.                                         else
  6766.                                                 player_objective_mode = "None"
  6767.                                         end
  6768.  
  6769.                                         if obj_weap_type == 2 and player_objective_mode == "None" then
  6770.                                                 player_objective_mode = "Flag"
  6771.                                         end
  6772.  
  6773.                                         player_respawn_time = round(player_respawn_time / 30, 2)
  6774.                                         player_invis_time = round(player_invis_time / 30, 2)
  6775.  
  6776.                                         player_betrays = player_betrays - player_suicides
  6777.  
  6778.                                         player_x_coord = round(player_x_coord)
  6779.                                         player_y_coord = round(player_y_coord)
  6780.                                         player_z_coord = round(player_z_coord)
  6781.  
  6782.                                         obj_invis_scale = round(obj_invis_scale * 100, 2)
  6783.  
  6784.                                         if obj_invis_scale == 0 then
  6785.                                                 obj_invis_scale = "No"
  6786.                                         else
  6787.                                                 obj_invis_scale = obj_invis_scale .. "%"
  6788.                                         end
  6789.  
  6790.                                         local invis_info = "Invis: " .. obj_invis_scale
  6791.  
  6792.                                         if obj_invis_scale ~= "No" then
  6793.                                                 invis_info = "Invis: " .. obj_invis_scale .. " (" .. player_invis_time .. " secs)"
  6794.                                         end
  6795.  
  6796.                                         if obj_flashlight_mode == 8 then
  6797.                                                 obj_flashlight_mode = "On"
  6798.                                         else
  6799.                                                 obj_flashlight_mode = "Off"
  6800.                                         end
  6801.  
  6802.                                         obj_flashlight_level = round(obj_flashlight_level * 100)
  6803.  
  6804.                                         if primary_weap_age == 0 then
  6805.                                                 if primary_weap_ammo ~= 0 or primary_weap_clip ~= 0 then
  6806.                                                         writefloat(primary_weap, 0x240, 1)
  6807.                                                         primary_weap_age = 1
  6808.                                                 end
  6809.                                         end
  6810.  
  6811.                                         if secondary_weap_age == 0 then
  6812.                                                 if secondary_weap_ammo ~= 0 or secondary_weap_clip ~= 0 then
  6813.                                                         writefloat(secondary_weap, 0x240, 1)
  6814.                                                         secondary_weap_age = 1
  6815.                                                 end
  6816.                                         end
  6817.  
  6818.                                         if obj_weap_type == 1 then
  6819.                                                 primary_weap_heat = readfloat(secondary_weap, 0x23C)
  6820.                                                 primary_weap_age = readfloat(secondary_weap, 0x240)
  6821.                                                 primary_weap_ammo = readword(secondary_weap, 0x2B6)
  6822.                                                 primary_weap_clip = readword(secondary_weap, 0x2B8)
  6823.                                                 secondary_weap_heat = readfloat(primary_weap, 0x23C)
  6824.                                                 secondary_weap_age = readfloat(primary_weap, 0x240)
  6825.                                                 secondary_weap_ammo = readword(primary_weap, 0x2B6)
  6826.                                                 secondary_weap_clip = readword(primary_weap, 0x2B8)
  6827.                                         end
  6828.  
  6829.                                         primary_weap_heat = round(primary_weap_heat * 100)
  6830.                                         primary_weap_age = round((1 - primary_weap_age) * 100)
  6831.                                         secondary_weap_heat = round(secondary_weap_heat * 100)
  6832.                                         secondary_weap_age = round((1 - secondary_weap_age) * 100)
  6833.  
  6834.                                         local primary_weap_info = "Primary: Empty"
  6835.                                         local secondary_weap_info = "Secondary: Empty"
  6836.  
  6837.                                         if obj_health ~= 0 then
  6838.                                                 if obj_crouch == 1 or obj_crouch == 5 or obj_crouch == 6 or obj_crouch == 13 or obj_crouch == 17 then
  6839.                                                         if primary_weap_age == 100 and primary_weap_ammo == 0 and primary_weap_clip == 0 then
  6840.                                                                 primary_weap_info = "Primary: Infinite"
  6841.                                                         else
  6842.                                                                 primary_weap_info = "Primary Ammo: " .. primary_weap_clip .. " / " .. primary_weap_ammo
  6843.                                                         end
  6844.                                                 else
  6845.  
  6846.                                                         if primary_weap then
  6847.                                                                 if primary_weap_age == 0 then
  6848.                                                                         if primary_weap_ammo ~= 0 or primary_weap_clip ~= 0 then
  6849.                                                                                 primary_weap_info = "Primary Ammo: " .. primary_weap_clip .. " / " .. primary_weap_ammo
  6850.                                                                         end
  6851.                                                                 else
  6852.                                                                         primary_weap_info = "Primary Battery: " .. primary_weap_heat .. "% / " .. primary_weap_age .. "%"
  6853.                                                                 end
  6854.                                                         end
  6855.  
  6856.                                                         if secondary_weap then
  6857.                                                                 if secondary_weap_age == 0 then
  6858.                                                                         if secondary_weap_ammo ~= 0 or secondary_weap_clip ~= 0 then
  6859.                                                                                 secondary_weap_info = "Secondary Ammo: " .. secondary_weap_clip .. " / " .. secondary_weap_ammo
  6860.                                                                         end
  6861.                                                                 else
  6862.                                                                         secondary_weap_info = "Secondary Battery: " .. secondary_weap_heat .. "% / " .. secondary_weap_age .. "%"
  6863.                                                                 end
  6864.                                                         end
  6865.  
  6866.                                                 end
  6867.                                         end
  6868.  
  6869.                                         local nade_info = "Frag Grenades: " .. obj_primary_nades .. " | " .. "Plasma Grenades: " .. obj_secondary_nades
  6870.  
  6871.                                         if obj_nade_type == 1 then
  6872.                                                 nade_info = "Plasma Grenades: " .. obj_secondary_nades .. " | " .. "Frag Grenades: " .. obj_primary_nades
  6873.                                         end
  6874.  
  6875.                                         if obj_crouch == 0 then
  6876.                                                 obj_crouch = "Warthog: Driver"
  6877.                                         elseif obj_crouch == 1 then
  6878.                                                 obj_crouch = "Warthog: Gunner"
  6879.                                         elseif obj_crouch == 2 then
  6880.                                                 obj_crouch = "Warthog: Passenger"
  6881.                                         elseif obj_crouch == 3 then
  6882.                                                 obj_crouch = "Stance: Crouching"
  6883.                                         elseif obj_crouch == 4 then
  6884.                                                 obj_crouch = "Stance: Standing"
  6885.                                         elseif obj_crouch == 5 then
  6886.                                                 obj_crouch = "Ghost: Driver"
  6887.                                         elseif obj_crouch == 6 then
  6888.                                                 obj_crouch = "Banshee: Pilot"
  6889.                                         elseif obj_crouch == 13 then
  6890.                                                 obj_crouch = "Scorpion: Driver"
  6891.                                         elseif obj_crouch == 17 then
  6892.                                                 obj_crouch = "Shade: Gunner"
  6893.                                         elseif obj_crouch == 20 or obj_crouch == 21 or obj_crouch == 22 or obj_crouch == 23 then
  6894.                                                 obj_crouch = "Scorpion: Passenger"
  6895.                                         end
  6896.  
  6897.                                         if obj_crouch == "Stance: Crouching" or obj_crouch == "Stance: Standing" then
  6898.                                                 if obj_airborne == 1 then
  6899.                                                         obj_crouch = "Stance: Airborne"
  6900.                                                 end
  6901.                                         end
  6902.  
  6903.                                         if obj_health == 0 and obj_shields == 0 then
  6904.                                                 obj_crouch = "Stance: Dead"
  6905.                                         end
  6906.  
  6907.                                         obj_max_health = round(obj_health * obj_max_health)
  6908.                                         obj_max_shields = round(obj_shields * obj_max_shields)
  6909.                                         obj_health = round(obj_health * 100)
  6910.                                         obj_shields = round(obj_shields * 100)
  6911.  
  6912.                                         local health_info = "Health: " .. obj_health .. "% (" .. obj_max_health .. ") | " .. "Shields: " .. obj_shields .. "% (" .. obj_max_shields .. ")"
  6913.  
  6914.                                         if obj_health == 0 and obj_shields == 0 and player_respawn_time ~= 0 then
  6915.                                                 if player_respawn_time == 1 then
  6916.                                                         health_info = "Respawn: " .. player_respawn_time .. " sec"
  6917.                                                 else
  6918.                                                         health_info = "Respawn: " .. player_respawn_time .. " secs"
  6919.                                                 end
  6920.                                         end
  6921.  
  6922.                                         if suspend_table[hash] == 2 then
  6923.                                                 health_info = "Respawn: Never"
  6924.                                         end
  6925.                                         sendresponse("----------", command, executor)
  6926.                                         sendresponse("Name: " .. player_name .. " (" .. player_number .. ") | " .. "Team: " .. player_team .. " (" .. teamsize .. ") | " .. "Speed: " .. player_speed .. " | " .. "Location: " .. player_x_coord .. ", " .. player_y_coord .. ", " .. player_z_coord, command, executor)
  6927.                                         sendresponse("Hash: " .. hash .. " | " .. "Ping: " .. player_ping .. " | " .. obj_crouch, command, executor)
  6928.                                         sendresponse("Kills: " .. player_kills .. " (" .. player_killstreak .. ") | " .. "Assists: " .. player_assists .. " | " .. "Betrays: " .. player_betrays .. " | " .. "Suicides: " .. player_suicides .. " | " .. "Deaths: " .. player_deaths, command, executor)
  6929.                                         sendresponse(health_info .. " | " .. invis_info .. " | " .. "Light: " .. obj_flashlight_mode .. " (" .. obj_flashlight_level .. "%)", command, executor)
  6930.                                         sendresponse(primary_weap_info .. " | " .. secondary_weap_info .. " | " .. "Objective: " .. player_objective_mode, command, executor)
  6931.                                         sendresponse(nade_info, command, executor)
  6932.                                         sendresponse("----------", command, executor)
  6933.                                 else
  6934.                                         sendresponse("Error! The selected player is dead!", command, executor)
  6935.                                 end
  6936.                         end
  6937.                 else
  6938.                         sendresponse("Invalid Player!", command, executor)
  6939.                 end
  6940.         else
  6941.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6942.         end
  6943. end
  6944.  
  6945. function Command_Gethash(executor, command, player, count)
  6946.         if count == 2 then
  6947.                 local players = getvalidplayers(player, executor)
  6948.                 if players then
  6949.                         for i = 1,#players do
  6950.                                 local hash = gethash(players[i])
  6951.                                 local name = getname(players[i])
  6952.                                 sendresponse(name .. ": " .. hash, command, executor)
  6953.                         end
  6954.                 else
  6955.                         sendresponse("Invalid Player!", command, executor)
  6956.                 end
  6957.         else
  6958.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6959.         end
  6960. end
  6961.  
  6962. function Command_getip(executor, command, player, count)
  6963.         if count == 2 then
  6964.                 local players = getvalidplayers(player, executor)
  6965.                 if players then
  6966.                         for i = 1,#players do
  6967.                                 local id = resolveplayer(players[i])
  6968.                                 ip = getip(players[i])
  6969.                                 sendresponse(getname(players[i]) .. ": " .. tostring(ip), command, executor)
  6970.                         end
  6971.                 else
  6972.                         sendresponse("Invalid Player!", command, executor)
  6973.                 end
  6974.         else
  6975.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  6976.         end
  6977. end
  6978.  
  6979. function Command_ShowAdminList(executor, command, count)
  6980.         if count == 1 or command == "\\a list" or command == "/a list" then
  6981.                 sendresponse("Showing both IP Admins and Hash Admins.", command, executor)
  6982.                 sendresponse("[Num] - Name: level - Admin types", command, executor)
  6983.                 local admins = {}
  6984.                 local x = 1
  6985.                 for k,v in pairs(admin_table) do
  6986.                         local name = admin_table[k].name
  6987.                         local level = admin_table[k].level
  6988.                         admins[name] = {"hash", "notip", level}
  6989.                 end
  6990.                 for k,v in pairs(ipadmins) do
  6991.                         local name = ipadmins[k].name
  6992.                         local level = ipadmins[k].level
  6993.                         if admins[name] and admins[name] ~= {} then
  6994.                                 admins[name][2] = "ip"
  6995.                         else
  6996.                                 admins[name] = {"nothash", "ip", level}
  6997.                         end
  6998.                 end
  6999.                 for k,v in pairs(admins) do
  7000.                         local message = ""
  7001.                         if admins[k][1] == "hash" and admins[k][2] == "ip" then
  7002.                                 message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - Hash admin  IP Admin"
  7003.                         elseif admins[k][1] == "hash" then
  7004.                                 message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - Hash admin"
  7005.                         elseif admins[k][2] == "ip" then
  7006.                                 message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - IP Admin"
  7007.                         end
  7008.                         x = x + 1
  7009.                         sendresponse(message, command, executor)
  7010.                 end
  7011.         else
  7012.                 sendresponse("Invalid Syntax: " .. command, command, executor)
  7013.         end
  7014. end
  7015.  
  7016. function Command_Help(executor, command, cmd, count)
  7017.         for i = 1,#commands_table do
  7018.                 if commands_table[i] then
  7019.                         if string.find(commands_table[i], cmd) then
  7020.                                 sendresponse(GetHelp(commands_table[i]), command, executor)
  7021.                         end
  7022.                 end
  7023.         end
  7024. end
  7025.  
  7026. function Command_Launch(executor, command, player, count)
  7027.         if count == 2 then
  7028.                 local players = getvalidplayers(player, executor)
  7029.                 if players then
  7030.                         for i = 1,#players do
  7031.                                 local m_object = getobject(getplayerobjectid(players[i]))
  7032.                                 if m_object then
  7033.                                         local m_vehicleId = readdword(m_object, 0x11C)
  7034.                                         local m_vehicle = getobject(m_vehicleId)
  7035.                                         if m_vehicle then
  7036.                                                 sendresponse(getname(players[i]) .. " has been launched!", command, executor)
  7037.                                                 local tagName = getobjecttag(m_vehicleId)
  7038.                                                 writebit(m_vehicle, 0x10, 2, 0)
  7039.                                                 if tagName == "vehicles\\scorpion\\scorpion_mp" then
  7040.                                                         writefloat(m_vehicle, 0x94, 15)
  7041.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7042.                                                         writefloat(m_vehicle, 0x6C, 0.35)
  7043.                                                 elseif tagName == "vehicles\\banshee\\banshee_mp" then
  7044.                                                         writefloat(m_vehicle, 0x90, 30)
  7045.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7046.                                                         writefloat(m_vehicle, 0x6C, -0.4)
  7047.                                                 elseif tagName == "vehicles\\ghost\\ghost_mp" then
  7048.                                                         writefloat(m_vehicle, 0x8C, 7)
  7049.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7050.                                                 elseif tagName == "vehicles\\warthog\\mp_warthog" then
  7051.                                                         writefloat(m_vehicle, 0x94, 10)
  7052.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7053.                                                 elseif tagName == "vehicles\\rwarthog\\rwarthog" then
  7054.                                                         writefloat(m_vehicle, 0x94, 15)
  7055.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7056.                                                 else
  7057.                                                         writefloat(m_vehicle, 0x94, 10)
  7058.                                                         writefloat(m_vehicle, 0x70, 0.35)
  7059.                                                 end
  7060.                                         else
  7061.                                                 sendresponse(getname(players[i]) .. " is not in a vehicle!", command, executor)
  7062.                                         end
  7063.                                 else
  7064.                                         sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
  7065.                                 end
  7066.                         end
  7067.                 else
  7068.                         sendresponse("Invalid Player!", command, executor)
  7069.                 end
  7070.         else
  7071.                 sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
  7072.         end
  7073. end
  7074.  
  7075. function GetHelp(command)
  7076.         if t[2] == "sv_admin_add" then
  7077.                 hprintf("Syntax: sv_admin_add [player] [nickname] [level]")
  7078.                 hprintf("Adds a player to the admin list.")
  7079.         elseif t[2] == "sv_setammo" then
  7080.                 hprintf("Syntax: sv_setammo [player] [ammo]")
  7081.                 hprintf("Sets the player's primary weapon's ammo. Use * for all players.")
  7082.         elseif t[2] == "ban" then
  7083.                 hprintf("Syntax: sv_ban [player] {time}")
  7084.                 hprintf("Bans a player indefinitely, or for the time specified.")
  7085.         elseif t[2] == "sv_deathless" then
  7086.                 hprintf("Syntax: sv_deathless [boolean]")
  7087.                 hprintf("Will set the game so no one can die. 0 for off, 1 for on.")
  7088.                 hprintf("Using 'heal' will override this, however")
  7089.         elseif t[2] == "e" then
  7090.                 hprintf("Syntax: sv_e [Command]")
  7091.                 hprintf("This will execute any command that you would normally put in the console.")
  7092.                 hprintf("This is also used more commonly to tell if the script is working.")
  7093.                 hprintf("Or if a player has admin.")
  7094.         elseif t[2] == "eject" then
  7095.                 hprintf("Syntax: sv_eject [player]")
  7096.                 hprintf("Ejects a player. Use * for all players.")
  7097.         elseif t[2] == "enter" then
  7098.                 hprintf("Syntax: sv_enter [player] [seat]")
  7099.                 hprintf("Will cause you to enter the player's vehicle, and the seat specified.")
  7100.         elseif t[2] == "getloc" then
  7101.                 hprintf("Syntax: sv_getloc [player]")
  7102.                 hprintf("Will display the location of the player specified.")
  7103.         elseif t[2] == "godmode" then
  7104.                 hprintf("Syntax: sv_godmode [player]")
  7105.                 hprintf("Will make this person unkillable. Backtaps, however, will still kill them.")
  7106.         elseif t[2] == "hax" then
  7107.                 hprintf("Syntax: sv_hax")
  7108.                 hprintf("I made this command because I was bored.")
  7109.         elseif t[2] == "heal" then
  7110.                 hprintf("Syntax: sv_heal [player]")
  7111.                 hprintf("Will heal the specified player.")
  7112.         elseif t[2] == "help" then
  7113.                 hprintf("Syntax: sv_help [Command]")
  7114.                 hprintf("Will provide details on any specified command.")
  7115.                 hprintf("Do not include sv_ or \ for the [Command]")
  7116.         elseif t[2] == "hitler" then
  7117.                 hprintf("Syntax: sv_hitler")
  7118.                 hprintf("Will lethaly inject everyone.")
  7119.         elseif t[2] == "infammo" then
  7120.                 hprintf("Syntax: sv_infinite_ammo [boolean]")
  7121.                 hprintf("Will set the game so everyone has infinite ammo. 0 for off, 1 for on")
  7122.         elseif t[2] == "give" then
  7123.                 hprintf("Syntax: sv_give [weapon] {player}")
  7124.                 hprintf("Will give yourself, or the person specified, a weapon.")
  7125.                 hprintf("You can hold up to 4 weapons. If you are holding 4 weapons,")
  7126.                 hprintf("you cannot pickup the flag, or the oddball.")
  7127.         elseif t[2] == "gethash" then
  7128.                 hprintf("Syntax: sv_gethash [player]")
  7129.                 hprintf("This will get the hash of the player specified.")
  7130.         elseif t[2] == "invis" then
  7131.                 hprintf("Syntax: sv_invis [player] {time}")
  7132.                 hprintf("This will camouflage the person specified for the amount of time specified.")
  7133.         elseif t[2] == "j" then
  7134.                 hprintf("Syntax: sv_j [player] [x] [y] [z]")
  7135.                 hprintf("Moves the specified player by coords specified.")
  7136.         elseif t[2] == "k" then
  7137.                 hprintf("Syntax: sv_k [player]")
  7138.                 hprintf("Will kick the player specified.")
  7139.         elseif t[2] == "kill" then
  7140.                 hprintf("Syntax: sv_kill [player]")
  7141.                 hprintf("Will kill the player specified.")
  7142.         elseif t[2] == "lo3" then
  7143.                 hprintf("Syntax: sv_lo3")
  7144.                 hprintf("Will lo3 the game.")
  7145.         elseif t[2] == "m" then
  7146.                 hprintf("Syntax: sv_m [map] [gametype] {script} {script2} . . .")
  7147.                 hprintf("Will load the map specified. No need to specify chatcommands script.")
  7148.         elseif t[2] == "mc" then
  7149.                 hprintf("Syntax: sv_mc")
  7150.                 hprintf("Starts the mapcycle.")
  7151.         elseif t[2] == "mnext" then
  7152.                 hprintf("Syntax: sv_mnext")
  7153.                 hprintf("Loads the next map in the mapcycle.")
  7154.         elseif t[2] == "mute" then
  7155.                 hprintf("Syntax: sv_mute [player] {time}")
  7156.                 hprintf("Mutes the player. Admins cannot be muted.")
  7157.         elseif t[2] == "pass" then
  7158.                 hprintf("Syntax: sv_pass [password]")
  7159.                 hprintf("Sets the server password.")
  7160.         elseif t[2] == "reset" then
  7161.                 hprintf("Syntax: sv_reset")
  7162.                 hprintf("Resets the map.")
  7163.         elseif t[2] == "resp" then
  7164.                 hprintf("Syntax: sv_resp [player] [time]")
  7165.                 hprintf("Sets respawn time of player. Only works if player is dead.")
  7166.         elseif t[2] == "say" then
  7167.                 hprintf("Syntax: sv_say [message]")
  7168.                 hprintf("Will say something as the server. No quotes needed.")
  7169.         elseif t[2] == "sc" then
  7170.                 hprintf("Syntax: sv_sc [player] [nickname]")
  7171.                 hprintf("Will set the player's nickname. Used instead of player IDs")
  7172.         elseif t[2] == "setassists" then
  7173.                 hprintf("Syntax: sv_setassists [player] [# of assists]")
  7174.                 hprintf("Will set the assists of the player specified.")
  7175.         elseif t[2] == "setdeaths" then
  7176.                 hprintf("Syntax: sv_setdeaths [player] [# of deaths]")
  7177.                 hprintf("Will set the deaths of the player specified.")
  7178.         elseif t[2] == "setfrags" then
  7179.                 hprintf("Syntax: sv_setfrags [player] [# of frags]")
  7180.                 hprintf("Will set the # of frag grenades of the player specified.")
  7181.         elseif t[2] == "setkills" then
  7182.                 hprintf("Syntax: sv_setkills [player] [# of kills]")
  7183.                 hprintf("Will set the kills of the player specified.")
  7184.         elseif t[2] == "setname" then
  7185.                 hprintf("Syntax: sv_setname [player] [name]")
  7186.                 hprintf("Sets the name of the player specified.")
  7187.                 hprintf("You will only notice a difference on rejoin.")
  7188.         elseif t[2] == "setresp" then
  7189.                 hprintf("Syntax: sv_respawn_time [time]")
  7190.                 hprintf("Sets the universal respawn time of all maps.")
  7191.         elseif t[2] == "setplasmas" then
  7192.                 hprintf("Syntax: sv_setplasmas [player] [# of plasma grenades]")
  7193.                 hprintf("Will set the plasma grenades of the player specified.")
  7194.         elseif t[2] == "spd" then
  7195.                 hprintf("Syntax: sv_setspeed [player] [speed]")
  7196.                 hprintf("Will set the speed of the player specified.")
  7197.         elseif t[2] == "spawn" then
  7198.                 hprintf("Syntax: sv_spawn [object] {player} {ammount} {resptime} {recycle}")
  7199.                 hprintf("Will spawn a object over a player if specified.")
  7200.         elseif t[2] == "st" then
  7201.                 hprintf("Syntax: sv_teleport_add [location]")
  7202.                 hprintf("Will set a teleport location to wherever you're standing.")
  7203.         elseif t[2] == "suspend" then
  7204.                 hprintf("Syntax: sv_suspend [player] {time}")
  7205.                 hprintf("Will suspend the player for the time specified.")
  7206.         elseif t[2] == "t" then
  7207.                 hprintf("Syntax: sv_teleport [player] [location]")
  7208.                 hprintf("Will teleport the player specified to the location specified.")
  7209.         elseif t[2] == "td" then
  7210.                 hprintf("Syntax: sv_teleport_del [location]")
  7211.                 hprintf("Will delete the teleport location specified.")
  7212.         elseif t[2] == "test" then
  7213.                 hprintf("Syntax: sv_test [player]")
  7214.                 hprintf("I use this to test the returns of some addresses and offsets.")
  7215.         elseif t[2] == "tp" then
  7216.                 hprintf("Syntax: sv_teleport_pl [player] [t_player]")
  7217.                 hprintf("Will teleport player to t_player")
  7218.         elseif t[2] == "ts" then
  7219.                 hprintf("Syntax: sv_changeteam [player]")
  7220.                 hprintf("Will switch the players team.")
  7221.         elseif t[2] == "unhax" then
  7222.                 hprintf("Syntax: sv_unhax")
  7223.                 hprintf("Unhax's you. I was bored, what can i say?")
  7224.         elseif t[2] == "unmute" then
  7225.                 hprintf("Syntax: sv_unmute [player]")
  7226.                 hprintf("Unmutes the player specified.")
  7227.         elseif t[2] == "unsuspend" then
  7228.                 hprintf("Syntax: sv_unsuspend [player]")
  7229.                 hprintf("Unsuspends the player specified.")
  7230.         elseif t[2] == "credits" then
  7231.                 hprintf("Created by [DWM]Wizard")
  7232.                 hprintf("Base script created by Smiley")
  7233.         else
  7234.                 hprintf("Invalid Command! Use sv_list for list of commands!")
  7235.         end
  7236. end
  7237.  
  7238. --[[ LUA LANES STUFF
  7239. -- I think there's a bug with LuaLanes. All functions called from the lane should be declared as local.
  7240. -----------------------------------------------------------------------------------------------------------
  7241. --]]
  7242. lanes_reported_error = false
  7243. env = nil
  7244. con = nil
  7245.  
  7246. -- These two functions are used for communicating between the threads
  7247. function sendNotificationToWorker(command, data)
  7248.         if command == nil or data == nil then return end
  7249.         linda:send("command", command)
  7250.         linda:send("data", data)
  7251. end
  7252.  
  7253. -- Notifies the worker thread that it needs to close
  7254. function cleanupLanes()
  7255.         sendNotificationToWorker("cleanup", "unused")
  7256.         while (worker.status == "running" or worker.status == "waiting") do end
  7257. end
  7258.  
  7259. -- Executes the specified function if it exists in the global table
  7260. -- Credits to [SC]Nuggets
  7261. function exec(func, ...)
  7262.     if type(_G[func]) == "function" then
  7263.                 return 1, _G[func](...)
  7264.     end
  7265. end
  7266.  
  7267. -- Processes the output from the worker
  7268. function m_getstats(data)
  7269.     hprintf("main: getstats reply received :)")
  7270. end
  7271.  
  7272. function WorkerThread()
  7273.         hprintf("********TEST************")
  7274. --      http = require("http.tcp")
  7275.  
  7276.     -- Executes the specified function if it exists in the global table
  7277.     -- Credits to [SC]Nuggets
  7278.     function exec(func, ...)
  7279.         if type(_G[func]) == "function" then
  7280.             return 1, _G[func](...)
  7281.         end
  7282.     end
  7283.  
  7284.         function CheckForUpdate()
  7285.                 results = http.request("http://dl.dropbox.com/u/32815290/update.txt")
  7286.                 if results[1] ~= 0 then
  7287.                         if results[2] == 200 then
  7288.                                 if results[3] ~= script_version then
  7289.                                         sendNotificationToBoss("hprintf", "There is an updated commands script. Get it from wizard. Xfire: th3w1zard3")
  7290.                                         needsupdate = true
  7291.                                 end
  7292.                         end
  7293.                 end
  7294.         end
  7295.  
  7296.     -- Sends a message to the main thread
  7297.     function sendNotificationToBoss(command, data)
  7298.         if command == nil or data == nil then return end
  7299.         linda:send("outcommand", command)
  7300.         linda:send("outdata", data)
  7301.     end
  7302.  
  7303.     -------------------------------------------------------------------------
  7304.     -- BEGIN PROCESSING CODE
  7305.     -------------------------------------------------------------------------
  7306.  
  7307.     while true do -- loop until we're told to stop
  7308.         local data = linda:receive(1, "data") -- this will wait until there is a command to do
  7309.         local command = linda:receive(1, "command")
  7310.  
  7311.                 if (command == "cleanup") then
  7312.                         break
  7313.                 else
  7314.                         exec(command, data)
  7315.                 end
  7316.  
  7317.                 CheckForUpdate()
  7318.  
  7319.     end
  7320.  
  7321.     return 0
  7322. end
  7323.  
  7324. -- Called every ~100ms by the main thread to check on the worker
  7325. function CheckWorker(id, count)
  7326.     if (lanes_reported_error == false and worker.status == "error") then
  7327.         hprintf("There was an error in the worker thread.")
  7328.         v,err= worker:join()   -- no propagation
  7329.         hprintf(err)
  7330.         return 0 -- no point continuing
  7331.     end
  7332.  
  7333.     local data = linda:receive(0, "outdata")
  7334.     if data == nil then return 1 end
  7335.     local command = linda:receive(0, "outcommand")
  7336.     hprintf("data: " .. data .. " command: " .. command)
  7337.  
  7338.     exec(command, data)
  7339.     return 1 -- repeat
  7340. end

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

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

Raw Paste

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