- --require "mylanes"
- -- create the communication channel
- --linda = lanes.linda()
- -- How many messages can be sent within a specified amount of time
- -- My recommendation: 7 is best, unless you want a server with hardly any talking
- spam_max = 7
- -- How long the person will be muted for spamming (in seconds)
- spam_timeout = 60
- -- Don't modify the below variables unless you're a skilled and
- -- experienced scripter, and you're sure you know what your doing.
- rtv_timeout = 1
- script_check = 0
- cur_players = 0
- rtv_initiated = 0
- admin_table = {}
- mute_table = {}
- suspend_table = {}
- bos_table = {}
- boslog_table = {}
- name_bans = {}
- access_table = {}
- rtv_table = {}
- votekick_table = {}
- votekicktimeout_table = {}
- spam_table = {}
- spamtimeout_table = {}
- ghost_table = {}
- time_passed = 0 -- Initialize time_passed to 0 seconds
- mode = {}
- hidden = {}
- follow = {}
- objspawntype = {}
- objspawntag = {}
- afk = {}
- ipadmins = {}
- Noweapons = {}
- global_rcons = {}
- unique_table = {}
- nukes = {}
- vehicle_drone_table = {}
- loc = {}
- control_table = {}
- Object_table = {}
- id = 0
- message_table = {}
- Chat = 0
- timer_started = 0
- message_delay = 3
- uniques = 0
- ip_banlist = {}
- mute_banlist = {}
- ip_table = {}
- --Objects Table (for handling purposes)
- objects = {}
- -- Bipeds
- objects[1] = {"cyborg", "bipd", "characters\\cyborg_mp\\cyborg_mp"}
- -- Equipment
- objects[2] = {"camo", "eqip", "powerups\\active camouflage"}
- objects[3] = {"health", "eqip", "powerups\\health pack"}
- objects[4] = {"overshield", "eqip", "powerups\\over shield"}
- objects[5] = {"fnade", "eqip", "weapons\\frag grenade\\frag grenade"}
- objects[6] = {"pnade", "eqip", "weapons\\plasma grenade\\plasma grenade"}
- -- Vehicles
- objects[7] = {"shee", "vehi", "vehicles\\banshee\\banshee_mp"}
- objects[8] = {"turret", "vehi", "vehicles\\c gun turret\\c gun turret_mp"}
- objects[9] = {"ghost", "vehi", "vehicles\\ghost\\ghost_mp"}
- objects[10] = {"rhog", "vehi", "vehicles\\rwarthog\\rwarthog"}
- objects[11] = {"tank", "vehi", "vehicles\\scorpion\\scorpion_mp"}
- objects[12] = {"hog", "vehi", "vehicles\\warthog\\mp_warthog"}
- -- Weapons
- objects[13] = {"rifle", "weap", "weapons\\assault rifle\\assault rifle"}
- objects[14] = {"ball", "weap", "weapons\\ball\\ball"}
- objects[15] = {"flag", "weap", "weapons\\flag\\flag"}
- objects[16] = {"flamethrower", "weap", "weapons\\flamethrower\\flamethrower"}
- objects[17] = {"needler", "weap", "weapons\\needler\\mp_needler"}
- objects[18] = {"pistol", "weap", "weapons\\pistol\\pistol"}
- objects[19] = {"ppistol", "weap", "weapons\\plasma pistol\\plasma pistol"}
- objects[20] = {"prifle", "weap", "weapons\\plasma rifle\\plasma rifle"}
- objects[21] = {"frg", "weap", "weapons\\plasma_cannon\\plasma_cannon"}
- objects[22] = {"rocket", "weap", "weapons\\rocket launcher\\rocket launcher"}
- objects[23] = {"shotgun", "weap", "weapons\\shotgun\\shotgun"}
- objects[24] = {"sniper", "weap", "weapons\\sniper rifle\\sniper rifle"}
- -- Projectiles
- objects[25] = {"sheebolt", "proj", "vehicles\\banshee\\banshee bolt"}
- objects[26] = {"sheerod", "proj", "vehicles\\banshee\\mp_banshee fuel rod"}
- objects[27] = {"turretbolt", "proj", "vehicles\\c gun turret\\mp gun turret"}
- objects[28] = {"ghostbolt", "proj", "vehicles\\ghost\\ghost bolt"}
- objects[29] = {"tankshot", "proj", "vehicles\\scorpion\\bullet"}
- objects[30] = {"tankshell", "proj", "vehicles\\scorpion\\tank shell"}
- objects[31] = {"hogshot", "proj", "vehicles\\warthog\\bullet"}
- objects[32] = {"rifleshot", "proj", "weapons\\assault rifle\\bullet"}
- objects[33] = {"flame", "proj", "weapons\\flamethrower\\flame"}
- objects[34] = {"needlershot", "proj", "weapons\\needler\\mp_needle"}
- objects[35] = {"pistolshot", "proj", "weapons\\pistol\\bullet"}
- objects[36] = {"ppistolbolt", "proj", "weapons\\plasma pistol\\bolt"}
- objects[37] = {"priflebolt", "proj", "weapons\\plasma rifle\\bolt"}
- objects[38] = {"priflecbolt", "proj", "weapons\\plasma rifle\\charged bolt"}
- objects[39] = {"rocketproj", "proj", "weapons\\rocket launcher\\rocket"}
- objects[40] = {"shottyshot", "proj", "weapons\\shotgun\\pellet"}
- objects[41] = {"snipershot", "proj", "weapons\\sniper rifle\\sniper bullet"}
- -- if a command is not in this list, whenever a person executes that command, it
- -- will say Invalid Command.
- commands_table = {
- "/a",
- "/ipadminadd",
- "/ipadmindel",
- "/afk",
- "/alias",
- "/ammo",
- "/b",
- "/bos",
- "/boslist",
- "/banlist",
- "/balance",
- "/deathless",
- "/commands",
- "/count",
- "/c",
- "/e",
- "/crash",
- "/eject",
- "/enter",
- "/falldamage",
- "/getloc",
- "/godmode",
- "/getip",
- "/hax",
- "/heal",
- "/hitler",
- "/infammo",
- "/give",
- "/gethash",
- "/ghost",
- "/hide",
- "/invis",
- "/info",
- "/ipban",
- "/ipbanlist",
- "/ipunban",
- "/j",
- "/k",
- "/kill",
- "/lo3",
- "/launch",
- "/write",
- "/m",
- "/mc",
- "/mnext",
- "/mute",
- "/nuke",
- "/textban",
- "/textbanlist",
- "/textunban",
- "/noweapons",
- "/nameban",
- "/namebanlist",
- "/nameunban",
- "/os",
- "/privatesay",
- "/pl",
- "/reset",
- "/resp",
- "/revoke",
- "/resetweapons",
- "/say",
- "/setassists",
- "/setcolor",
- "/setdeaths",
- "/setfrags",
- "/setkills",
- "/setmode",
- "/setname",
- "/setresp",
- "/setscore",
- "/setplasmas",
- "/spd",
- "/spawn",
- "/specs",
- "/st",
- "/superban",
- "/suspend",
- "/t",
- "/timelimit",
- "/takeweapons",
- "/tp",
- "/ts",
- "/unban",
- "/unbos",
- "/unhide",
- "/unghost",
- "/ungod",
- "/unhax",
- "/uninvis",
- "/unmute",
- "/unsuspend",
- "/viewadmins",
- "/version"
- }
- function GetRequiredVersion()
- return 10057
- end
- function OnScriptLoad(process)
- processid = process
- if script_check == 0 then
- local file = io.open("temp_" .. tostring(process) .. ".tmp", "r")
- if file and process then
- registertimer(0, "DefaultSvTimer", "temp_" .. process .. ".tmp")
- file:close()
- else
- registertimer(0, "DefaultSvTimer", "defaults.txt")
- end
- game = GetGameAddresses()
- --registertimer(500, "ChangeVersion")
- --[[workerTemplate = lanes.gen("*", {["globals"] = _G}, WorkerThread)
- worker = workerTemplate()--]]
- gametype = readbyte(gametype_base + 0x30, 0x0)
- writeword(special_chars, 0x0, 0x9090) -- special chars in servername patch
- writeword(gametype_patch, 0x0, 0xEB) -- gametype patch
- writeword(devmode_patch1, 0x0, 0x9090) -- devmode
- writeword(devmode_patch2, 0x0, 0x9090) -- devmode
- --registertimer(0, "CCTimer")
- spamtimer = registertimer(970, "SpamTimer")
- maintimer = registertimer(20, "MainTimer")
- hprinter = registertimer(334, "HprintTimer")
- --checkworker = registertimer(100, "CheckWorker")
- profilepath = getprofilepath()
- for i=0,15 do
- if getplayer(i) then
- cur_players = cur_players + 1
- ip_table[resolveplayer(i)] = getip(i)
- messages[gethash(i)] = {}
- end
- vehicle_drone_table[i] = {}
- afk[i+1] = {}
- loc[i+1] = {}
- control_table[i+1] = {}
- end
- local file = io.open(string.format("%s\\ipbanlist.txt", profilepath), "r")
- if file then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, word)
- end
- ip_banlist[tostring(words[1])] = words[2]
- end
- file:close()
- end
- local file = io.open(string.format("%s\\textbanlist.txt", profilepath), "r")
- if file then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, word)
- end
- mute_banlist[tostring(words[1])] = {words[2], words[3]}
- end
- file:close()
- end
- local file = io.open(string.format("%s\\namebans.txt", profilepath), "r")
- if file then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(name_bans, word)
- end
- end
- file:close()
- end
- WriteChangeLog()
- local file = io.open(string.format("%s\\admin.txt", profilepath), "r")
- if (file ~= nil) then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, tostring(word))
- end
- if count >= 3 then
- if not admin_table then admin_table = {} end
- if not admin_table[words[2]] then admin_table[words[2]] = {} end
- admin_table[words[2]].name = words[1]
- admin_table[words[2]].level = words[3]
- end
- if count == 4 and tonumber(words[3]) then
- if not ipadmins[words[4]] then ipadmins[words[4]] = {} end
- ipadmins[words[4]].name = words[1]
- ipadmins[words[4]].level = words[3]
- end
- end
- file:close()
- end
- local file = io.open(string.format("%s\\admins.txt", profilepath), "r")
- if (file ~= nil) then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, tostring(word))
- end
- if not admin_table[words[2]] then admin_table[words[2]] = {} end
- admin_table[words[2]].name = words[1]
- admin_table[words[2]].level = words[3]
- if count == 4 and tonumber(words[3]) then
- if not ipadmins[words[4]] then ipadmins[words[4]] = {} end
- ipadmins[words[4]].name = words[1]
- ipadmins[words[4]].level =words[3]
- end
- end
- file:close()
- end
- local file = io.open(string.format("%s\\ipadmins.txt", profilepath), "r")
- if (file ~= nil) then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, tostring(word))
- end
- if count == 3 and tonumber(words[3]) then
- if not ipadmins[words[2]] then ipadmins[words[2]] = {} end
- ipadmins[words[2]].level = words[3]
- ipadmins[words[2]].name = words[1]
- end
- end
- file:close()
- end
- local file = io.open(string.format("%s\\uniques.txt", profilepath), "r")
- if file then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i - 1)
- table.insert(words, word)
- end
- if count == 3 then
- local name = words[1]
- local hash = words[2]
- local ip = words[3]
- unique_table[name] = {hash, ip}
- uniques = uniques + 1
- end
- end
- file:close()
- end
- local file = io.open(string.format("%s\\access.ini", profilepath), "r")
- if (file ~= nil) then
- local j
- for line in file:lines() do
- if j == nil then
- local start = string.sub(line, 2, 2)
- j = tonumber(start)
- if j == nil then break end
- else
- if string.sub(line, 1, 1) ~= "[" then
- local count = gettokencount(line, ",")
- local commands = string.sub(line, 6, line:len())
- for i = 0,count-1 do
- local word = gettoken(commands, ",", i)
- if word == "-1" then access_table[j] = -1 break end
- if access_table[j] == nil then
- access_table[j] = "," .. word
- else
- access_table[j] = access_table[j] .. "," .. word
- end
- end
- j = j + 1
- end
- end
- end
- file:close()
- AccessMerging()
- else -- access file doesn't exist, create it.
- file = io.open(profilepath .. "\\access.ini", "w")
- file:write("[0]\n")
- file:write("data=-1")
- access_table[0] = -1
- file:close()
- end
- local file = io.open(string.format("%s\\files\\rtv.txt", profilepath), "r")
- if (file ~= nil) then
- rtv_initiated = tonumber(file:read("*line"))
- file:close()
- end
- if rtv_initiated < 0 then
- local file = io.open(string.format("%s\\files\\rtv.txt", profilepath), "w+")
- if (file ~= nil) then
- file:write(rtv_initiated + 1)
- file:close()
- end
- end
- local file = io.open(string.format("%s\\files\\bos.txt", profilepath), "r")
- if (file ~= nil) then
- for line in file:lines() do
- local words = {}
- local count = gettokencount(line, ",")
- for i = 1,count do
- local word = gettoken(line, ",", i-1)
- table.insert(words, word)
- end
- local name = words[1]
- local hash = words[2]
- local ip = words[3]
- name = name:gsub(" ", "", 1)
- table.insert(boslog_table, name .. "," .. hash .. "," .. ip)
- end
- file:close()
- end
- table.sort(boslog_table)
- registertimer(0, "deleteadmins")
- end
- script_check = 1
- end
- function deleteadmins(id, count)
- local file = io.open(profilepath .. '\\admin.txt', "r")
- if file then
- for line in file:lines() do
- svcmd("sv_admin_del " .. 1)
- end
- end
- sv_admin_del = true
- return 0
- end
- function CCTimer(id, count)
- --cmp byte ptr [005DF847],33
- --[[writebyte(0x2420000, 0x0, 0x80) -- cmp
- writebyte(0x2420000, 0x1, 0x3D) -- byte ptr
- writedword(0x2420000, 0x2, 0x47F85D00) -- [005DF847]
- writebyte(0x2420000, 0x6, 0x33) -- ,33
- --jne 0242001F
- writebyte(0x2420007, 0x0, 0x75) -- jne
- writebyte(0x2420007, 0x1, 0x16) -- 0242001F
- --mov [005DF847],00002E34
- writebyte(0x2420009, 0x0, 0xC7) -- mov
- writebyte(0x2420009, 0x1, 0x5) -- [005DF847]
- writedword(0x2420009, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x2420009, 0x6, 0x342E0000) -- ,00002E34
- --mov [005DF849],37303630
- writebyte(0x2420013, 0x0, 0xC7) -- mov
- writebyte(0x2420013, 0x1, 0x5) -- [005DF849]
- writedword(0x2420013, 0x2, 0x49F85D00) -- [005DF849]
- writedword(0x2420013, 0x6, 0x37303630) -- ,37303630
- --jmp 02420052
- writebyte(0x242001D, 0x0, 0xEB) -- jmp
- writebyte(0x242001D, 0x1, 0x33) -- 02420052
- --cmp byte ptr [005DF847],34
- writebyte(0x242001F, 0x0, 0x80) -- cmp
- writebyte(0x242001F, 0x1, 0x3D) -- byte ptr
- writedword(0x242001F, 0x2, 0x47F85D00) -- [005DF847]
- writebyte(0x242001F, 0x6, 0x34) -- ,34
- --jne 0242003E
- writebyte(0x2420026, 0x0, 0x75) -- jne
- writebyte(0x2420026, 0x1, 0x16) -- 0242003E
- --mov [005DF847],00002E38
- writebyte(0x2420028, 0x0, 0xC7) -- mov
- writebyte(0x2420028, 0x1, 0x5) -- [005DF847]
- writedword(0x2420028, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x2420028, 0x6, 0x382E0000) -- ,00002E38
- --mov [005DF849],37303630
- writebyte(0x2420032, 0x0, 0xC7) -- mov
- writebyte(0x2420032, 0x1, 0x5) -- [005DF849]
- writedword(0x2420032, 0x2, 0x49F85D00) -- [005DF849]
- writedword(0x2420032, 0x6, 0x30363136) -- ,37303630
- --jmp 02420052
- writebyte(0x242003C, 0x0, 0xEB) -- jmp
- writebyte(0x242003C, 0x1, 0x14) -- 02420052
- --mov [005DF847],00002E33
- writebyte(0x242003E, 0x0, 0xC7) -- mov
- writebyte(0x242003E, 0x1, 0x5) -- [005DF847]
- writedword(0x242003E, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x242003E, 0x6, 0x332E0000)
- --mov [005DF849],35303630
- writebyte(0x2420048, 0x0, 0xC7)
- writebyte(0x2420048, 0x1, 0x5)
- writedword(0x2420048, 0x2, 0x49F85D00)
- writedword(0x2420048, 0x6, 0x30363136)
- --mov ecx,[005DF840] : ["01.00.03.0605"]
- writebyte(0x2420052, 0x0, 0x8B)
- writebyte(0x2420052, 0x1, 0xD)
- writedword(0x2420052, 0x2, 0x40F85D00)
- --jmp 0058E386
- writebyte(0x2420058, 0x0, 0xE9)
- writedword(0x2420058, 0x1, 0x29E316FE)
- --jmp to the codecave here:
- --jmp 02420000
- writebyte(0x58E380, 0x0, 0xE9) -- jmp
- writedword(0x58E380, 0x1, 0x7B1CE901) -- 02420000
- writebyte(0x58E385, 0x0, 0x90) -- nop
- writedword(0x5992DE, 0x0, 0xFFFFFFFF)--]]
- writebyte(0x2420000, 0x1, 0x3D) -- byte ptr
- writedword(0x2420000, 0x2, 0x47F85D00) -- [005DF847]
- writebyte(0x2420000, 0x6, 0x33) -- ,33
- --jne 0242001F
- writebyte(0x2420007, 0x0, 0x75) -- jne
- writebyte(0x2420007, 0x1, 0x16) -- 0242001F
- --mov [005DF847],00002E34
- writebyte(0x2420009, 0x0, 0xC7) -- mov
- writebyte(0x2420009, 0x1, 0x5) -- [005DF847]
- writedword(0x2420009, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x2420009, 0x6, 0x342E0000) -- ,00002E34
- --mov [005DF849],37303630
- writebyte(0x2420013, 0x0, 0xC7) -- mov
- writebyte(0x2420013, 0x1, 0x5) -- [005DF849]
- writedword(0x2420013, 0x2, 0x49F85D00) -- [005DF849]
- writedword(0x2420013, 0x6, 0x37303630) -- ,37303630
- --jmp 02420052
- writebyte(0x242001D, 0x0, 0xEB) -- jmp
- writebyte(0x242001D, 0x1, 0x33) -- 02420052
- --cmp byte ptr [005DF847],34
- writebyte(0x242001F, 0x0, 0x80) -- cmp
- writebyte(0x242001F, 0x1, 0x3D) -- byte ptr
- writedword(0x242001F, 0x2, 0x47F85D00) -- [005DF847]
- writebyte(0x242001F, 0x6, 0x34) -- ,34
- --jne 0242003E
- writebyte(0x2420026, 0x0, 0x75) -- jne
- writebyte(0x2420026, 0x1, 0x16) -- 0242003E
- --mov [005DF847],00002E38
- writebyte(0x2420028, 0x0, 0xC7) -- mov
- writebyte(0x2420028, 0x1, 0x5) -- [005DF847]
- writedword(0x2420028, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x2420028, 0x6, 0x382E0000) -- ,00002E38
- --mov [005DF849],37303630
- writebyte(0x2420032, 0x0, 0xC7) -- mov
- writebyte(0x2420032, 0x1, 0x5) -- [005DF849]
- writedword(0x2420032, 0x2, 0x49F85D00) -- [005DF849]
- writedword(0x2420032, 0x6, 0x30363136) -- ,37303630
- --jmp 02420052
- writebyte(0x242003C, 0x0, 0xEB) -- jmp
- writebyte(0x242003C, 0x1, 0x14) -- 02420052
- --mov [005DF847],00002E33
- writebyte(0x242003E, 0x0, 0xC7) -- mov
- writebyte(0x242003E, 0x1, 0x5) -- [005DF847]
- writedword(0x242003E, 0x2, 0x47F85D00) -- [005DF847]
- writedword(0x242003E, 0x6, 0x332E0000)
- --mov [005DF849],35303630
- writebyte(0x2420048, 0x0, 0xC7)
- writebyte(0x2420048, 0x1, 0x5)
- writedword(0x2420048, 0x2, 0x49F85D00)
- writedword(0x2420048, 0x6, 0x30363136)
- --mov ecx,[005DF840] : ["01.00.03.0605"]
- writebyte(0x2420052, 0x0, 0x8B)
- writebyte(0x2420052, 0x1, 0xD)
- writedword(0x2420052, 0x2, 0x40F85D00)
- --jmp 0058E386
- writebyte(0x2420058, 0x0, 0xE9)
- writedword(0x2420058, 0x1, 0x29E316FE)
- --jmp to the codecave here:
- --jmp 02420000
- writebyte(0x58E380, 0x0, 0xE9) -- jmp
- writedword(0x58E380, 0x1, 0x7B1CE901) -- 02420000
- writebyte(0x58E385, 0x0, 0x90) -- nop
- return 0
- end
- function OnScriptUnload()
- local file = io.open(profilepath .. "//files//bos.txt", "w")
- if file then
- for k,v in pairs(boslog_table) do
- if v then
- file:write(v .. "\n")
- end
- end
- file:close()
- end
- local file = io.open(profilepath .. "\\ipadmins.txt", "w")
- for k,v in pairs(ipadmins) do
- file:write(tostring(ipadmins[k].name) .. "," .. tostring(k) .. "," .. tostring(ipadmins[k].level) .. "\n")
- end
- file:close()
- local file = io.open(profilepath .. "\\admins.txt", "w")
- for k,v in pairs(admin_table) do
- file:write(tostring(admin_table[k].name) .. "," .. tostring(k) .. "," .. tostring(admin_table[k].level) .. "\n")
- end
- file:close()
- local file = io.open(profilepath .. "\\uniques.txt", "w")
- for k,v in pairs(unique_table) do
- local line = k .. "," .. v[1] .. "," .. v[2]
- file:write(tostring(line) .. "\n")
- end
- file:close()
- local file = io.open("temp_" .. tostring(processid) .. ".tmp", "w")
- if deathless then
- file:write("sv_deathless 1\n")
- else
- file:write("sv_deathless 0\n")
- end
- if respset then
- file:write("sv_respawn_time " .. tostring(resptime) .."\n")
- else
- file:write("sv_respawn_time default\n")
- end
- if infammo then
- file:write("sv_infinite_ammo 1\n")
- else
- file:write("sv_infinite_ammo 0\n")
- end
- if rockthevote then
- file:write("sv_rtv_enabled true\n")
- else
- file:write("sv_rtv_enabled false\n")
- end
- if rtv_required then
- file:write("sv_rtv_needed " .. tostring(rtv_required) .. "\n")
- end
- if votekick_allowed then
- file:write("sv_votekick_enabled true\n")
- else
- file:write("sv_votekick_enabled false\n")
- end
- if votekick_required then
- file:write("sv_votekick_needed " .. tostring(votekick_required) .. "\n")
- end
- if votekick_action then
- file:write("sv_votekick_action " .. tostring(votekick_action) .. "\n")
- end
- if Version then
- file:write("sv_version " .. string.sub(tostring(Version), 7, 8) .. "\n")
- else
- file:write("sv_version 1.09\n")
- end
- if version_check then
- file:write("sv_version_check true\n")
- else
- file:write("sv_version_check false\n")
- end
- if hash_check then
- file:write("sv_hash_check true\n")
- else
- file:write("sv_hash_check false\n")
- end
- if noweapons then
- file:write("sv_noweapons true\n")
- else
- file:write("sv_noweapons false\n")
- end
- if falldamage then
- file:write("sv_falldamage true")
- else
- file:write("sv_falldamage false")
- end
- file:close()
- for i = 0,15 do
- cleanupdrones(i)
- end
- end
- function OnNewGame(Mapname)
- map = Mapname
- end
- function OnGameEnd(mode)
- if mode == 1 then
- if maintimer then
- removetimer(maintimer)
- end
- if spamtimer then
- removetimer(spamtimer)
- end
- if rtvtimer then
- removetimer(rtvtimer)
- end
- if votekicktimer then
- removetimer(votekicktimer)
- end
- if testtimer then
- removetimer(testtimer)
- end
- rtv_initiated = -1
- votekick_allowed = false
- for i = 0,15 do
- cleanupdrones(i)
- end
- elseif mode == 2 then
- say("This has been made possible by Phasor.")
- say("http://phasor.proboards.com!")
- elseif mode == 3 then
- local file = io.open(profilepath .. "//files//bos.txt", "w")
- if file then
- for k,v in pairs(boslog_table) do
- if v then
- file:write(v .. "\n")
- end
- end
- file:close()
- end
- if hprinter then
- removetimer(hprinter)
- end
- end
- end
- function OnServerChat(player, chattype, message)
- local AllowChat = 1
- local count = gettokencount(message, " ")
- local t = {}
- local name = getname(player)
- local hash = gethash(player)
- local ip = getip(player)
- local access
- for k,v in pairs(mute_banlist) do
- for k2,v2 in pairs(mute_banlist[k]) do
- if mute_banlist[k][k2] == hash or mute_banlist[k][k2] == ip then
- return 0
- end
- end
- end
- if mute_table[hash] then
- return 0
- end
- if spamtimeout_table[hash] then
- return 0
- end
- for i=1,count do
- local word = gettoken(message, " ", i - 1)
- word = string.lower(word)
- table.insert(t, word)
- end
- if t[1] == "rtv" then
- if count == 1 and rockthevote then
- if rtv_initiated >= 0 then
- local rtv_count = 0
- local rtv_number = round(cur_players * rtv_required, 0)
- for i = 0,15 do
- local hash2 = gethash(i)
- if getplayer(i) then
- if rtv_table[hash2] == 1 then
- rtv_count = rtv_count + 1
- end
- end
- end
- if rtv_count == 0 then
- rtv_initiated = 1
- rtv_table[hash] = 1
- rtv_count = rtv_count + 1
- say(name .. " has initiated rtv!")
- say("Type \"rtv\" to join the vote!")
- rtvtimer = registertimer(120000, "rtvTimer")
- else
- if rtv_table[hash] == 1 then
- privatesay(player, "You have already voted for rtv!")
- elseif rtv_table[hash] == nil then
- rtv_table[hash] = 1
- rtv_count = rtv_count + 1
- say(name .. " has voted for rtv!")
- say(rtv_count .. " of " .. rtv_number .. " votes required for rtv!")
- end
- end
- local file = io.open(profilepath .. "//files//rtv.txt", "w")
- if file then
- file:write(rtv_timeout)
- file:close()
- end
- if rtv_count >= rtv_number then
- removetimer(rtvtimer)
- rtv_initiated = rtv_timeout
- say("Enough votes for rtv, game is now ending...")
- svcmd("sv_map_next")
- end
- else
- privatesay(player, "You cannot initiate rtv at this time!")
- end
- AllowChat = 0
- elseif count == 1 then
- privatesay(player, "Rockthevote is disabled.")
- end
- elseif t[1] == "votekick" then
- if count == 2 then
- if votekick_allowed and votekicktimeout_table[hash] == nil then
- local players = getvalidplayers(t[2], player)
- if players then
- for j = 1,#players do
- local votekick_count = 0
- local votekick_number = round(cur_players * votekick_required, 0)
- local player2 = players[j]
- local name2 = getname(players[j])
- local hash2 = gethash(players[j])
- local ip2 = getip(players[j])
- local admin
- for i=0,15 do
- if getplayer(i) then
- if votekick_table[hash2] == 1 then
- votekick_count = votekick_count + 1
- end
- end
- end
- if hash2 then
- if admin_table[hash2] or ipadmins[ip2] then
- admin = true
- break
- end
- if not admin then
- if player ~= player2 then
- votekick_allowed = player2
- votekick_table[hash] = 1
- votekick_count = votekick_count + 1
- say(name .. " has initiated a votekick on " .. name2 .. "!")
- say("Type \"kick\" to join the vote!")
- votekicktimer = registertimer(60000, 0, "votekickTimer")
- votekicktimeout_table[hash] = 1
- else
- privatesay(player, "Invalid player!")
- end
- else
- privatesay(player, "Admins cannot be votekicked!")
- end
- else
- privatesay(player, "Invalid player!")
- end
- if votekick_count >= votekick_number then
- for k,v in pairs(votekick_table) do
- votekick_table[k] = nil
- end
- removetimer(votekicktimer)
- votekick_allowed = true
- say("Kicking " .. name2 .. "!")
- if votekick_action == "ban" then
- svcmd("sv_ban " .. players[j] .. " 5m")
- else
- svcmd("sv_kick " .. players[j])
- end
- end
- end
- else
- privatesay(player, "Invalid player!")
- end
- else
- privatesay(player, "You cannot initiate a votekick at this time!")
- end
- AllowChat = 0
- end
- elseif t[1] == "kick" then
- if count == 1 then
- if votekick_allowed ~= true and votekick_allowed then
- local votekick_count = 0
- local votekick_number = round(cur_players * votekick_required)
- local name2 = getname(votekick_allowed)
- local sv_player = resolveplayer(votekick_allowed)
- for i=0,15 do
- local hash2 = gethash(i)
- if hash2 then
- if votekick_table[hash2] == 1 then
- votekick_count = votekick_count + 1
- end
- end
- end
- if player ~= votekick_allowed then
- if votekick_table[hash] == 1 then
- privatesay(player, "You have already voted!")
- elseif votekick_table[hash] == nil then
- votekick_table[hash] = 1
- votekick_count = votekick_count + 1
- say(name .. " has voted to kick " .. name2 .. "!")
- say(votekick_count .. " of " .. votekick_number .. " votes required to kick!")
- end
- else
- privatesay(player, "You are not allowed to vote!")
- end
- if votekick_count >= votekick_number then
- for k,v in pairs(votekick_table) do
- votekick_table[k] = nil
- end
- removetimer(votekicktimer)
- votekick_allowed = true
- say("Kicking " .. name2 .. "!")
- if votekick_action == "ban" then
- svcmd("sv_ban " .. sv_player .. " 5m")
- else
- svcmd("sv_kick " .. sv_player)
- end
- end
- else
- privatesay(player, "A votekick has not been initiated!")
- end
- AllowChat = 0
- end
- elseif string.sub(t[1], 1, 1) == "@" then
- local receiverID = string.sub(t[1], 2, t[1]:len())
- local players = getvalidplayers(receiverID, player)
- if players then
- for i = 1,#players do
- if player ~= players[i] then
- local sendernum = resolveplayer(player)
- local receivernum = resolveplayer(players[i])
- local privatemessage = table.concat(t, " ", 2, #t)
- hprint(player, "to " .. getname(players[i]) .. ": (" .. receivernum .. ") " .. privatemessage)
- hprint(players[i], getname(player) .. ": (" .. sendernum .. ") " .. privatemessage)
- end
- end
- privatesay(player, "Message Sent")
- else
- privatesay(player, "There is no player with an ID of " .. receiverID .. ".")
- end
- return 0
- end
- if admin_table[hash] then
- access = tonumber(admin_table[hash].level)
- elseif ipadmins[ip] then
- access = tonumber(ipadmins[ip].level)
- end
- if access then
- if string.sub(t[1], 1, 1) == "/" then
- AllowChat = 1
- elseif string.sub(t[1], 1, 1) == "\\" then
- AllowChat = 0
- end
- cmd = t[1]:gsub("\\", "/")
- local found1 = cmd:find("/")
- local found2 = cmd:find("/", 2)
- local valid_command
- local permission
- if found1 and not found2 then
- for k,v in pairs(commands_table) do
- if cmd == v then
- valid_command = true
- break
- end
- end
- if not valid_command then
- sendresponse("Invalid Command", t[1], player)
- else
- local command_list = access_table[access]
- local command = cmd:gsub("/", "sv_")
- if command_list == -1 then
- permission = true
- else
- local found = command_list:find("," .. command .. ",")
- if found then
- permission = true
- end
- end
- if permission then
- if cmd == "/a" and t[2] == "list" then
- Command_ShowAdminList(player, t[1] .. " " .. t[2], count)
- elseif cmd == "/a" and t[2] == "del" then
- Command_Admindel(player, t[1] .. " " .. t[2], t[3], count)
- elseif cmd == "/a" then
- Command_Adminadd(player, t[1], t[2], t[3], t[4], count)
- elseif cmd == "/afk" then
- Command_AFK(player, t[1], t[2], count)
- elseif cmd == "/ipadminadd" then
- Command_Ipadminadd(player, t[1], t[2], t[3], t[4], count)
- elseif cmd == "/ipadmindel" then
- Command_Ipadmindel(player, t[1], t[2], count)
- elseif cmd == "/gethash" then
- Command_Gethash(player, t[1], t[2], count)
- elseif cmd == "/alias" then
- Command_Alias(player, t[1], t[2], count)
- elseif cmd == "/ammo" then
- Command_Setammo(player, t[1], t[2], t[3], t[4], count)
- elseif cmd == "/b" then
- Command_Ban(player, t[1], t[2], t[3], count)
- elseif cmd == "/superban" then
- Command_Superban(player, t[1], t[2], count)
- elseif cmd == "/bos" then
- Command_Bos(player, t[1], t[2], count)
- elseif cmd == "/boslist" then
- Command_Boslist(player, t[1], count)
- elseif cmd == "/unbos" then
- Command_Unbos(player, t[1], t[2], count)
- elseif cmd == "/c" then
- Command_Control(player, t[1], t[2], t[3], count)
- elseif cmd == "/commands" then
- Command_Commands(player, t[1], count)
- elseif cmd == "/count" then
- Command_Count(player, t[1], count)
- elseif cmd == "/deathless" then
- Command_Deathless(player, t[1], t[2], count)
- elseif cmd == "/setmode" then
- Command_Setmode(player, t[1], t[2], t[3], t[4], count)
- elseif cmd == "/e" then
- Command_Execute(player, message)
- elseif cmd == "/crash" then
- Command_Crash(player, t[1], t[2], count)
- elseif cmd == "/eject" then
- Command_Eject(player, t[1], t[2], count)
- elseif cmd == "/follow" then
- Command_Follow(player, t[1], t[2], count)
- elseif cmd == "/falldamage" then
- Command_Falldamage(player, t[1], t[2], count)
- elseif cmd == "/getloc" then
- Command_Getloc(player, t[1], t[2], count)
- elseif cmd == "/ghost" then
- Command_Ghost(player, t[1], t[2], count)
- elseif cmd == "/hide" then
- Command_Hide(player, t[1], t[2], count)
- elseif cmd == "/unban" then
- Command_Unban(player, t[1], t[2], count)
- elseif cmd == "/unghost" then
- Command_Unghost(player, t[1], t[2], count)
- elseif cmd == "/godmode" then
- Command_Godmode(player, t[1], t[2], count)
- elseif cmd == "/getip" then
- Command_getip(player, t[1], t[2], count)
- elseif cmd == "/hax" then
- Command_Hax(player, t[1], t[2], count)
- elseif cmd == "/heal" then
- Command_Heal(player, t[1], t[2], count)
- elseif cmd == "/ungod" then
- Command_Ungod(player, t[1], t[2], count)
- elseif cmd == "/hitler" then
- Command_Hitler(player, t[1], count)
- elseif cmd == "/infammo" then
- Command_Infammo(player, t[1], t[2], count)
- elseif cmd == "/ipban" then
- Command_Ipban(player, t[1], t[2], count)
- elseif cmd == "/ipbanlist" then
- Command_Ipbanlist(player, t[1], count)
- elseif cmd == "/ipunban" then
- Command_Ipunban(player, t[1], t[2], count)
- elseif cmd == "/write" then
- Command_Write(player, t[1], t[2], t[3], t[4], t[5], t[6], count)
- elseif cmd == "/invis" then
- Command_Invis(player, t[1], t[2], t[3], count)
- elseif cmd == "/j" then
- Command_Move(player, t[1], t[2], t[3], t[4], t[5], count)
- elseif cmd == "/k" then
- Command_Kick(player, t[1], t[2], count)
- elseif cmd == "/kill" then
- Command_Kill(player, t[1], t[2], count)
- elseif cmd == "/lo3" then
- Command_lo3(player, t[1], count)
- elseif cmd == "/m" then
- Command_Map(player, message)
- elseif cmd == "/mc" then
- Command_StartMapcycle(player, t[1], count)
- elseif cmd == "/mnext" then
- Command_Mapnext(player, t[1], count)
- elseif cmd == "/mute" then
- Command_Mute(player, t[1], t[2], count)
- elseif cmd == "/nuke" then
- Command_Nuke(player, t[1], t[2], count)
- elseif cmd == "/noweapons" then
- Command_Noweapons(player, t[1], t[2], count)
- elseif cmd == "/nameban" then
- Command_Nameban(player, t[1], t[2], count)
- elseif cmd == "/namebanlist" then
- Command_Namebanlist(player, t[1], count)
- elseif cmd == "/nameunban" then
- Command_Nameunban(player, t[1], t[2], count)
- elseif cmd == "/os" then
- Command_Overshield(player, t[1], t[2], count)
- elseif cmd == "/pass" then
- Command_Setpassword(player, t[1], t[2], count)
- elseif cmd == "/pl" then
- Command_Getplayerlist(player, t[1], count)
- elseif cmd == "/privatesay" then
- Command_Privatesay(player, t, count)
- elseif cmd == "/reset" then
- Command_Mapreset(player, t[1], count)
- elseif cmd == "/revoke" then
- Command_Adminrevoke(player, t[1], t[2], count, "chat")
- elseif cmd == "/banlist" then
- Command_Banlist(player, t[1], count)
- elseif cmd == "/textban" then
- Command_Textban(player, t[1], t[2], count)
- elseif cmd == "/textbanlist" then
- Command_Textbanlist(player, t[1], count)
- elseif cmd == "/textunban" then
- Command_Textunban(player, t[1], t[2], count)
- elseif cmd == "/launch" then
- Command_Launch(player, t[1], t[2], count)
- elseif cmd == "/resp" then
- Command_Resp(player, t[1], t[2], t[3], count)
- elseif cmd == "/resetweapons" then
- Command_Resetweapons(player, t[1], t[2], count)
- elseif cmd == "/say" then
- if permission then
- if count ~= 1 then
- sendresponse(string.sub(message, 6), message, player)
- end
- else
- sendresponse("You cannot execute this command.", message, player)
- end
- elseif cmd == "/enter" then
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "enter", count)
- elseif cmd == "/setassists" then
- Command_Setassists(player, t[1], t[2], t[3], count)
- elseif cmd == "/setdeaths" then
- Command_Setdeaths(player, t[1], t[2], t[3], count)
- elseif cmd == "/setfrags" then
- Command_Setfrags(player, t[1], t[2], t[3], count)
- elseif cmd == "/setname" then
- Command_Setname(player, t[1], t[2], t[3], count)
- elseif cmd == "/setkills" then
- Command_Setkills(player, t[1], t[2], t[3], count)
- elseif cmd == "/setresp" then
- Command_Setresp(player, t[1], t[2], count)
- elseif cmd == "/setscore" then
- Command_Setscore(player, t[1], t[2], t[3], count)
- elseif cmd == "/setplasmas" then
- Command_Setplasmas(player, t[1], t[2], t[3], count)
- elseif cmd == "/spd" then
- Command_Setspeed(player, t[1], t[2], t[3], count)
- elseif cmd == "/specs" then
- Command_Specs(player, t[1], count)
- elseif cmd == "/spawn" then
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "spawn", count)
- elseif cmd == "/give" then
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "give", count)
- elseif cmd == "/st" then
- Command_Setteleport(player, t[1], t[2], t[3], count)
- elseif cmd == "/suspend" then
- Command_Suspend(player, t[1], t[2], t[3], count)
- elseif cmd == "/t" and t[2] == "list" then
- Command_ShowTeleportList(player, t[1] .. " " .. t[2], count)
- elseif cmd == "/t" and t[2] == "del" then
- Command_Teledelete(player, t[1] .. " " .. t[2], t[3], count)
- elseif cmd == "/t" then
- Command_Teleport(player, t[1], t[2], t[3], count)
- elseif cmd == "/takeweapons" then
- Command_Takeweapons(player, t[1], t[2], count)
- elseif cmd == "/setcolor" then
- Command_Setcolor(player, t[1], t[2], t[3], count)
- elseif cmd == "/tp" then
- Command_Teletoplayer(player, t[1], t[2], t[3], count)
- elseif cmd == "/ts" then
- Command_Changeteam(player, t[1], t[2], count)
- elseif cmd == "/timelimit" then
- Command_Timelimit(player, t[1], t[2], count)
- elseif cmd == "/unhax" then
- Command_Unhax(player, t[1], t[2], count)
- elseif cmd == "/unhide" then
- Command_Unhide(player, t[1], t[2], count)
- elseif cmd == "/uninvis" then
- Command_Uninvis(player, t[1], t[2], count)
- elseif cmd == "/unmute" then
- Command_Unmute(player, t[1], t[2], count)
- elseif cmd == "/unsuspend" then
- Command_Unsuspend(player, t[1], t[2], count)
- elseif cmd == "/viewadmins" then
- Command_Viewadmins(player, t[1], count)
- elseif cmd == "/version" then
- Command_Version(player, t[1], t[2], count)
- elseif cmd == "/balance" then
- Command_BalanceTeams(player, t[1], count)
- elseif cmd == "/info" then
- Command_Info(player, t[1], t[2], count)
- end
- WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. "(Hash: " .. gethash(player) .. " IP: " .. getip(player) .. ") has executed: " .. message)
- else
- say("BLAH")
- sendresponse("You cannot execute this command.", message, player)
- WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. "(Hash: " .. gethash(player) .. " IP: " .. getip(player) .. ") " .. " has failed to execute " .. cmd)
- end
- end
- end
- elseif message:sub(1, 1) == "/" or message:sub(1, 1) == "\\" then
- sendresponse("You cannot execute this command.", message:sub(1, 1), player)
- end
- if AllowChat == 1 and not access then
- if not spam_table[hash] then
- spam_table[hash] = 1
- else
- spam_table[hash] = spam_table[hash] + 1
- end
- end
- return AllowChat
- end
- Spawn = function(message, objname, objtype, objloc, player, type)
- m = {}
- vehid = 0
- local count = gettokencount(message, " ")
- for i=1,count do
- local word = gettoken(message, " ", i - 1)
- word = string.lower(word)
- table.insert(m, word)
- end
- if count == 2 then -- only spawn one next to person spawning
- local m_playerObjId = getplayerobjectid(player)
- local m_object = getobject(m_playerObjId)
- local m_vehicleId = readdword(m_object, 0x11C)
- if m_object then
- if m_vehicleId ~= 0xFFFFFFFF then
- x,y,z = getobjectcoords(m_vehicleId)
- else
- x,y,z = getobjectcoords(m_playerObjId)
- local camera_x = readfloat(m_object, 0x230)
- local camera_y = readfloat(m_object, 0x234)
- x = x + camera_x * 2
- y = y + camera_y * 2
- z = z + 2
- end
- vehid = createobject(objtype, objloc, 0, 60, false, x+1.0, y, z + 1.3)
- if type == "give" then
- assignweapon(player, vehid)
- sendresponse(objname .. " given to " .. getname(player), message, player)
- elseif type == "spawn" then
- sendresponse(objname .. " spawned at " .. getname(player) .. "'s location", message, player)
- elseif type == "enter" then
- table.insert(vehicle_drone_table[player], vehid)
- entervehicle(player, vehid, 0)
- sendresponse(tostring(getname(player)) .. " was forced to enter a " .. tostring(objname), message, player)
- end
- else
- sendresponse("You cannot spawn stuff while dead!", message, player)
- end
- elseif count >= 3 and count <= 6 then
- local players = getvalidplayers(m[3], player)
- if players then
- for i = 1,#players do
- local m_playerObjId = getplayerobjectid(players[i])
- local m_object = getobject(m_playerObjId)
- local m_vehicleId = readdword(m_object, 0x11C)
- if m_object then
- if m_vehicleId ~= 0xFFFFFFFF and getobject(m_vehicleId) then
- x,y,z = getobjectcoords(m_vehicleId)
- else
- x,y,z = getobjectcoords(m_playerObjId)
- local camera_x = readfloat(m_object, 0x230)
- local camera_y = readfloat(m_object, 0x234)
- x = x + camera_x * 2
- y = y + camera_y * 2
- z = z + 2
- end
- if count == 3 then
- vehid = createobject(objtype, objloc, 0, 60, false, x, y, z)
- if objtype == "weap" and type == "give" then
- assignweapon(players[i], vehid)
- sendresponse(objname .. " given to " .. getname(players[i]), message, player)
- sendresponse("You have been given a " .. objname .. ".", "\\", players[i])
- elseif type == "spawn" then
- sendresponse(objname .. " spawned at " .. getname(players[i]) .. "'s location.", message, player)
- elseif type == "enter" then
- table.insert(vehicle_drone_table[players[i]], vehid)
- entervehicle(players[i], vehid, 0)
- sendresponse(getname(players[i]) .. " was forced to enter a " .. objname, message, player)
- end
- elseif count == 4 then -- specify amount
- if m[4] ~= 0 then
- for i = 1,m[4] do
- createobject(objtype, objloc, 0, 0, false, x, y, z)
- end
- sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
- privatesay(players[i], objname .. " spawned above you.")
- else
- sendresponse("You didn't spawn anything!")
- end
- elseif count == 5 then -- specify resptime
- if m[4] ~= 0 then
- for i = 1,m[4] do
- createobject(objtype, objloc, 0, m[5], false, x, y, z)
- end
- sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
- privatesay(players[i], objname .. " spawned above you.")
- else
- sendresponse("You didn't spawn anything!")
- end
- elseif count == 6 then -- specify recycle boolean
- if m[4] ~= 0 then
- for i = 1,m[4] do
- createobject(objtype, objloc, 0, m[5], m[6], x, y, z)
- end
- sendresponse(m[4] .. " " .. objname .. "s spawned at " .. getname(players[i]) .. "'s location.", message, player)
- privatesay(players[i], objname .. " spawned above you.")
- else
- sendresponse("You didn't spawn anything!", message, player)
- end
- end
- elseif type ~= "give" then
- sendresponse("Could not spawn next to " .. getname(players[i]) .. ". Player is dead.", message, player)
- elseif type == "give" then
- sendresponse("Could not give " .. getname(players[i]) .. " a " .. objname .. ". Player is dead.", message, player)
- end
- end
- else
- sendresponse("Invalid Player!", message, player)
- end
- end
- return vehid
- end
- function OnServerCommand(player, command)
- local response = 1
- local count = getcmdtokencount(command)
- local cmd = getcmdtoken(command, 0)
- local permission = 1
- local hash = gethash(player)
- t = {}
- for i=1,count do
- local word = getcmdtoken(command, i - 1)
- word = string.lower(word)
- table.insert(t, word)
- end
- --[[if player ~= 0xFFFFFFFF and player ~= -1 then
- local bool = false
- if executed_global_rcon then
- for k,v in pairs(global_rcons) do
- if executed_global_rcon == k then
- if bool == true then break end
- if string.find(access_table[k], "," .. t[1] .. ",") then
- bool = true
- break
- end
- end
- end
- executed_global_rcon = nil
- end
- if bool == false then
- for k,v in pairs(admin_table) do
- if k == gethash(player) then
- bool = true
- break
- end
- end
- if bool == false then
- for k,v in pairs(ipadmins) do
- if bool == true then break end
- for k2,v2 in pairs(ipadmins[k]) do
- if ipadmins[k][k2] == getip(player) then
- bool = true
- break
- end
- end
- end
- end
- end
- if bool == false then
- return 0
- end
- end--]]
- if admin_table[hash] or player == 0xFFFFFFFF or ipadmins[getip(player)] then
- if t[1] == "sv_setafk" then
- response = 0
- Command_AFK(player, t[1], t[2], count)
- elseif t[1] == "sv_viewadmins" then
- response = 0
- Command_Viewadmins(player, t[1], count)
- elseif t[1] == "sv_privatesay" then
- response = 0
- Command_Privatesay(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_admin_add" then
- response = 0
- Command_Adminadd(player, t[1], t[2], t[3], t[4], count)
- elseif t[1] == "sv_ipadminadd" then
- response = 0
- Command_Ipadminadd(player, t[1], t[2], t[3], t[4], count)
- elseif t[1] == "sv_admin_del" then
- if sv_admin_del then
- response = 0
- Command_Admindel(player, t[1], t[2], count)
- end
- elseif t[1] == "sv_ipadmindel" then
- response = 0
- Command_Ipadmindel(player, t[1], t[2], count)
- elseif t[1] == "sv_admin_list" then
- response = 0
- Command_ShowAdminList(player, t[1], count)
- elseif t[1] == "sv_revoke" then
- response = 0
- Command_Adminrevoke(player, t[1], t[2], count, "rcon")
- elseif t[1] == "sv_gethash" then
- response = 0
- Command_Gethash(player, t[1], t[2], count)
- elseif t[1] == "sv_falldamage" then
- response = 0
- Command_Falldamage(player, t[1], t[2], count)
- elseif t[1] == "sv_launch" then
- response = 0
- Command_Launch(player, t[1], t[2], count)
- elseif t[1] == "sv_getip" then
- response = 0
- Command_getip(player, t[1], t[2], count)
- elseif t[1] == "sv_crash" then
- response = 0
- Command_Crash(player, t[1], t[2], count)
- elseif t[1] == "sv_rtv_enabled" then
- response = 0
- Command_RTVEnabled(player, t[1], t[2], count)
- elseif t[1] == "sv_rtv_needed" then
- response = 0
- Command_RTVRequired(player, t[1], t[2], count)
- elseif t[1] == "sv_votekick_enabled" then
- response = 0
- Command_VotekickEnabled(player, t[1], t[2], count)
- elseif t[1] == "sv_votekick_needed" then
- response = 0
- Command_VotekickRequired(player, t[1], t[2], count)
- elseif t[1] == "sv_votekick_action" then
- response = 0
- Command_VotekickAction(player, t[1], t[2], count)
- elseif t[1] == "sv_hash_check" then
- response = 0
- Command_Hashcheck(player, t[1], t[2], count)
- elseif t[1] == "sv_version_check" then
- response = 0
- Command_Versioncheck(player, t[1], t[2], count)
- elseif t[1] == "sv_version" then
- response = 0
- Command_Version(player, t[1], t[2], count)
- elseif t[1] == "sv_ban" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Ban(player, t[1], t[2], t[3], count)
- end
- elseif t[1] == "sv_nameban" then
- response = 0
- Command_Nameban(player, t[1], t[2], count)
- elseif t[1] == "sv_namebanlist" then
- response = 0
- Command_Namebanlist(player, t[1], count)
- elseif t[1] == "sv_nameunban" then
- response = 0
- Command_Nameunban(player, t[1], t[2], count)
- elseif t[1] == "sv_ipban" then
- response = 0
- Command_Ipban(player, t[1], t[2], count)
- elseif t[1] == "sv_ipbanlist" then
- response = 0
- Command_Ipbanlist(player, t[1], count)
- elseif t[1] == "sv_ipunban" then
- response = 0
- Command_Ipunban(player, t[1], t[2], count)
- elseif t[1] == "sv_superban" then
- response = 0
- Command_Superban(player, t[1], t[2], count)
- elseif t[1] == "sv_stickman_animation" then
- response = 0
- registertimer(200, "Stickman")
- elseif t[1] == "sv_kick" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Kick(player, t[1], t[2], count)
- end
- elseif t[1] == "sv_hide" then
- response = 0
- Command_Hide(player, t[1], t[2], count)
- elseif t[1] == "sv_superban" then
- Command_Superban(player, t[1], t[2], count)
- elseif t[1] == "sv_textban" then
- response = 0
- Command_Textban(player, t[1], t[2], count)
- elseif t[1] == "sv_textbanlist" then
- response = 0
- Command_Textbanlist(player, t[1], count)
- elseif t[1] == "sv_textunban" then
- response = 0
- Command_Textunban(player, t[1], t[2], count)
- elseif t[1] == "sv_pvtsay" then
- response = 0
- Command_Privatesay(player, t, count)
- elseif t[1] == "sv_unhide" then
- response = 0
- Command_Unhide(player, t[1], t[2], count)
- elseif t[1] == "sv_setammo" then
- response = 0
- Command_Setammo(player, t[1], t[2], t[3], t[4], count)
- elseif t[1] == "sv_help" then
- response = 0
- Command_Help(player, t[1], t[2], count)
- elseif t[1] == "sv_deathless" then
- response = 0
- Command_Deathless(player, t[1], t[2], count)
- elseif t[1] == "sv_setmode" then
- response = 0
- Command_Setmode(player, t[1], t[2], t[3], t[4], count)
- elseif t[1] == "sv_eject" then
- response = 0
- Command_Eject(player, t[1], t[2], count)
- elseif t[1] == "sv_getloc" then
- response = 0
- Command_Getloc(player, t[1], t[2], count)
- elseif t[1] == "sv_ghost" then
- response = 0
- Command_Ghost(player, t[1], t[2], count)
- elseif t[1] == "sv_unghost" then
- response = 0
- Command_Unghost(player, t[1], t[2], count)
- elseif t[1] == "sv_setgod" then
- response = 0
- Command_Godmode(player, t[1], t[2], count)
- elseif t[1] == "cheat_hax" then
- response = 0
- Command_Hax(player, t[1], t[2], count)
- elseif t[1] == "sv_heal" then
- response = 0
- Command_Heal(player, t[1], t[2], count)
- elseif t[1] == "sv_ungod" then
- response = 0
- Command_Ungod(player, t[1], t[2], count)
- elseif t[1] == "sv_hitler" then
- response = 0
- if count == 1 then
- for c = 0,15 do
- if getplayer(c) then
- kill(c)
- hprintf(getname(c) .. " was given a lethal injection!")
- end
- end
- else
- hprintf("Invalid Syntax: sv_hitler")
- end
- elseif t[1] == "sv_infinite_ammo" then
- response = 0
- Command_Infammo(player, t[1], t[2], count)
- elseif t[1] == "sv_invis" then
- response = 0
- Command_Invis(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_move" then
- response = 0
- Command_Move(player, t[1], t[2], t[3], t[4], t[5], count)
- elseif t[1] == "sv_scrim" then
- response = 0
- Command_Lo3(player, t[1], count)
- elseif t[1] == "sv_mute" then
- response = 0
- Command_Mute(player, t[1], t[2], count)
- elseif t[1] == "sv_noweapons" then
- response = 0
- Command_Noweapons(player, t[1], t[2], count)
- elseif t[1] == "sv_resp" then
- response = 0
- Command_Resp(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_enter" then
- response = 0
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "enter", count)
- elseif t[1] == "sv_setassists" then
- response = 0
- Command_Setassists(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_setdeaths" then
- response = 0
- Command_Setdeaths(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_setfrags" then
- response = 0
- Command_Setfrags(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_setkills" then
- response = 0
- Command_Setkills(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_setscore" then
- response = 0
- Command_Setscore(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_respawn_time" then
- response = 0
- Command_Setresp(player, t[1], t[2], count)
- elseif t[1] == "sv_setplasmas" then
- response = 0
- Command_Setplasmas(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_spawn" then
- response = 0
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "spawn", count)
- elseif t[1] == "sv_specs" then
- response = 0
- Command_Specs(player, t[1], count)
- elseif t[1] == "sv_give" then
- response = 0
- Command_Spawn(player, t[1], t[2], t[3], t[4], t[5], t[6], "give", count)
- elseif t[1] == "sv_suspend" then
- response = 0
- Command_Suspend(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_map" then
- if command:find("commands") == nil then
- response = 0
- Command_Map(player, command)
- end
- elseif t[1] == "sv_teleport_pl" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Teletoplayer(player, t[1], t[2], t[3], count)
- end
- elseif t[1] == "sv_teleport" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Teleport(player, t[1], t[2], t[3], count)
- end
- elseif t[1] == "sv_alias" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Alias(player, t[1], t[2], count)
- end
- elseif t[1] == "sv_changeteam" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Changeteam(player, t[1], t[2], count)
- end
- elseif t[1] == "sv_setname" then
- response = 0
- Command_Setname(player, t[1], t[2], t[3], count)
- elseif t[1] == "sv_time_cur" then
- Command_Timelimit(player, t[1], t[2], count)
- elseif t[1] == "cheat_unhax" then
- response = 0
- Command_Unhax(player, t[1], t[2], count)
- elseif t[1] == "sv_unmute" then
- response = 0
- Command_Unmute(player, t[1], t[2], count)
- elseif t[1] == "sv_unsuspend" then
- response = 0
- Command_Unsuspend(player, t[1], t[2], count)
- elseif cmd == "sv_bos" then
- response = 0
- Command_Bos(player, t[1], t[2], count)
- elseif cmd == "sv_setcolor" then
- response = 0
- Command_Setcolor(player, t[1], t[2], t[3], count)
- elseif cmd == "sv_takeweapons" then
- response = 0
- Command_Takeweapons(player, t[1], t[2], count)
- elseif cmd == "sv_resetweapons" then
- response = 0
- Command_Resetweapons(player, t[1], t[2], count)
- elseif cmd == "sv_boslist" then
- response = 0
- Command_Boslist(player, t[1], count)
- elseif cmd == "sv_unbos" then
- response = 0
- Command_Unbos(player, t[1], t[2], count)
- elseif cmd == "sv_kill" then
- if tonumber(t[2]) == nil then
- response = 0
- Command_Kill(player, t[1], t[2], count)
- end
- elseif cmd == "sv_info" then
- response = 0
- Command_Info(player, t[1], t[2], count)
- end
- if player ~= 0xFFFFFFFF and player ~= -1 and response == 0 then
- WriteLog(profilepath .. "\\logs\\commands.log", getname(player) .. " (Hash:" .. gethash(player) .. " IP: " .. getip(player) .. ") has executed '" .. command .. "'")
- end
- else
- sendresponse("You cannot execute this command.", t[1], player)
- response = 0
- end
- return response
- end
- function OnRconAttempt(player, command, rcon)
- local response = 1
- if IsAdmin(player) == false then
- local hash = gethash(player)
- local ip = getip(player)
- for k,v in pairs(global_rcons) do
- if k == rcon then
- executed_global_rcon = rcon
- svcmd(command, player)
- return 0
- end
- end
- if admin_table[hash] or ipadmins[ip] then
- svcmd(command, player)
- end
- end
- return response
- end
- WriteLog = function(filename, value)
- local file = io.open(filename, "a")
- if file then
- local timestamp = os.date("%Y/%m/%d %H:%M:%S")
- local line = string.format("%s\t%s\n", timestamp, tostring(value))
- file:write(line)
- file:close()
- end
- end
- getstatus = function(m_player)
- local status = ""
- local player_struct = getplayer(m_player)
- local m_playerObjId = readdword(player_struct, 0x34)
- local m_object = getobject(m_playerObjId)
- local obj_crouch = readbyte(m_object, 0x2A0)
- if obj_crouch == 0 then
- status = "wpassenger"
- elseif obj_crouch == 1 then
- status = "wpassenger"
- elseif obj_crouch == 2 then
- status = "wpassenger"
- elseif obj_crouch == 3 then
- status = "crouching"
- elseif obj_crouch == 4 then
- status = "standing"
- elseif obj_crouch == 5 then
- status = "gdriver"
- elseif obj_crouch == 6 then
- status = "bpilot"
- elseif obj_crouch == 13 then
- status = "sdriver"
- elseif obj_crouch == 17 then
- status = "turret"
- elseif obj_crouch == 20 or obj_crouch == 21 or obj_crouch == 22 or obj_crouch == 23 then
- status = "spassenger"
- end
- return status
- end
- function tohex(number)
- return string.format("%X", number)
- end
- function OnClientUpdate(player, m_objectId)
- --say(getname(player) .. ": " .. tostring(player))
- local id = resolveplayer(player)
- --local test = readbyte(m_player, 0x130) Changes when player joins?
- --local test = readbyte(m_player, 0x108) Changes to 0 when player joins?
- --local test = readword(m_object, 0x12) Changes to 1536 when shields go down/up
- --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.
- --local test = readbyte(m_object, 0xD4) Counts up when action occurs. Changes back to 6. Stays at one if shields are depleted.
- --local test = readbyte(m_object, 0x10C) Changes after you respawn. Changes to 255 while in vehicles.
- --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.
- --[[local x_aim = readfloat(m_player, 0x154) -- Confirmed. Lags.
- local y_aim = readfloat(m_player, 0x158) -- Confirmed. Lags.
- local z_aim = readfloat(m_player, 0x15C)--]]
- local x,y,z = getobjectcoords(m_objectId)
- if x ~= loc[id][1] or y ~= loc[id][2] or z ~= loc[id][3] then
- local m_object = getobject(m_objectId)
- if loc[id][1] == nil then
- loc[id][1] = x
- loc[id][2] = y
- loc[id][3] = z
- elseif m_object then
- local result = OnPositionUpdate(player, m_objectId, x, y, z)
- if result == 0 then
- movobjcoords(m_objectId, loc[id][1], loc[id][2], loc[id][3])
- else
- loc[id][1] = x
- loc[id][2] = y
- loc[id][3] = z
- end
- end
- end
- end
- OnPositionUpdate = function(player, m_objectId, x, y, z)
- local id = resolveplayer(player)
- local m_controlObject = getobject(m_objectId)
- if control_table[id][1] then
- for i = 1,#control_table[id] do
- local victim = control_table[id][i]
- local m_playerObjId = getplayerobjectid(victim)
- local m_object = getobject(m_playerObjId)
- if m_object then
- local m_vehicle = getobject(readdword(m_object, 0x11C))
- if m_vehicle == nil then
- local x_vel = readfloat(m_controlObject, 0x68)
- local y_vel = readfloat(m_controlObject, 0x6C)
- writefloat(m_object, 0x68, x_vel)
- writefloat(m_object, 0x6C, y_vel)
- end
- end
- end
- end
- return 1
- end
- GetLines = function(filename)
- local file = io.open(filename, "r")
- if file then
- local Lines = {}
- for line in file:lines() do
- table.insert(Lines, line)
- end
- file:close()
- return Lines
- end
- end
- FollowTimer = function(id, count, player, player2)
- if getplayer(player) and getobject(getplayerobjectid(player)) then
- if getplayer(player2) and getobject(getplayerobjectid(player2)) then
- local m_objectId = getplayerobjectid(player)
- local m_playerObjId = getplayerobjectid(player2)
- local m_object = getobject(m_playerObjId)
- local m_Object = getobject(m_objectId)
- if x == nil then
- x,y,z = getobjectcoords(m_playerObjId)
- movobjcoords(m_objectId, x, y, z+0.5)
- end
- local obj_x_vel = readfloat(m_object, 0x68)
- local obj_y_vel = readfloat(m_object, 0x6C)
- local obj_z_vel = readfloat(m_object, 0x70)
- writefloat(m_Object, 0x68, obj_x_vel)
- writefloat(m_Object, 0x6C, obj_y_vel)
- writefloat(m_Object, 0x70, obj_z_vel)
- elseif getplayer(player2) then
- x,y,z = nil
- else
- local id = resolveplayer(player)
- follow[id] = nil
- return 0
- end
- end
- return 1
- end
- function OnTeamDecision(cur_team)
- return cur_team
- end
- Ipban = function(player)
- svcmd("sv_ban " .. resolveplayer(player))
- local file = io.open(profilepath .. "\\banned.txt", "r")
- if file then
- local Lines = {}
- for line in file:lines() do
- if line and line ~= "" then
- table.insert(Lines, line)
- end
- end
- svcmd("sv_unban " .. #Lines - 2)
- end
- end
- function OnPlayerJoin(player, team)
- messages[gethash(player)] = {}
- cur_players = cur_players + 1
- local sv_player = resolveplayer(player)
- local name = getname(player)
- local hash = gethash(player)
- local words = {}
- local id = resolveplayer(player)
- local ip = getip(player)
- ip_table[id] = ip
- for k,v in pairs(ip_banlist) do
- if ip_banlist[k] == tostring(ip) then
- Ipban(player)
- end
- end
- for k,v in pairs(name_bans) do
- if name_bans[k] == tostring(name) then
- Ipban(player)
- end
- end
- if ipadmins[ip] or admin_table[hash] then
- say("Server Admin: " .. name)
- end
- for k,v in pairs(boslog_table) do
- local count = gettokencount(v, ",")
- for i = 1,count do
- local word = gettoken(v, ",", i-1)
- table.insert(words, word)
- end
- local entry_name = words[1]
- local entry_hash = words[2]
- local entry_ip = words[3]
- if entry_hash == hash or entry_ip == ip then
- for i=0,15 do
- local player_hash = gethash(i)
- local player_ip = getip(i)
- if ipadmins[player_ip] or admin_table[player_hash] then
- privatesay(i, name .. " banned from BoS.")
- privatesay(i, "Entry: " .. entry_name .. "- " .. entry_hash)
- end
- end
- hprintf(name .. " banned from BoS.")
- hprintf("Entry: " .. entry_name .. "- " .. entry_hash .. "- " .. entry_ip)
- svcmd("sv_ban " .. sv_player)
- local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a")
- ip_banlist[name] = ip
- banlist:write(name .. "," .. tostring(ip_banlist[name]) .. "\n")
- banlist:close()
- table.remove(boslog_table, k)
- break
- end
- end
- local bool
- for k,v in pairs(unique_table) do
- if hash == v[1] or ip == v[2] then
- bool = true
- break
- end
- end
- if not bool then
- unique_table[name] = {hash, ip}
- uniques = uniques + 1
- say(name .. " is unique player #" .. tostring(uniques) .. " on this server!")
- end
- end
- function OnPlayerLeave(player, team)
- cur_players = cur_players - 1
- cleanupdrones(player)
- local id = resolveplayer(player)
- local name = getname(player)
- local hash = gethash(player)
- local ip = ip_table[id]
- bos_table[id] = name .. "," .. hash .. "," .. ip
- ip_table[id] = nil
- hidden[id] = nil
- afk[id] = {}
- end
- function OnPlayerKill(killer, victim, mode)
- if respset then
- local m_player = getplayer(victim)
- local player_respawn_time = readdword(m_player, 0x2C)
- writedword(m_player, 0x2c, resptime * 33)
- end
- cleanupdrones(victim)
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, m_objectId)
- local hash = gethash(player)
- if deathless then
- local m_player = getplayer(player)
- local m_playerObjId = readdword(m_player, 0x34)
- local m_object = getobject(m_playerObjId)
- writefloat(m_object, 0xE0, 9999999999)
- writefloat(m_object, 0xE4, 9999999999)
- end
- if noweapons or Noweapons[hash] then
- for i = 0,3 do
- local m_object = getobject(m_objectId)
- if m_object then
- local weapID = readdword(m_object, 0x2F8 + i*4)
- local weap = getobject(weapID)
- if weap then
- destroyobject(weapID)
- end
- end
- end
- end
- if colorspawn == nil then colorspawn = {} end
- if colorspawn[player] == nil then colorspawn[player] = {} end
- if colorspawn[player][1] then
- movobjcoords(m_objectId, colorspawn[player][1], colorspawn[player][2], colorspawn[player][3])
- colorspawn[player] = {}
- end
- if suspend_table[hash] then
- suspend_table[hash] = nil
- end
- if ghost_table[hash] then
- ghost_table[hash] = nil
- end
- end
- function OnPlayerSpawnEnd(player, m_objectId)
- end
- function OnTeamChange(relevant, player, team, dest_team)
- return 1
- end
- function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
- local Pass = 1
- local hash = gethash(player)
- if noweapons or Noweapons[hash] then
- if tagType == "weap" then
- Pass = 0
- end
- end
- return Pass
- end
- VelTimer = function(id, count, m_objectId)
- local m_object = getobject(m_objectId)
- if m_object then
- writefloat(m_object, 0x90, 20)
- return 1
- end
- return 0
- end
- function OnObjectCreation(m_objectId, player_owner, tag)
- if getplayer(player_owner) then
- for i = 25,41 do
- if objects[i][3] == tag then
- if mode[gethash(player_owner)] == "portalgun" then
- local m_object = getobject(m_objectId)
- registertimer(20, "portalgunTimer", player_owner, m_object)
- elseif mode[gethash(player_owner)] == "spawngun" then
- local m_object = getobject(m_objectId)
- registertimer(20, "spawngunTimer", player_owner, m_object)
- end
- end
- end
- end
- end
- function OnWeaponReload(player, weapon)
- if infammo then
- writeword(getobject(weapon), 0x2B6, 9999)
- writeword(getobject(weapon), 0x2B8, 9999)
- updateammo(weapon)
- return 0
- else
- return 1
- end
- end
- function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
- return 1
- end
- function OnVehicleEject(player, forceEject)
- local m_objectId = getplayerobjectid(player)
- local m_object = getobject(m_objectId)
- if m_object then
- local vehicleId = readdword(m_object, 0x11C)
- if vehicleId == 0xFFFFFFFF then return end
- cleanupdrone(player, m_objectId)
- end
- return 1
- end
- function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
- --if tagname:find("vehicle_hit_environment") == nil then say(tostring(tagname)) end
- if deathless or backtaps then
- writebyte(tagdata, 0x1C4, 0)
- end
- if deathless and tagname ~= "globals\\falling" and tagname ~= "globals\\distance" then
- writebyte(tagdata, 0x1D0, 0)
- writebyte(tagdata, 0x1D4, 0)
- writebyte(tagdata, 0x1D8, 0)
- end
- if deathless or not falldamage then
- local receiver = objecttoplayer(receiving_obj)
- if (tagname == "globals\\falling" or tagname == "globals\\distance") and receiver then
- writefloat(tagdata, 0x1D0, 0.0000001)
- writefloat(tagdata, 0x1D4, 0.0000001)
- writefloat(tagdata, 0x1D8, 0.0000001)
- end
- end
- if causing_obj ~= 0xFFFFFFFF then
- for i = 25,41 do
- local player = objecttoplayer(causing_obj)
- if getplayer(player) == nil then return end
- if mode[gethash(player)] == "destroy" then
- if tagname == objects[i][3] then
- destroyobject(receiving_obj)
- end
- elseif mode[gethash(player)] == "entergun" then
- if tagname == objects[i][3] and string.sub(getobjecttag(receiving_obj), 1, 8) == "vehicles" then
- entervehicle(player, receiving_obj, 0)
- end
- end
- end
- end
- end
- AccessMerging = function()
- for i = 1,#access_table do
- if string.find(access_table[i], ",sv_kick,") then
- access_table[i] = access_table[i] .. ",sv_k"
- end
- if string.find(access_table[i], ",sv_admin_add,") then
- access_table[i] = access_table[i] .. ",sv_a"
- end
- if string.find(access_table[i], ",sv_setafk,") then
- access_table[i] = access_table[i] .. ",sv_afk"
- end
- if string.find(access_table[i], ",sv_setammo,") then
- access_table[i] = access_table[i] .. ",sv_ammo"
- end
- if string.find(access_table[i], ",sv_ban,") then
- access_table[i] = access_table[i] .. ",sv_b"
- end
- if string.find(access_table[i], ",sv_setinvis,") then
- access_table[i] = access_table[i] .. ",sv_invis"
- end
- if string.find(access_table[i], ",sv_move,") then
- access_table[i] = access_table[i] .. ",sv_j"
- end
- if string.find(access_table[i], ",sv_scrim,") then
- access_table[i] = access_table[i] .. ",sv_lo3"
- end
- if string.find(access_table[i], ",sv_map,") then
- access_table[i] = access_table[i] .. ",sv_m"
- end
- if string.find(access_table[i], ",sv_mapcycle_begin,") then
- access_table[i] = access_table[i] .. ",sv_mc"
- end
- if string.find(access_table[i], ",sv_map_next,") then
- access_table[i] = access_table[i] .. ",sv_mnext"
- end
- if string.find(access_table[i], ",sv_players,") then
- access_table[i] = access_table[i] .. ",sv_pl"
- end
- if string.find(access_table[i], ",sv_map_reset,") then
- access_table[i] = access_table[i] .. ",sv_reset"
- end
- if string.find(access_table[i], ",sv_password,") then
- access_table[i] = access_table[i] .. ",sv_pass"
- end
- if string.find(access_table[i], ",sv_admin_del,") then
- access_table[i] = access_table[i] .. ",sv_revoke"
- end
- if string.find(access_table[i], ",sv_respawn_time,") then
- access_table[i] = access_table[i] .. ",sv_setresp"
- end
- if string.find(access_table[i], ",sv_teleport_add,") then
- access_table[i] = access_table[i] .. ",sv_st"
- end
- if string.find(access_table[i], ",sv_teleport,") then
- access_table[i] = access_table[i] .. ",sv_t"
- end
- if string.find(access_table[i], ",sv_changeteam,") then
- access_table[i] = access_table[i] .. ",sv_ts"
- end
- if string.find(access_table[i], ",sv_teleport_pl,") then
- access_table[i] = access_table[i] .. ",sv_tp"
- end
- if string.find(access_table[i], ",sv_admin_cur,") then
- access_table[i] = access_table[i] .. ",sv_viewadmins"
- end
- if not access_table or not access_table[i] or not access_table[i]:len() then hprintf("ACCESS.INI IS INCORRECTLY FORMATTED!") return end
- if string.sub(access_table[i], access_table[i]:len(), access_table[i]:len()) ~= "," then
- access_table[i] = access_table[i] .. ","
- end
- end
- end
- function getobjecttag(m_objectId)
- local m_object = getobject(m_objectId)
- local object_map_id = readdword(m_object, 0x0)
- local map_base = readdword(map_pointer, 0x0)
- local map_tag_count = todec(endian(map_base, 0xC, 0x3))
- local tag_table_base = map_base + 0x28
- local tag_table_size = 0x20
- for i = 0, (map_tag_count - 1) do
- local tag_id = todec(endian(tag_table_base, 0xC + (tag_table_size * i), 0x3))
- if tag_id == object_map_id then
- local tag_class = readstring(tag_table_base, (tag_table_size * i), 0x3, 1)
- local tag_name_address = endian(tag_table_base, 0x10 + (tag_table_size * i), 0x3)
- local tag_name = readtagname("0x" .. tag_name_address)
- return tag_name,tag_class
- end
- end
- end
- endian = function(address, offset, length)
- local data_table = {}
- local data = ""
- for i=0,length do
- local hex = string.format("%X", readbyte(address, offset + i))
- if tonumber(hex, 16) < 16 then
- hex = 0 .. hex
- end
- table.insert(data_table, hex)
- end
- for k,v in pairs(data_table) do
- data = v .. data
- end
- return data
- end
- todec = function(number)
- return tonumber(number, 16)
- end
- DefaultSvTimer = function(id, count, filename)
- local file = io.open(filename)
- if file then
- for line in file:lines() do
- svcmd(tostring(line))
- end
- file:close()
- if filename == "temp_" .. tostring(processid) .. ".tmp" then
- os.remove(filename)
- end
- elseif filename == "defaults.txt" then
- file = io.open("defaults.txt", "a")
- hprintf("Defaults.txt not found. File will be created...")
- file:write("sv_deathless 0\n")
- file:write("sv_infinite_ammo 0\n")
- file:write("sv_respawn_time default\n")
- file:write("sv_rtv_enabled true\n")
- file:write("sv_rtv_needed 0.6\n")
- file:write("sv_votekick_enabled true\n")
- file:write("sv_votekick_needed 0.7\n")
- file:write("sv_votekick_action kick\n")
- file:write("sv_version_check true\n")
- file:write("sv_version 1.09\n")
- file:write("sv_hash_check true\n")
- file:write("sv_falldamage 1")
- file:close()
- end
- return 0
- end
- getweapon = function(player, weapon)
- local tag_name_address
- local tag_name = ""
- local m_player = getplayer(player)
- local m_object = getobject(readdword(m_player, 0x34))
- local weap_id = getobject(readdword(m_object, 0x2F8 + ((weapon - 1) * 4)))
- local weap_meta_id = readdword(weap_id, 0x0)
- local map_base = readdword(map_pointer, 0x0)
- local map_tag_count = todec(endian(map_base, 0xC, 0x3))
- local tags_base = map_base + 0x28
- local tags_size = 0x20
- local tag_address = 0
- for i=0,(map_tag_count - 1) do
- local tag_id = todec(endian(tags_base, 0xC + (tags_size * i), 0x3))
- if tag_id == weap_meta_id then
- tag_name_address = endian(tags_base, 0x10 + (tags_size * i), 0x3)
- tag_name = readtagname("0x" .. tag_name_address)
- end
- end
- return tag_name
- end
- function OnWeaponAssignment(player, object, count, tag)
- return 0
- end
- cleanupdrones = function(player)
- -- pretty hacky way to remove the vehicles, but only way i could get working
- for k,v in pairs(vehicle_drone_table[player]) do
- local seats = getseats(v)
- if seats then
- for i = 0,seats - 1 do
- entervehicle(player, v, i)
- exitvehicle(player)
- end
- destroyobject(v)
- else
- for i = 0,5 do
- entervehicle(player, v, i)
- exitvehicle(player)
- end
- destroyobject(v)
- end
- vehicle_drone_table[player][k] = nil
- end
- end
- getseats = function(m_objectId)
- local seats
- local m_object = getobject(m_objectId)
- local tagname = getobjecttag(m_object)
- if tagname == "vehicles\\rwarthog\\rwarthog" or tagname == "vehicles\\warthog\\mp_warthog" then
- seats = 3
- elseif tagname == "vehicles\\scorpion\\scorpion_mp" then
- seats = 5
- else
- seats = 1
- end
- return seats
- end
- cleanupdrone = function(player, objid)
- for k,v in pairs(vehicle_drone_table[player]) do
- if v == objid then
- entervehicle(player, v, 0)
- exitvehicle(player)
- local seats = getseats(v)
- if seats then
- for i = 0,seats-1 do
- entervehicle(player, v, i)
- exitvehicle(player)
- end
- end
- --destroyobject(v) dont destroy, will destroy itself soon
- vehicle_drone_table[player][k] = nil
- break
- end
- end
- end
- MainTimer = function(id, count)
- if count % 10 == 0 then
- for i = 0,15 do
- local hash = gethash(i)
- if getplayer(i) then
- if ghost_table[hash] == true then
- applycamo(i, 1)
- elseif ghost_table[hash] and ghost_table[hash] > 0 then
- applycamo(i, ghost_table[hash])
- ghost_table[hash] = ghost_table[hash] - 1
- elseif ghost_table[hash] then
- if ghost_table[hash] <= 0 then
- ghost_table[hash] = nil
- end
- end
- end
- end
- end
- for i = 0,15 do
- local m_player = getplayer(i)
- if m_player then
- local m_playerObjId = getplayerobjectid(i)
- local m_object = getobject(m_playerObjId)
- if m_object then
- local id = resolveplayer(i)
- local x_aim = readfloat(m_object, 0x230)
- local y_aim = readfloat(m_object, 0x234)
- local z_aim = readfloat(m_object, 0x238)
- local z = readfloat(m_player, 0x100)
- if afk[id][1] == true then
- afk[id][1] = x_aim
- afk[id][2] = y_aim
- afk[id][3] = z_aim
- --[[local team = readbyte(m_player, 0x20)
- afk[id][4] = team
- writebyte(m_player, 0x20, 16)--]]
- writebit(m_object, 0x10, 7, 1)
- elseif afk[id][1] then
- if x_aim ~= afk[id][1] or y_aim ~= afk[id][2] or z_aim ~= afk[id][3] then
- writebit(m_object, 0x10, 7, 0)
- if afk[id][4] then
- writebyte(m_player, 0x20, afk[id][4])
- afk[id][4] = nil
- end
- afk[id] = {}
- say(getname(i) .. " is no longer afk!")
- else
- writefloat(m_player, 0x100, z - 1000)
- end
- elseif hidden[id] then
- writefloat(m_player, 0x100, z - 1000)
- end
- end
- end
- end
- return 1
- end
- SpamTimer = function(id, count)
- for i=0,15 do
- local hash = gethash(i)
- if hash then
- local name = getname(i)
- if spam_table[hash] == nil then
- spam_table[hash] = 0
- end
- if spam_table[hash] < spam_max then
- if spam_table[hash] > 0 then
- spam_table[hash] = spam_table[hash] - 0.25
- end
- else
- say(name .. " has been muted for " .. spam_timeout .. " seconds for spamming!")
- spam_table[hash] = -1
- end
- if spam_table[hash] == -1 then
- if spamtimeout_table[hash] == nil then
- spamtimeout_table[hash] = spam_timeout
- else
- spamtimeout_table[hash] = spamtimeout_table[hash] - 1
- end
- if spamtimeout_table[hash] == 0 then
- say(name .. " has been unmuted!")
- spamtimeout_table[hash] = nil
- spam_table[hash] = 0
- end
- end
- end
- end
- return 1
- end
- rtvTimer = function(id, count)
- if count == 1 then
- rtv_initiated = rtv_timeout
- rtv_table = {}
- say("The current rtv has expired!")
- return 0
- else
- return 1
- end
- end
- votekickTimer = function(id, count, userdata)
- if count == 1 then
- local name = getname(userdata)
- votekick_allowed = true
- say("The votekick on " .. name .. " has expired!")
- for k,v in pairs(votekick_table) do
- votekick_table[k] = nil
- end
- return 0
- else
- return 1
- end
- end
- lo3Timer = function(id, count)
- if count >= 3 then
- say("Start your match!")
- svcmd("sv_map_reset")
- return 0
- else
- svcmd("sv_map_reset")
- return 1
- end
- end
- readtagname = function(address)
- local char_table = {}
- local i = 0
- local string = ""
- while readbyte(address, i) ~= 0 do
- table.insert(char_table, string.char(readbyte(address, i)))
- i = i + 1
- end
- for k,v in pairs(char_table) do
- string = string .. v
- end
- return string
- end
- readstring = function(address, offset, length, endian)
- local char_table = {}
- local string = ""
- local offset = offset or 0x0
- if length == nil then
- if readbyte(address, offset + 1) == 0 and readbyte(address, offset) ~= 0 then
- length = 51000
- else
- length = 256
- end
- end
- for i=0,length do
- if readbyte(address, (offset + i)) ~= 0 then
- table.insert(char_table, string.char(readbyte(address, (offset + i))))
- elseif i % 2 == 0 and readbyte(address, offset + i) == 0 then
- break
- end
- end
- for k,v in pairs(char_table) do
- if endian == 1 then
- string = v .. string
- else
- string = string .. v
- end
- end
- return string
- end
- writestring = function(string, address, offset, spacing, endian)
- local char_table = {}
- offset = offset or 0x0
- address = address + offset
- spacing = spacing or 0x1
- for word in string:gmatch(".") do
- table.insert(char_table, string.byte(word))
- end
- local length = table.getn(char_table)
- if endian == 1 then
- for i=0,length do
- writebyte(address, spacing * i, char_table[length - i])
- end
- else
- for i=0,length do
- writebyte(address, spacing * i, char_table[i + 1])
- end
- end
- end
- nadeTimer = function(id, count)
- for c = 0,15 do
- if getplayer(c) then
- local m_object = getobject(getplayerobjectid(c))
- if m_object then
- writebyte(m_object, 0x31E, 3) -- set frags to 3
- writebyte(m_object, 0x31F, 3) -- set plasmas to 3
- end
- end
- end
- if infammo then
- return 1
- elseif infammo then
- return 0
- end
- end
- settimelimit = function(value)
- if tonumber(value) then
- writedword(timelimit_address, 0x0, tonumber(value))
- local time_passed = readdword(readdword(gametime_base, 0x0), 0xC)
- 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)
- end
- end
- --[[getname = function(player)
- player = tonumber(player)
- local m_player = getplayer(player)
- if m_player then
- local player_name = readstring(m_player, 0x4, 11)
- local player_name2 = readstring(m_player, 0x48, 11)
- local player_name3 = tostring(readstring(name_base, 0x20 * player, 0x14))
- return player_name3
- end
- end
- resolveplayer = function(player)
- player = tonumber(player)
- local m_player = getplayer(player)
- if m_player then
- local player_rcon_id = readbyte(m_player, 0x64) + 1
- if player_rcon_id > 0 and player_rcon_id < 17 then
- return player_rcon_id
- end
- end
- end
- readbit = function(address, offset, bit)
- local value = readbyte(address, offset)
- local binary_val = tobinary(value)
- local ret_bit = string.sub(binary_val, bit)
- return tonumber(ret_bit, 2)
- end
- writebit = function(address, offset, bit, value)
- local val = readbyte(address, offset)
- local binary_val = tobinary(val)
- if bit == 7 then
- byte = string.sub(binary_val, 1, 7) .. value
- elseif bit == 0 then
- byte = value .. string.sub(binary_val, 2, 8)
- else
- byte = string.sub(binary_val, 1, bit) .. value .. string.sub(binary_val, bit+1, 8)
- end
- byte = tonumber(byte, 2)
- writebyte(address, offset, byte)
- end
- tobinary = function(number)
- number = tonumber(number)
- if number == nil then return end
- binary = ""
- while (number > 0) do
- binary = binary .. math.floor(number % 2)
- number = number / 2
- end
- return binary
- end
- tofloat = function(number)
- local sign = 1
- if number == nil then return end
- local mantissa = string.byte(number, 3) % 128
- for i = 2, 1, -1 do
- mantissa = mantissa * 256 + string.byte(number, i)
- end
- if string.byte(number, 4) > 127 then
- sign = -1
- end
- local exponent = (string.byte(number, 4) % 128) * 2 + math.floor(string.byte(number, 3) / 128)
- if exponent == 0 then return 0 end
- mantissa = (mantissa * (2 ^ -23) + 1) * sign
- return mantissa * 2^(exponent - 127)
- end
- readfloat = function(address, offset)
- if address then
- local a = readbyte(address, 0x0 + offset)
- local b = readbyte(address, 0x1 + offset)
- local c = readbyte(address, 0x2 + offset)
- local d = readbyte(address, 0x3 + offset)
- local val = string.char(a, b, c, d)
- local float = tofloat(val)
- return float
- end
- end
- readdword = function(address, offset)
- if address then
- local a = readbyte(offset + address, 0x3)
- local b = readbyte(offset + address, 0x2)
- local c = readbyte(offset + address, 0x1)
- local d = readbyte(offset + address, 0x0)
- local dword = string.format("%02X%02X%02X%02X", a, b, c, d)
- dword = tonumber(dword, 16)
- return dword
- end
- end
- readword = function(address, offset)
- local a = readbyte(offset + address, 0x1)
- local b = readbyte(offset + address, 0x0)
- local word = string.format("%02X%02X", a, b)
- word = tonumber(word, 16)
- return word
- end
- rresolveplayer = function(player)
- player = tonumber(player)
- for i = 0,15 do
- local m_player = getplayer(i)
- if m_player then
- local player_rcon_id = readbyte(m_player, 0x64) + 1
- if player_rcon_id == player then
- return i
- end
- end
- end
- end--]]
- Gethash = function(player)
- local player_table = readdword(0x69B91C, 0x0)
- local hashbase_offset = 0x3C4
- local hashbase = readdword(player_table, hashbase_offset)
- local bool = false
- for i = 1,16 do
- local temp = readword(hashbase, 0x0)
- if temp ~= resolveplayer(player) - 1 then
- hashbase = hashbase + 0x60
- else
- bool = true
- end
- if bool == true then
- hash_pointer = player_table + ((i*3) + 0x3BD)
- break
- end
- end
- if hash_pointer then
- local player_dword = player * 2 + player
- for i = 1,5 do
- player_dword = player_dword * 2
- end
- local ECX = player_table + player_dword + 0x3B8
- if ECX == 0 then return end
- local EDI = readdword(ECX, 0x0)
- if readdword(EDI+0xA98) ~= 1 then
- if EDI == 0 then
- hprintf("EDI IS 0")
- return
- end
- end
- hprintf("SUCCESS: " .. tostring(readdword(EDI+0xA98)))
- end
- return "BLAH"
- end
- getmachinestruct = function(player)
- local m_player = getplayer(player)
- if m_player then
- local machine_index = readbyte(m_player, 0x64)
- local machine_base = readdword(machine_pointer, 0x0)
- local table = machine_base + 0xAA0
- local machine_struct = readdword(table + machine_index*4, 0x0)
- return machine_struct
- end
- end
- getip = function(player)
- if ip_table[resolveplayer(player)] then return ip_table[resolveplayer(player)] end
- local m_player = getplayer(player)
- local IP_Address = ""
- if m_player then
- local machine_struct = getmachinestruct(player)
- local machine_network = readdword(readdword(machine_struct, 0x0), 0x0)
- local a = readbyte(machine_network, 0)
- local b = readbyte(machine_network, 1)
- local c = readbyte(machine_network, 2)
- local d = readbyte(machine_network, 3)
- if b then
- IP_Address = string.format("%i.%i.%i.%i", a, b, c, d)
- end
- end
- return IP_Address
- end
- Stickman = function(id, count)
- if count == 1 then
- hprintf(" _._ ")
- hprintf(" / O \\ ")
- hprintf(" \| |/ ")
- hprintf("O--+=-=+--O")
- elseif count == 2 then
- svcmd("cls")
- hprintf(" ,-O-, ")
- hprintf("O--=---=--O")
- hprintf(" 2-2 ")
- hprintf(" - - ")
- elseif count == 3 then
- svcmd("cls")
- hprintf(" ,_O_, ")
- hprintf("O--(---)--O")
- hprintf(" >'> ")
- hprintf(" - - ")
- elseif count == 4 then
- svcmd("cls")
- hprintf(" ._O_. ")
- hprintf("O--<-+->--O")
- hprintf(" X ")
- hprintf(" / \\ ")
- hprintf(" - - ")
- elseif count == 5 then
- svcmd("cls")
- hprintf("O--=-O-=--O")
- hprintf(" '-' ")
- hprintf(" v ")
- hprintf(" / ) ")
- hprintf(" ~ z ")
- elseif count == 6 then
- svcmd("cls")
- hprintf("O--,---,--O")
- hprintf(" \\ O / ")
- hprintf(" - - ")
- hprintf(" - ")
- hprintf(" / \ ")
- hprintf(" = = ")
- elseif count == 7 then
- svcmd("cls")
- hprintf("O--=-O-=--O")
- hprintf(" '-' ")
- hprintf(" v ")
- hprintf(" / ) ")
- hprintf(" ~ z ")
- elseif count == 8 then
- svcmd("cls")
- hprintf(" ._O_. ")
- hprintf("O--<-+->--O")
- hprintf(" X ")
- hprintf(" / \\ ")
- hprintf(" - - ")
- elseif count == 9 then
- svcmd("cls")
- hprintf(" ,_O_, ")
- hprintf("O--(---)--O")
- hprintf(" >'> ")
- hprintf(" - - ")
- elseif count == 10 then
- svcmd("cls")
- hprintf(" ,-O-, ")
- hprintf("O--=---=--O")
- hprintf(" 2-2 ")
- hprintf(" - - ")
- elseif count == 11 then
- svcmd("cls")
- hprintf(" _._ ")
- hprintf(" / O \\ ")
- hprintf(" \\| |/ ")
- hprintf("O--+=-=+--O")
- elseif count >= 12 then
- svcmd("cls")
- return 0
- end
- return 1
- end
- resetweapons = function(player)
- local m_player = getplayer(player)
- local m_object = getobject(readdword(m_player, 0x34))
- if m_object then
- if getobject(readdword(m_object, 0x118)) then return end
- local x = readfloat(m_object, 0x5C)
- local y = readfloat(m_object, 0x60)
- local z = readfloat(m_object, 0x64)
- objId = createobject("weap", "weapons\\pistol\\pistol", 0, 60, false, x+1.0, y, z + 2.0)
- assignweapon(player, objId)
- objId = createobject("weap", "weapons\\assault rifle\\assault rifle", 0, 60, false, x+1.0, y, z + 2.0)
- assignweapon(player, objId)
- end
- end
- portalgunTimer = function(id, count, player_owner, m_object)
- if count == 500 then
- return 0
- end
- local m_player = getplayer(player_owner)
- if m_player and m_object then
- local obj_x_velocity = readfloat(m_object, 0x68)
- local m_playerObjId = readdword(m_player, 0x34)
- if obj_x_velocity == 0 then
- local x = readfloat(m_object, 0x5C)
- local y = readfloat(m_object, 0x60)
- local z = readfloat(m_object, 0x64)
- movobjcoords(m_playerObjId, x, y, z)
- return 0
- else
- return 1
- end
- end
- return 1
- end
- spawngunTimer = function(id, count, player_owner, m_object)
- local m_player = getplayer(player_owner)
- if m_player and m_object then
- local x = readfloat(m_object, 0x5C)
- local y = readfloat(m_object, 0x60)
- local z = readfloat(m_object, 0x64)
- createobject(objspawntype[gethash(player_owner)], objspawntag[gethash(player_owner)], 0, 60, false, x, y, z)
- end
- return 0
- end
- getvalidplayers = function(expression, player)
- if cur_players ~= 0 then
- local players = {}
- if expression == "*" then
- for i = 0,15 do
- if getplayer(i) then
- table.insert(players, i)
- end
- end
- elseif expression == "me" then
- if player ~= 0xFFFFFFFF and player ~= -1 and player then
- table.insert(players, player)
- end
- elseif string.sub(expression, 1, 3) == "red" then
- for i = 0,15 do
- if getplayer(i) then
- local player_team = readdword(getplayer(i), 0x20)
- if player_team == 0 then
- table.insert(players, i)
- end
- end
- end
- elseif string.sub(expression, 1, 4) == "blue" then
- for i = 0,15 do
- if getplayer(i) then
- local player_team = readdword(getplayer(i), 0x20)
- if player_team == 1 then
- table.insert(players, i)
- end
- end
- end
- 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
- if tonumber(expression) then
- local expression = tonumber(expression)
- if rresolveplayer(expression) then
- table.insert(players, rresolveplayer(expression))
- end
- end
- elseif expression == "random" then
- if cur_players == 1 and player ~= 0xFFFFFFFF then table.insert(players, player) return players end
- local bool = false
- while not bool do
- num = math.random(0, 15)
- if getplayer(num) and num ~= player then
- bool = true
- end
- end
- table.insert(players, num)
- else
- for i = 0,15 do
- if getplayer(i) then
- if string.wild(getname(i), expression) == true then
- table.insert(players, i)
- end
- end
- end
- end
- if players[1] then
- return players
- end
- end
- return false
- end
- function pack(...)
- return arg
- end
- function string.wild(match, wild, case_sensative)
- if not case_sensative then
- match, wild = string.lower(match), string.lower(wild)
- end
- -- Initial Checks
- if string.sub(wild, 1, 1) == "?" then wild = string.gsub(wild, "?", string.sub(match, 1, 1), 1) end
- 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
- if not string.find(wild, "*") and not string.find(wild, "?") and wild ~= match then return false end
- if string.sub(wild, 1, 1) ~= string.sub(match, 1, 1) and string.sub(wild, 1, 1) ~= "*" then return false end
- 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
- local substrings = string.split(wild, "*")
- local begin = 1
- for k,v in ipairs(substrings) do
- local sublength = string.len(v)
- local temp_begin = begin
- local temp_end = begin + sublength - 1
- local matchsub = string.sub(match, begin, temp_end)
- local bool
- repeat
- local wild = v
- local indexes = pack(string.findchar(wild, "?"))
- if #indexes > 0 then
- for _,i in ipairs(indexes) do
- wild = string.gsub(wild, "?", string.sub(matchsub, i, i), 1)
- end
- end
- if matchsub == wild then
- bool = true
- break
- end
- matchsub = string.sub(match, temp_begin, temp_end)
- temp_begin = temp_begin + 1
- temp_end = temp_end + 1
- until temp_end >= string.len(match)
- if not bool then
- return false
- end
- begin = sublength + 1
- end
- return true
- end
- function string.findchar(str, char)
- local chars = string.split(str, "")
- local indexes = {}
- for k,v in ipairs(chars) do
- if v == char then
- table.insert(indexes, k)
- end
- end
- return unpack(indexes)
- end
- delayMsg = function(id, count, msg, command, player)
- command = tostring(command)
- if string.sub(command, 1, 1) == "/" then
- say(msg)
- elseif string.sub(command, 1, 1) == "\\" then
- privatesay(player, msg)
- elseif player ~= 0xFFFFFFFF and player ~= -1 then
- hprintf(msg, player)
- else
- hprintf(msg)
- end
- return 0
- end
- sendresponse = function(message, command, player, log)
- if message == "" then
- return
- end
- player = tonumber(player)
- if string.sub(command, 1, 1) == "/" then
- registertimer(0, "delayMsg", message, command, player)
- elseif string.sub(command, 1, 1) == "\\" then
- registertimer(0, "delayMsg", message, command, player)
- elseif tonumber(player) and player ~= 0xFFFFFFFF and player ~= -1 and player >= 0 and player < 16 then
- hprintf(message, player)
- else
- hprintf(message)
- end
- if not log and player ~= 0xFFFFFFFF and player ~= -1 and player then
- WriteLog(profilepath .. "\\logs\\commands.log", "Response to " .. getname(player) .. ": " .. message)
- end
- end
- messages = {}
- function hprint(player, message, time)
- time = time or 5
- local hash = gethash(player)
- if hash then
- if string.len(message) > 75 then
- message = wordwrap(message, 75, true)
- end
- table.insert(messages[hash], {["message"] = message, ["time"] = time})
- end
- end
- function setscorelimit(player, score)
- if tonumber(score) then
- if gametype == 1 then -- CTF
- if score >= 255 then
- writedword(gametype_base, 0x58, 255)
- elseif score < 1 then
- writewordsigned(gametype_base, 0x58, 1)
- else
- writewordsigned(gametype_base, 0x58, score)
- end
- elseif gametype == 2 then -- Slayer
- if score >= 0x7FFFFFFF then
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, 0x7FFFFFFF)
- elseif score <= -0x7FFFFFFF then
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, -0x7FFFFFFF)
- else
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, score)
- end
- elseif gametype == 3 then -- Oddball
- local oddball_game = readbyte(gametype_base, 0x8C)
- if oddball_game == 0 or oddball_game == 1 then
- if score * 30 >= 0x7FFFFFFF then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFFFF)
- elseif score * 30 <= -0x7FFFFFFF then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -1 * 0x7FFFFFFF)
- else
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score * 30)
- end
- else
- if score > 0x7FFFFC17 then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFC17)
- elseif score <= -0x7FFFFC17 then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -0x7FFFFC17)
- else
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score)
- end
- end
- elseif gametype == 4 then -- KOTH
- local m_player = getplayer(player)
- if score * 30 >= 0x7FFF then
- writewordsigned(m_player, 0xC4, 0x7FFF)
- elseif score * 30 <= -0x7FFF then
- writewordsigned(m_player, 0xC4, -0x7FFF)
- else
- writewordsigned(m_player, 0xC4, score * 30)
- end
- elseif gametype == 5 then -- Race
- local m_player = getplayer(player)
- if score >= 0x7FFF then
- writewordsigned(m_player + 0xC6, 0x0, 0x7FFF)
- elseif score <= -0x7FFF then
- writewordsigned(m_player + 0xC6, 0x0, -0x7FFF)
- else
- writewordsigned(m_player + 0xC6, 0x0, score)
- end
- end
- end
- end
- function setscore(player, score)
- if tonumber(score) then
- if gametype == 1 then -- CTF
- local m_player = getplayer(player)
- if score >= 0x7FFF then
- writewordsigned(m_player+0xC8, 0x0, 0x7FFF)
- elseif score <= -0x7FFF then
- writewordsigned(m_player+0xC8, 0x0, -0x7FFF)
- else
- writewordsigned(m_player+0xC8, 0x0, score)
- end
- elseif gametype == 2 then -- Slayer
- if score >= 0x7FFFFFFF then
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, 0x7FFFFFFF)
- elseif score <= -0x7FFFFFFF then
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, -0x7FFFFFFF)
- else
- writedwordsigned(slayer_globals + 0x40 + player*4, 0x0, score)
- end
- elseif gametype == 3 then -- Oddball
- local oddball_game = readbyte(gametype_base, 0x8C)
- if oddball_game == 0 or oddball_game == 1 then
- if score * 30 >= 0x7FFFFFFF then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFFFF)
- elseif score * 30 <= -0x7FFFFFFF then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -1 * 0x7FFFFFFF)
- else
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score * 30)
- end
- else
- if score > 0x7FFFFC17 then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, 0x7FFFFC17)
- elseif score <= -0x7FFFFC17 then
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, -0x7FFFFC17)
- else
- writedwordsigned(oddball_globals + 0x84 + player*4, 0x0, score)
- end
- end
- elseif gametype == 4 then -- KOTH
- local m_player = getplayer(player)
- if score * 30 >= 0x7FFF then
- writewordsigned(m_player, 0xC4, 0x7FFF)
- elseif score * 30 <= -0x7FFF then
- writewordsigned(m_player, 0xC4, -0x7FFF)
- else
- writewordsigned(m_player, 0xC4, score * 30)
- end
- elseif gametype == 5 then -- Race
- local m_player = getplayer(player)
- if score >= 0x7FFF then
- writewordsigned(m_player + 0xC6, 0x0, 0x7FFF)
- elseif score <= -0x7FFF then
- writewordsigned(m_player + 0xC6, 0x0, -0x7FFF)
- else
- writewordsigned(m_player + 0xC6, 0x0, score)
- end
- end
- end
- end
- function writewordsigned(address, offset, word)
- value = tonumber(word)
- if value == nil then value = tonumber(word, 16) end
- if value and value > 0x7FFF then
- local max = 0xFFFF
- local difference = max - value
- value = -1 - difference
- end
- writeword(address, offset, value)
- end
- function writedwordsigned(address, offset, dword)
- value = tonumber(dword)
- if value == nil then value = tonumber(dword, 16) end
- if value and value > 0x7FFFFFFF then
- local max = 0xFFFFFFFF
- local difference = max - value
- value = -1 - difference
- end
- writedword(address, offset, value)
- end
- function HprintTimer(id, count)
- if messages ~= {} then
- for k,v in pairs(messages) do
- if messages[k] ~= {} then
- for key,value in ipairs(messages[k]) do
- messages[k][key].time = messages[k][key].time - 0.334
- if messages[k][key].time < 0 then
- table.remove(messages[k], key)
- end
- end
- end
- end
- for k,v in pairs(messages) do
- if #messages[k] > 0 then
- local player = hashtoplayer(k)
- for i = 1, 30 do
- hprintf(" ", player)
- end
- for key,value in ipairs(messages[k]) do
- hprintf(messages[k][key].message, player)
- end
- end
- end
- end
- return 1
- end
- function wordwrap(str, linelength, tabbed)
- local newstr = ""
- local count = 0
- local space_index = 0
- local begin = 1
- for i = 1, string.len(str) do
- local sub = string.sub(str, i, i)
- if sub == " " then
- space_index = i
- end
- count = count + 1
- if count == linelength then
- newstr = newstr .. string.sub(str, begin, space_index) .. "\n"
- begin = space_index + 1
- count = 0
- if tabbed then
- repeat
- newstr = newstr .. " "
- count = count + 1
- until count == math.floor(1 + linelength / 10)
- end
- end
- if i == string.len(str) then
- newstr = newstr .. string.sub(str, begin, string.len(str))
- break
- end
- end
- return newstr
- end
- -- String functions
- function string.split(str, ...)
- local subs = {}
- local sub = ""
- local i = 1
- for _,v in ipairs(arg) do
- if v == "" then
- for x = 1, string.len(str) do
- table.insert(subs, string.sub(str, x, x))
- end
- return subs
- end
- end
- for _,v in ipairs(arg) do
- if string.sub(str, 1, 1) == v then
- table.insert(subs, "")
- break
- end
- end
- while i <= string.len(str) do
- local bool, bool2
- for x = 1, #arg do
- if arg[x] ~= "" then
- local length = string.len(arg[x])
- if string.sub(str, i, i + (length - 1)) == arg[x] then
- if i == string.len(str) then
- bool2 = true
- else
- bool = true
- end
- i = i + (length - 1)
- break
- end
- else
- for q = 1, string.len(str) do
- subs = {}
- table.insert(subs, string.sub(str, q, q))
- i = string.len(str)
- break
- end
- end
- end
- if not bool then
- sub = sub .. string.sub(str, i, i)
- end
- if bool or i == string.len(str) then
- if sub ~= "" then
- table.insert(subs, sub)
- sub = ""
- end
- end
- if bool2 then
- table.insert(subs, "")
- end
- i = i + 1
- end
- for k,v in ipairs(subs) do
- for _,d in ipairs(arg) do
- subs[k] = string.gsub(v, d, "")
- end
- end
- return subs
- end
- -- Misc
- function hashtoplayer(hash)
- for i = 0, 15 do
- if gethash(i) == hash then return i end
- end
- end
- WriteChangeLog = function()
- local file = io.open("changelog.txt", "w")
- file:write("Changelog for Commands Script\n")
- file:write("\n")
- file:write("1.0\n")
- file:write("First Official Release (january or something)\n")
- file:write("-----------------------------------------------------------------------------------------------------------------\n")
- file:write("April 22, 2012\n")
- file:write("Commands Version 2.0\n")
- 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")
- file:write("--Fixed /setname, it will change your name, but for others to see it it requires a rejoin.\n")
- file:write("--Added /os, this will give you an Overshield (syntax is /os [player])\n")
- file:write("--Fixed the admin system, before you had to do sv_reloadscripts after you added someone, that's been fixed.\n")
- 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")
- file:write("--Added a command to view all admins on the server, syntax is: /a list\n")
- file:write("--Added a command to view the current admins in the server. Syntax is: /viewadmins\n")
- file:write("--Added a command to view the server specs (processor speed, model name, manufacturer). Syntax is /specs, or sv_specs in console\n")
- 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")
- file:write("--Now includes logging. This will log directly to commands.log in the log folder\n")
- 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")
- file:write("--If you do not have an access file, this script will make one for you.\n")
- file:write("--Added version changing. You can change to any version of Halo. Syntax is: /version {version} or sv_version {version} in console.\n")
- 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")
- file:write("--Added a defaults.txt. This text file gets called on server startup.\n")
- 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")
- 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")
- file:write("--Now includes output messages with the '/e' command.\n")
- file:write("--Fixed smiley's BOS commands, thanks to bvigil for telling me what it was supposed to do.\n")
- file:write("--Added a sv_commands and a /commands. This will show all the commands that exist for this script.\n")
- 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")
- file:write("--Fixed a bug with /tp and sv_teleport_pl, which were crashing when the other player was dead.\n")
- 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")
- file:write("--Fixed /setplasmas, thank you sanity for the notice...\n")
- file:write("--Added a parameter to '/spd'. Syntax is /spd [player] {speed}. Doing /spd [player] will show you their current speed.\n")
- file:write("--Fixed a reported bug with /noweapons... I was never able to reproduce it, so I must have indirectly fixed it.\n")
- file:write("--Fixed /info which would crash when you used a player expression that was not a number.\n")
- file:write("--Added another parameter to '/t'. Syntax is '/t list', this will show you the list of teleports for the map.\n")
- file:write("--Fixed a couple of bugs with rtv and votekick (whoops)\n")
- file:write("--Added infinite nades to sv_infinite_ammo\n")
- file:write("--Fixed a bug with 'sv_mute' and '/mute'. You can no longer mute admins.\n")
- file:write("--Added a '/banlist' command to chat. This will show you the banlist.\n")
- 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")
- file:write("--Added sv_rtv_needed [decimal 0 to 1]\n")
- file:write("--Added sv_votekick_needed [decimal 0 to 1]\n")
- file:write("--Added sv_rtv_enabled [true or false, 1 or 0]\n")
- file:write("--Added sv_votekick_enabled [true or false, 1 or 0]\n")
- file:write("--Fixed /st. This will set a teleport location to wherever you are standing. Syntax is: /st [teleport name]\n")
- file:write("--Fixed the spawngun. Syntax is /setmode (player) spawngun (object)\n")
- file:write("--sv_afk was changed to 'sv_setafk'. Thought it was a better name for the command.\n")
- file:write("--Added ipbanning. Syntax is sv_ipban, sv_ipbanlist, sv_ipunban, and for chat: /ipban, /ipbanlist, /ipunban.\n")
- 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")
- file:write("--Added 'sv_launch' and '/launch'. Syntax is 'sv_launch [player]' or '/launch [player]'\n")
- file:write("--Added a control command. Syntax is 'sv_control [victim] [controller]' or '/c [victim] [controller]' in chat.\n")
- file:write("--Added a privatesay command. Syntax is 'sv_privatesay [player] [message]' or '/privatesay [player] [message]' in chat\n")
- 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")
- 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")
- 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")
- file:write("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("Commands Version 2.001\n")
- file:write("--Fixed /ipadminadd (whoops)\n")
- file:write("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("Commands Version 2.2 (Released on June 1 2012)\n")
- file:write("--Added /balance, it executes sv_teams_balance in console\n")
- file:write("--Made it so that the sv_map and /m loads the commands script by default\n")
- file:write("--Added unique player tracking. It will keep track of the number of unique players who joined the server\n")
- file:write("--Get the number of unique players by doing /count\n")
- file:write("--Fixed /privatesay. It would only let you message one word before\n")
- file:write("--Added sv_privatesay. Looks like i forgot the sv_command for that\n")
- file:write("--Added private chat. Use @(player expression) to message someone\n")
- file:write("--Added /setcolor. Only works in FFA gametypes.\n")
- file:write("--Added namebanning to superban.\n")
- file:write("--Added a \\nameban command.\n")
- file:write("--Modified the showadminlist function to be a lot more useful\n")
- file:write("--Added ipadmin deleting (sorry lol)\n")
- file:write("--Bunch of bug fixes... i can't remember what else i did.\n")
- file:write("--Oh yea, I fixed votekick.\n")
- 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")
- file:write("--Fixed access levels for the script. It kind of worked, but not really.\n")
- file:write("--Somehow you could die when deathless mode was enabled... i fixed that...\n")
- file:write("--Fixed an issue with /timelimit and sv_time_cur\n")
- file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("Commands Version 2.201 (released on June 5th 2012)\n")
- file:write("This is mainly just a bug fix version\n")
- file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("--Fixed /commands to show all of the commands.\n")
- file:write("--Fixed a weird problem with the /enter command (when you ejected it would crash your game)\n")
- 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")
- file:write("--Fixed falldamage (and also made it so longer falls don't kill you)\n")
- 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")
- 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")
- file:write("--Added a /setscore and sv_setscore command.\n")
- file:write("--New functionality to /hax and /unhax\n")
- file:write("--Modified setkills, setassists, and setdeaths to work a little cleaner\n")
- file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("Commands Version 2.3 (released June 13th 2012\n")
- file:write("Mainly fixed up the admin system\n")
- file:write("--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
- file:write("--Fixed ipadmins. They can now use the rcon.\n")
- 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")
- file:write("--Added a /scorelimit and a sv_scorelimit command\n")
- file:write("--Modified the showadminlist command. Shows a lot more now.\n")
- 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")
- file:write("turned into admins.txt, don't worry, it's supposed to do that.\n")
- file:write("--Added a /a del command.\n")
- file:write("--Added sv_ipadminadd to the rcon\n")
- file:write("--This script enables CE devmode commands (cheat_deathless_player, cheat_medusa, etc)\n")
- file:write("--Added a patch that will allow new gametypes to be added without restarting the server\n")
- file:write("--Fixed a very small problem with the setcolor command.\n")
- file:write("--Fixed up the timelimit command :)\n")
- file:write("--IP admins no longer get removed when you unload the commands script\n")
- file:write("--Fixed the ipban command (whoops)\n")
- file:write("--Added textbanning. It's like the mute command except it's a permanent\n")
- file:write("--Fixed rcon commands so that the responses show up with the /e command\n")
- file:write("--I probably did more but I forgot lol\n")
- file:close()
- end
- round = function(val, decimal)
- if (decimal) then
- return math.floor((val * 10^decimal) + 0.5) / (10^decimal)
- else
- return math.floor(val+0.5)
- end
- end
- Command_AFK = function(executor, command, player, count)
- if count == 1 then
- if executor ~= 0xFFFFFFFF then
- local m_player = getplayer(executor)
- --old afk code
- --[[local player_respawn_time = readdword(m_player, 0x2c)
- if player_respawn_time >= 20 then
- writedword(m_player, 0x2c, 1 * 33)
- sendresponse(getname(executor) .. " is no longer afk!", command, executor)
- else
- kill(executor)
- writedword(m_player, 0x2c, 9999 * 33)
- sendresponse(getname(executor) .. " is now afk!", command, executor)
- end--]]
- local id = resolveplayer(executor)
- afk[id][1] = true
- sendresponse(getname(executor) .. " is now afk!", command, executor)
- else
- sendresponse("Invalid Player!", command, executor)
- end
- elseif count == 2 then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- --[[local m_player = getplayer(players[i])
- local player_respawn_time = readdword(m_player, 0x2c)
- if player_respawn_time >= 20 then
- writedword(m_player, 0x2c, 1 * 33)
- sendresponse(getname(players[i]) .. " is no longer afk!", command, executor)
- else
- kill(players[i])
- writedword(m_player, 0x2c, 9999 * 33)
- sendresponse(getname(players[i]) .. " is now afk!", command, executor)
- end--]]
- local id = resolveplayer(players[i])
- afk[id][1] = true
- sendresponse(getname(players[i]) .. " is now afk!", command, executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " {player}", command, executor)
- end
- end
- function Command_Adminadd(executor, command, player, nickname, level, count)
- if count == 4 and tonumber(level) then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- if not admin_table[gethash(players[i])] then
- admin_table[gethash(players[i])] = {}
- admin_table[gethash(players[i])].level = level
- admin_table[gethash(players[i])].name = nickname
- sendresponse(getname(players[i]) .. " is now an admin!", command, executor)
- else
- sendresponse(getname(players[i]) .. " is already an admin!", command, executor)
- end
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player] [nickname] [level]", command, executor)
- end
- end
- function Command_Ipadminadd(executor, command, player, nickname, level, count)
- if count == 4 then
- local players = getvalidplayers(player, executor)
- if players then
- if not players[2] then
- local ip = getip(players[1])
- if ipadmins[ip] then
- sendresponse(getname(tostring(players[1])) .. " is already an IP admin!", command, executor)
- elseif not nickname:find(",") then
- ipadmins[ip] = ipadmins[ip] or {}
- ipadmins[ip].name = nickname
- ipadmins[ip].level = level
- sendresponse(getname(tostring(players[1])) .. " is now an IP admin!", tostring(command), tostring(executor))
- registertimer(0, "reloadadmins")
- else
- sendresponse("Nicknames must contain no commas.", command, executor)
- end
- else
- sendresponse("You cannot add more than one admin with the same nickname!", command, executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player] [nickname] [level]", command, executor)
- end
- end
- function Command_Ipadmindel(executor, command, ID, count)
- if count == 2 then
- local file = io.open(profilepath .. "\\ipadmins.txt")
- if file then
- ID = tonumber(ID) or 0
- local admins = {}
- local x = 1
- for k,v in pairs(admin_table) do
- local name = admin_table[k].name
- local level = admin_table[k].level
- admins[name] = {k, "garbage", level}
- end
- for k,v in pairs(ipadmins) do
- local name = ipadmins[k].name
- local level = ipadmins[k].level
- if admins[name] and admins[name] ~= {} then
- admins[name][2] = k
- else
- admins[name] = {"garbage", k, level}
- end
- end
- local bool
- for k,v in pairs(admins) do
- if x == ID then
- if admins[k][2] ~= "garbage" then
- sendresponse(tostring(ipadmins[admins[k][2]].name) .. " is no longer an IP admin!", command, executor)
- ipadmins[admins[k][2]] = nil
- else
- sendresponse(tostring(k) .. " is not an IP admin.", command, executor)
- end
- bool = true
- break
- else
- x = x + 1
- end
- end
- file:close()
- if not bool then
- sendresponse("There are no admins with an ID of " .. ID, command, executor)
- end
- else
- sendresponse("There are no IP admins on this server.", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
- end
- end
- function Command_Admindel(executor, command, ID, count)
- if (count == 2 and command == "sv_admin_del") or count == 3 then
- local file = io.open(profilepath .. "\\admins.txt")
- if file then
- ID = tonumber(ID) or 0
- local admins = {}
- local x = 1
- for k,v in pairs(admin_table) do
- local name = admin_table[k].name
- local level = admin_table[k].level
- admins[name] = {k, "garbage", level}
- end
- for k,v in pairs(ipadmins) do
- local name = ipadmins[k].name
- local level = ipadmins[k].level
- if admins[name] and admins[name] ~= {} then
- admins[name][2] = "ip"
- else
- admins[name] = {"garbage", k, level}
- end
- end
- local bool
- for k,v in pairs(admins) do
- if x == ID then
- if admins[k][1] ~= "garbage" then
- sendresponse(tostring(admin_table[admins[k][1]].name) .. " is no longer a hash admin!", command, executor)
- admin_table[admins[k][1]] = nil
- else
- sendresponse(tostring(k) .. " is not a hash admin.", command, executor)
- end
- bool = true
- break
- else
- x = x + 1
- end
- end
- file:close()
- if not bool then
- sendresponse("There are no admins with an ID of " .. ID, command, executor)
- end
- else
- sendresponse("There are no hash admins on this server.", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor)
- end
- end
- function Command_Setammo(executor, command, player, type, ammo, count)
- if count == 4 and tonumber(type) and tonumber(ammo) then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- local m_object = getobject(getplayerobjectid(players[i]))
- if m_object then
- local m_weaponId = readdword(m_object, 0x118)
- if getobject(m_weaponId) then
- local m_weapon = getobject(m_weaponId)
- if type == "1" then -- unloaded
- writedword(m_weapon, 0x2B6, tonumber(ammo))
- sendresponse(getname(players[i]) .. " had their unloaded ammo changed to " .. ammo, command, executor)
- elseif type == "2" then -- loaded
- writedword(m_weapon, 0x2B8, tonumber(ammo))
- updateammo(m_weaponId)
- sendresponse(getname(players[i]) .. " had their loaded ammo changed to " .. ammo, command, executor)
- else
- sendresponse("Invalid type: 1 for unloaded, 2 for loaded ammo", command, executor)
- end
- else
- sendresponse(getname(players[i]) .. " is not holding any weapons!", command, executor)
- end
- else
- sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor)
- end
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player] [type] [ammo]", command, executor)
- end
- end
- function Command_Ban(executor, command, player, time, count)
- if count == 2 then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- svcmd("sv_ban " .. resolveplayer(players[i]), executor)
- sendresponse(getname(players[i]) .. " has been banned from the server!", "/", executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- elseif count == 3 and tonumber(time) then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- svcmd("sv_ban " .. resolveplayer(players[i]) .. " " .. time)
- sendresponse(getname(players[i]) .. " has been banned from the server!", "/", executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player] {time}", command, executor)
- end
- end
- function Command_Bos(executor, command, player, count)
- if count == 2 then
- local player_number = tonumber(player)
- local bos_entry = bos_table[player_number]
- local words = {}
- if bos_entry == nil then
- sendresponse("Invalid Player", command, executor)
- else
- local count = gettokencount(bos_entry, ",")
- for i = 1,count do
- local word = gettoken(bos_entry, ",", i-1)
- table.insert(words, word)
- end
- local name3 = words[1]
- local hash3 = words[2]
- local ip3 = words[3]
- sendresponse("Adding " .. name3 .. " to BoS.", command, executor)
- sendresponse("Entry: " .. name3 .. " - " .. hash3 .. " - " .. ip3, command, executor)
- table.insert(boslog_table, bos_entry)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
- end
- end
- function Command_Unbos(executor, command, ID, count)
- if count == 2 then
- local entry = boslog_table[tonumber(ID)]
- local words = {}
- if entry == nil then
- sendresponse("Invalid Entry", command, executor)
- else
- local count = gettokencount(entry, ",")
- for i = 1,count do
- local word = gettoken(entry, ",", i-1)
- table.insert(words, word)
- end
- local name = words[1]
- local hash = words[2]
- local IP = words[3]
- sendresponse("Removing " .. name .. " - " .. hash .. " from BoS.", command, executor)
- table.remove(boslog_table, tonumber(ID))
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [entry]", command, executor)
- end
- end
- function DelayEject(id, count, player)
- exitvehicle(player)
- return 0
- end
- function Command_Control(executor, command, victim, Controller, count)
- if count == 3 then
- local victims = getvalidplayers(victim)
- local controller = getvalidplayers(Controller)
- if victims and controller then
- if controller[2] == nil then
- for i = 1,#victims do
- local id = resolveplayer(controller[1])
- local m_playerObjId = getplayerobjectid(controller[1])
- if victims[i] ~= controller[1] then
- table.insert(control_table[id], victims[i])
- sendresponse(getname(victims[i]) .. " is now being controlled by " .. getname(controller[1]), command, executor)
- local m_object = getobject(getplayerobjectid(victims[i]))
- if m_object then
- local m_vehicleId = readdword(m_object, 0x11C)
- local m_vehicle = getobject(m_vehicleId)
- if m_vehicle then
- local seat = readword(m_vehicle, 0x120)
- exitvehicle(victims[i])
- entervehicle(controller[i], m_vehicleId, seat)
- local x,y,z = getobjectcoords(m_playerObjId)
- local vehid = createobject("vehi", "vehicles\\ghost\\ghost_mp", 0, 30, false, x, y, z+5)
- entervehicle(controller[i], vehid, 0)
- registertimer(200, "DelayEject", controller[1])
- movobjcoords(m_playerObjId, x, y, z+0.5)
- entervehicle(victims[i], m_vehicleId, seat)
- end
- end
- elseif victims[i] == controller[1] then
- local bool = false
- for j = 1,16 do
- for k = 1,16 do
- if control_table[j][k] == victims[i] then
- control_table[j][k] = nil
- bool = true
- break
- end
- end
- if bool then
- break
- end
- end
- local m_object = getobject(getplayerobjectid(controller[1]))
- local m_vehicleId = readdword(m_object, 0x11C)
- local m_vehicle = getobject(m_vehicleId)
- if m_vehicle then
- local seat = readword(m_object, 0x120)
- entervehicle(controller[1], m_vehicleId, 0)
- entervehicle(controller[1], m_vehicleId, seat)
- sendresponse(getname(controller[1]) .. " is now being controlled by " .. getname(controller[1]), command, executor)
- else
- sendresponse(getname(controller[1]) .. " is no longer being controlled!", command, executor)
- end
- end
- end
- else
- sendresponse("Victims can only be controlled by one person.", command, executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [victims] [controller]", command, executor)
- end
- end
- function Command_Commands(executor, command, count)
- if count == 1 then
- local commands = ""
- for i = 1,#commands_table do
- commands = commands .. " " .. commands_table[i]
- if commands:len() >= 100 then
- sendresponse(commands, command, executor)
- commands = ""
- end
- end
- else
- sendresponse("Invalid Syntax: " .. command, command, executor)
- end
- end
- function Command_Count(executor, command, count)
- if count == 1 then
- sendresponse("There are " .. tostring(uniques) .. " unique users that have been to this server!", command, executor)
- else
- sendresponse("Invalid Syntax: " .. command, command, executor)
- end
- end
- function Command_Kick(executor, command, player, count)
- if count == 2 then
- local players = getvalidplayers(player, executor)
- if players then
- for i = 1,#players do
- svcmd("sv_kick " .. resolveplayer(players[i]))
- sendresponse(getname(players[i]) .. " has been kicked from the server!", "/", executor)
- end
- else
- sendresponse("Invalid Player!", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor)
- end
- end
- function Command_Deathless(executor, command, boolean, count)
- if count == 1 then
- if deathless then
- sendresponse("Deathless is currently enabled.", command, executor)
- else
- sendresponse("Deathless is currently disabled", command, executor)
- end
- elseif count == 2 then
- if (boolean == "1" or boolean == "true") and not deathless then
- for c = 0,15 do
- if getplayer(c) then
- local m_player = getplayer(c)
- local m_playerObjId = readdword(m_player, 0x34)
- local m_object = getobject(m_playerObjId)
- local obj_health = readfloat(m_object, 0xE0)
- local obj_shields = readfloat(m_object, 0xE4)
- writefloat(m_object, 0xE0, 99999999)
- writefloat(m_object, 0xE4, 99999999)
- end
- end
- sendresponse("Deathless player is now on. You cannot die.", command, executor)
- deathless = true
- elseif boolean == "1" or boolean == "true" then
- sendresponse("Deathless is already enabled!", command, executor)
- elseif (boolean == "0" or boolean == "false") and deathless then
- for c = 0,15 do
- if getplayer(c) then
- local m_player = getplayer(c)
- local m_playerObjId = readdword(m_player, 0x34)
- local m_object = getobject(m_playerObjId)
- local obj_health = readfloat(m_object, 0xE0)
- local obj_shields = readfloat(m_object, 0xE4)
- writefloat(m_object, 0xE0, 1)
- writefloat(m_object, 0xE4, 1)
- end
- end
- sendresponse("Deathless player is now off.", command, executor)
- deathless = false
- elseif deathless == nil then
- sendresponse("Deathless player is now off.", command, executor)
- deathless = false
- elseif boolean == "0" or boolean == "false" then
- sendresponse("Deathless is already disabled!", command, executor)
- else
- sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor)
- end
- else
- sendresponse("Invalid Syntax: " .. command .. " {boolean}", command, executor)
- end
- end
- function Command_Execute(executor, command)
- sendresponse("Executed " .. string.sub(command, 4), command, executor)
- sendresponse(svcmd(string.sub(command, 4)), command, executor)