--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) end function Command_Setmode(executor, command, player, Mode, object, count) if player == nil then sendresponse("Invalid Syntax: " .. command .. " [player] [mode] {object (for spawngun only)}", command, executor) return end local players = getvalidplayers(player, executor) if players then if count == 3 then for i = 1,#players do if Mode == "destroy" then mode[gethash(players[i])] = "destroy" sendresponse(getname(players[i]) .. " is now in destroy mode!", command, executor) elseif Mode == "portalgun" then mode[gethash(players[i])] = "portalgun" sendresponse(getname(players[i]) .. " is now in portalgun mode!", command, executor) elseif Mode == "entergun" then mode[gethash(players[i])] = "entergun" sendresponse(getname(players[i]) .. " is now in entergun mode!", command, executor) elseif Mode == "controlgun" then mode[gethash(players[i])] = "controlgun" sendresponse(getname(players[i]) .. " is now in controlgun mode!", command, executor) elseif Mode == "normal" or Mode == "none" or Mode == "regular" then objspawntype[gethash(players[i])] = nil objspawntag[gethash(players[i])] = nil mode[gethash(players[i])] = nil sendresponse(getname(players[i]) .. " is now in normal mode!", command, executor) else sendresponse("Invalid Mode!", command, executor) end end elseif count == 4 then for i = 1,#players do if Mode == "spawngun" then local objexists = false --local objspawntype[gethash(players[i])] = nil objspawntag[gethash(players[i])] = nil mode[gethash(players[i])] = nil for j = 1,#objects do if object == objects[j][1] then mode[gethash(players[i])] = "spawngun" objspawntype[gethash(players[i])] = objects[j][2] objspawntag[gethash(players[i])] = objects[j][3] sendresponse(getname(players[i]) .. " is now spawning " .. objects[j][3] .. "!", command, executor) objexists = true break end end if objexists == false then sendresponse("Object does not exist. Make sure you are spelling it right.", command, executor) end end end else sendresponse("Invalid Syntax: " .. command .. " [player] [mode] {object}", command, executor) end else sendresponse("Invalid Player!", command, executor) end end function Command_Eject(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local m_object = getobject(getplayerobjectid(players[i])) local m_vehicleId = readdword(m_object, 0x11C) if m_object then if m_vehicleId ~= 0xffffffff then exitvehicle(players[i]) sendresponse("Ejecting " .. getname(players[i]) .. " from his/her vehicle!", command, executor) else sendresponse("Error! " .. getname(players[i]) .. " is not in a vehicle!", 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]", command, executor) end end function Command_Getloc(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_playerObjId = getplayerobjectid(players[i]) if getobject(m_playerObjId) then local x,y,z = getobjectcoords(m_playerObjId) x = round(x, 2) y = round(y, 2) z = round(z, 2) sendresponse(getname(players[i]) .. "'s coords are: X: " .. x .. " Y: " .. y .. " Z: " .. z, command, executor) 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]", command, executor) end end function Command_Follow(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do sendresponse(getname(executor) .. " is now following " .. getname(players[i]), command, executor) local id = resolveplayer(executor) follow[id] = registertimer(20, "FollowTimer", executor, players[i]) end elseif player == "stop" or player == "none" then local id = resolveplayer(executor) if follow[id] then sendresponse(getname(executor) .. " is no longer following", command, executor) removetimer(follow[id]) follow[id] = nil end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Falldamage(executor, command, boolean, count) if count == 1 then if falldamage then sendresponse("Fall damage is currently on", command, executor) else sendresponse("Fall damage is currently off", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and not falldamage then falldamage = true sendresponse("Fall damage is now on!", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("Fall damage is already on!", command, executor) elseif boolean ~= "0" and boolean ~= "false" then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and (falldamage or falldamage == nil) then falldamage = false sendresponse("Fall damage is now off!", command, executor) elseif boolean == "0" or boolean == "false" then sendresponse("Fall damage is already off!", 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_Ghost(executor, command, player, count) if count == 1 then local m_object = getobject(getplayerobjectid(executor)) if m_object then writebit(m_object, 0x10, 7, 1) sendresponse("You are now a ghost!", command, executor) else sendresponse("You cannot become a ghost while dead!", command, executor) end elseif count == 2 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 writebit(m_object, 0x10, 7, 1) sendresponse(getname(players[i]) .. " is now a ghost!", command, executor) sendresponse("You are now a ghost.", "\\", players[i]) else sendresponse("You cannot ghost " .. getname(players[i]) .. " because " .. getname(players[i]) .. " is dead!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Hide(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local id = resolveplayer(players[i]) if hidden[id] == nil then sendresponse(getname(players[i]) .. " is now hidden!", command, executor) hidden[id] = true else sendresponse(getname(players[i]) .. " is already hidden!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Unhide(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local id = resolveplayer(players[i]) if hidden[id] then sendresponse(getname(players[i]) .. " is no longer hidden!", command, executor) hidden[id] = nil else sendresponse(getname(players[i]) .. " was never hidden!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Unban(executor, command, id, count) if count == 2 and tonumber(id) then local response = svcmd("sv_unban " .. tonumber(id), executor) if response then if string.find(response, "Unbanning") then sendresponse(response, command, executor) else sendresponse("That ID has not been banned.", command, executor) end else sendresponse("An unknown error has occured getting the reply from svcmd.", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [Banlist ID]", command, executor) end end function Command_Unghost(executor, command, player, count) if count == 1 then local m_object = getobject(getplayerobjectid(executor)) if m_object then writebit(m_object, 0x10, 7, 0) sendresponse("You are no longer a ghost.", command, executor) else sendresponse("You cannot unghost while dead!", command, executor) end elseif count == 2 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 writebit(m_object, 0x10, 7, 0) sendresponse(getname(players[i]) .. " is no longer a ghost!", command, executor) sendresponse("You are no longer a ghost.", "\\", players[i]) else sendresponse("You cannot unghost " .. getname(players[i]) .. " because " .. getname(players[i]) .. " is dead!", command, executor) end end else sendresponse("Invalid Player!") end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Godmode(executor, command, player, count) if count == 2 then if deathless ~= 1 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local m_playerObjId = readdword(m_player, 0x34) local m_object = getobject(m_playerObjId) if m_object then local obj_health = readfloat(m_object, 0xE0) local obj_shields = readfloat(m_object, 0xE4) writefloat(m_object, 0xE0, 99999999) writefloat(m_object, 0xE4, 99999999) sendresponse(getname(players[i]) .. " has been given godmode!", command, executor) sendresponse("You have been given godmode.", "\\", players[i]) else sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor) end end else sendresponse("Invalid Player", command, executor) end else sendresponse("Deathless is enabled! You cannot give out godmode!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Setscore(executor, command, player, score, count) if count == 3 and tonumber(score) then local players = getvalidplayers(player, executor) if players then for i = 1,#players do setscore(players[i], tonumber(score)) sendresponse(getname(players[i]) .. " had their score set to " .. score .. "!", command, executor) end else sendresponse("Invalid Player!", command, executor) end elseif count == 1 then sendresponse("Syntax: " .. command .. " [player] [score]", command, executor) else sendresponse("Invalid Syntax: " .. command .. " [player] [score]", command, executor) end end function Command_Hax(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) setscore(players[i], 9999) writeword(m_player, 0x9C, 9999) writeword(m_player, 0xA4, 9999) writeword(m_player, 0xAC, 9999) writeword(m_player, 0xAE, 9999) writeword(m_player, 0xB0, 9999) sendresponse(getname(players[i]) .. " has been haxed!", command, executor) end end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Heal(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local m_playerObjId = readdword(m_player, 0x34) local m_object = getobject(m_playerObjId) if m_object then local obj_health = readfloat(m_object, 0xE0) local obj_shields = readfloat(m_object, 0xE4) writefloat(m_object, 0xE0, 1) writefloat(m_object, 0xE4, 1) sendresponse(getname(players[i]) .. " has been healed!", command, executor) sendresponse("You have been healed!", "\\", players[i], command, executor) 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]", command, executor) end end function Command_Ungod(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local m_playerObjId = readdword(m_player, 0x34) local m_object = getobject(m_playerObjId) if m_object then local obj_health = readfloat(m_object, 0xE0) local obj_shields = readfloat(m_object, 0xE4) writefloat(m_object, 0xE0, 1) writefloat(m_object, 0xE4, 1) sendresponse(getname(players[i]) .. " is no longer in godmode", command, executor) sendresponse("You are no longer in godmode.", "\\", players[i], command, executor) else sendresponse("Error! The selected player is dead!", command, executor) end end else sendresponse("Invalid Player", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Hitler(executor, command, count) if count == 1 then for i = 0,15 do if getplayer(i) then if getobject(getplayerobjectid(i)) then kill(i) sendresponse(getname(i) .. " was given a lethal injection!", command, executor) end end end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Infammo(executor, command, boolean, count) if count == 1 then if infammo then sendresponse("Infinite ammo is currently enabled", command, executor) else sendresponse("Infinite ammo is currently disabled", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and not infammo then nadetimer = registertimer(300, "nadeTimer") for c = 0,15 do if getplayer(c) then local m_ObjId = readdword(m_player, 0x34) local m_Object = getobject(m_ObjId) if m_Object then for i = 0,3 do local m_weaponId = readdword(m_Object, 0x2F8 + (i*4)) if m_weaponId ~= 0xFFFFFFFF then local m_weapon = getobject(m_weaponId) writeword(m_weapon, 0x2B6, 9999) -- unloaded clip to 9999 --writeword(m_weapon, 0x2B8, 9999) -- loaded clip to 9999 --updateammo(m_weaponId) end end end end end infammo = true sendresponse("Infinite Ammo is now enabled!", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("Infammo is already enabled!", command, executor) elseif boolean ~= "0" and boolean ~= "false" then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and infammo then for c = 0,15 do if getplayer(c) then local m_player = getplayer(c) local m_ObjId = readdword(m_player, 0x34) local m_Object = getobject(m_ObjId) if m_player and m_Object then writebyte(m_Object, 0x31E, 0) -- set frags to 4 writebyte(m_Object, 0x31F, 0) -- set plasmas to 4 end end end infammo = false sendresponse("Infinite Ammo is now disabled!", command, executor) elseif infammo == nil then sendresponse("Infinite Ammo is now disabled!", command, executor) infammo = false elseif boolean == "0" or boolean == "false" then sendresponse("Infammo 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_Superban(executor, command, player, count) if count == 2 and tonumber(command) == nil then local players = getvalidplayers(player, executor) if players then for i = 1,#players do table.insert(name_bans, getname(players[i])) local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a") local id = resolveplayer(players[i]) ip_banlist[getname(players[i])] = getip(players[i]) banlist:write(tostring(getname(players[i])) .. "," .. tostring(ip_banlist[getname(players[i])]) .. "\n") banlist:close() local file = io.open(profilepath .. "\\namebans.txt", "w") for i = 1,#name_bans do file:write(name_bans[i] .. "\n") end file:close() sendresponse(getname(players[i]) .. " has been superbanned from the server!", command, executor) svcmd("sv_ban " .. resolveplayer(players[i])) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Nameban(executor, command, player, count) if count == 2 and tonumber(command) == nil then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local name = getname(players[i]) local bool = true for i = 1,#name_bans do if name_bans[i] == name then bool = false break end end if bool then table.insert(name_bans, name) Ipban(players[i]) sendresponse(name .. " has been name banned from the server!", command, executor) local file = io.open(profilepath .. "\\namebans.txt", "w") for i = 1,#name_bans do file:write(name_bans[i] .. "\n") end file:close() end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Namebanlist(executor, command, count) if count == 1 then if name_bans == {} or name_bans == nil or #name_bans == 0 then sendresponse("There are no names banned from the server.", command, executor) return end for i = 1,#name_bans do sendresponse("[" .. i .. "] " .. name_bans[i], command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Nameunban(executor, command, ID, count) if count == 2 then local ID = tonumber(ID) if name_bans[ID] then sendresponse(name_bans[ID] .. " has been unbanned from the server!", command, executor) name_bans[ID] = nil local file = io.open(profilepath .. "\\namebans.txt", "w") for i = 1,#name_bans do if name_bans[i] then file:write(name_bans[i] .. "\n") end end file:close() else sendresponse("That name has not been banned.", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor) end end function Command_Ipban(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local banlist = io.open(string.format("%s\\ipbanlist.txt", profilepath), "a") local id = resolveplayer(players[i]) ip_banlist[getname(players[i])] = getip(players[i]) banlist:write(tostring(getname(players[i])) .. "," .. tostring(getip(players[i])) .. "\n") banlist:close() Ipban(players[i]) sendresponse(getname(players[i]) .. " has been IP banned from the server!", "/", executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Ipbanlist(executor, command, count) if count == 1 then local banlist = io.open(profilepath .. "\\ipbanlist.txt") local j = 1 local bool = false if banlist then sendresponse("[Num - Name - IP]", command, executor) for line in banlist:lines() do if line and line ~= "" then local count = gettokencount(line, ",") local words = {} for i = 1,count do local word = gettoken(line, ",", i - 1) table.insert(words, word) end sendresponse("[" .. tostring(j) .. " - " .. tostring(words[1]) .. " - " .. tostring(words[2]) .. "]", command, executor) j = j + 1 bool = true end end banlist:close() if not bool then sendresponse("The ipbanlist is empty!", command, executor) end else sendresponse("The ipbanlist is empty!", command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function RefreshIPBanlist(id, count) ip_banlist = {} for line in io.lines(string.format("%s\\ipbanlist.txt", profilepath)) 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 return 0 end function Command_Ipunban(executor, command, ID, count) local bool = false if count == 2 and tonumber(ID) then local file = io.open(profilepath .. "\\ipbanlist.txt", "r") local Lines = {} if file then for line in file:lines() do if line ~= "" then table.insert(Lines, line) end end file:close() file = io.open(string.format("%s\\ipbanlist.txt", profilepath), "w") ID = tonumber(ID) for i = 1,#Lines do if i ~= ID then file:write(tostring(Lines[i]) .. "\n") else bool = true end end file:close() registertimer(500, "RefreshIPBanlist") else sendresponse(tostring(ID) .. " is not a valid banlist ID", command, executor) return end if bool then sendresponse(gettoken(tostring(Lines[ID]), ",", 0) .. " has been unbanned from the IP banlist!", command, executor) else sendresponse(tostring(ID) .. " is not a valid banlist ID!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor) end end function Command_Privatesay(executor, args, count) if count >= 3 and tonumber(args[1]) == nil then local players = getvalidplayers(args[2], executor) if players then local message = "" for i = 3,#args do message = message .. args[i] .. " " end for i = 1,#players do privatesay(players[i], tostring(message)) end sendresponse("Private messages sent.", command, executor) else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] [message]", command, executor) end end function Command_Write(executor, command, type, struct, offset, value, player, count) local offset = tonumber(offset) if count > 4 and count < 7 and tonumber(type) == nil and tonumber(struct) == nil and offset then local players = getvalidplayers(player, executor) if players then for i = 1,#players do if struct == "player" then struct = getplayer(players[i]) elseif struct == "object" then struct = getobject(getplayerobjectid(players[i])) if struct == nil then sendresponse(getname(players[i]) .. " is not alive.", command, executor) return end elseif getobject(getplayerobjectid(players[i])) == nil then sendresponse(getname(players[i]) .. " is not alive.", command, executor) return elseif struct == "weapon" then local m_object = getobject(getplayerobjectid(players[i])) struct = getobject(readdword(m_object, 0x118)) if struct == nil then sendresponse("Error! " .. getname(players[i]) .. " is not holding a weapon!", command, executor) return end elseif tonumber(struct) == nil then sendresponse("Invalid Struct. Valid structs are: player, object, and weapon", command, executor) return end if value then if type == "byte" then writebyte(struct, offset, value) elseif type == "float" then writefloat(struct, offset, value) elseif type == "word" then writeword(struct, offset, value) elseif type == "dword" then writedword(struct, offset, value) else sendresponse("Invalid Type. Valid types are byte, float, word, and dword", command, executor) return end sendresponse("Writing " .. tostring(value) .. " to struct " .. tostring(struct) .. " at offset " .. tostring(offset) .. " was a success!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [type] [struct] [offset] [value] [player]", command, executor) end end function Command_Invis(executor, command, player, time, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do if getobject(getplayerobjectid(players[i])) and ghost_table[gethash(players[i])] == nil then ghost_table[gethash(players[i])] = true sendresponse(getname(players[i]) .. " is now invisible!", command, executor) elseif ghost_table[gethash(players[i])] then sendresponse("Error! " .. getname(players[i]) .. " is already invisible!", command, executor) else sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor) end 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 if getobject(getplayerobjectid(players[i])) and ghost_table[gethash(players[i])] == nil then ghost_table[gethash(players[i])] = tonumber(time) sendresponse(getname(players[i]) .. " is now invisible for " .. time .. " seconds!", command, executor) privatesay(players[i], "You are now invisible for " .. time .. " seconds.") elseif ghost_table[gethash(players[i])] then sendresponse("Error! " .. getname(players[i]) .. " is already invisible!", command, executor) 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] {time}", command, executor) end end function Command_Move(executor, command, player, X, Y, Z, count) if count == 5 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_playerObjId = getplayerobjectid(players[i]) if m_playerObjId ~= 0xFFFFFFFF then local m_objectId = 0xFFFFFFFF local m_vehicleId = readdword(getobject(m_playerObjId), 0x11C) if m_vehicleId ~= 0xFFFFFFFF then m_objectId = m_vehicleId elseif m_playerObjId ~= 0xFFFFFFFF then m_objectId = m_playerObjId end if m_objectId ~= 0xFFFFFFFF then local x,y,z = getobjectcoords(m_objectId) movobjcoords(m_objectId, x+X, y+Y, z+Z) sendresponse(getname(players[i]) .. " has been moved!", command, executor) privatesay(players[i], "You have been moved.") 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] [x] [y] [z]", command, executor) end end function Command_Kill(executor, command, player, count) if executor == 0xFFFFFFFF then return end if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do kill(players[i]) sendresponse(getname(players[i]) .. " has been killed!", command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_lo3(executor, command, count) if count == 1 then lo3timer = registertimer(2000, "lo3Timer") sendresponse("Live on three.", command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Crash(executor, command, player, count) if count == 2 and not gameend then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_objectId = createobject("vehi", "vehicles\\warthog\\mp_warthog", 0, 0, false, 0, 1, 2) for j = 0,20 do entervehicle(players[i], m_objectId, j) exitvehicle(players[i]) end destroyobject(m_objectId) sendresponse(getname(players[i]) .. " had their game crashed by an admin!", command, executor) end else sendresponse("Invalid Player!", command, executor) end elseif gameend then sendresposne("You cannot crash a player while the game is ended. Wait until next game.", command, executor) else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Map(executor, command) local args = {} local count = getcmdtokencount(command) for i = 1,count do local word = getcmdtoken(command, i - 1) word = string.lower(word) table.insert(args, word) end if count > 2 and tonumber(args) == nil then local found = false local arguments = "" for i = 4,#args do if arguments == nil then arguments = args[i] else arguments = arguments .. " " .. args[i] end if args[i] == "commands" and args[i] ~= args[1] and args[i] ~= args[2] and args[i] ~= args[3] then found = true end end if not found then arguments = arguments .. " commands" end arguments = string.gsub(arguments, " ", " ") if tonumber(arguments) == nil then local response = "" if string.sub(args[1], 1, 2) ~= "sv" then response = svcmd("sv_map " .. args[2] .. " \"" .. args[3] .. "\" " .. tostring(arguments), executor) else svcmd("sv_map " .. args[2] .. " \"" .. args[3] .. "\" " .. tostring(arguments), executor) end if response == "" or response == nil then return end sendresponse(response, args[1], executor) else sendresponse("Unknown error occured (wtf?)", args[1], executor) end else sendresponse("Invalid Syntax: " .. args[1] .. " [map] [gametype] {script1} {script2}...", args[1], executor) end end function Command_StartMapcycle(executor, command, count) if count == 1 then sendresponse(svcmd("sv_mapcycle_begin"), command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Mapnext(executor, command, count) if count == 1 then sendresponse(svcmd("sv_map_next"), command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Mute(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(players[i]) local mute if admin_table[hash] or ipadmins[getip(players[i])] then mute = true break end if not mute then if not mute_table[hash] and not spamtimeout_table[hash] then mute_table[hash] = true sendresponse(getname(players[i]) .. " was muted by an admin!", command, executor) else sendresponse(getname(players[i]) .. " has already been muted.", command, executor) end else sendresponse("Admins cannot be muted.", command, executor) end end else sendresponse("Invalid Player", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Nuke(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local name = getname(players[i]) local m_objectId = getplayerobjectid(players[i]) if m_objectId ~= 0xFFFFFFFF then local m_object = getobject(m_objectId) local x,y,z = getobjectcoords(m_objectId) for j = 1,5 do local nukeproj = createobject("eqip", "weapons\\frag grenade\\frag grenade", m_objectId, 0, false, x, y, z+10) table.insert(nukes, nukeproj) local m_proj = getobject(nukeproj) --writefloat(m_proj, 0x70, -5) end else sendresponse("Cannot nuke " .. name .. " because they are dead", command, executor) end end else sendresponse("Invalid Player!", command, executor) end elseif count == 1 then sendresponse("Syntax: " .. command .. " [player]", command, executor) else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Noweapons(executor, command, boolean, count) if count == 1 then if noweapons then sendresponse("Noweapons mode is currently enabled.", command, executor) else sendresponse("Noweapons mode is currently disabled.", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and not noweapons then for i = 0,15 do if getplayer(i) then local m_object = getobject(getplayerobjectid(i)) if m_object then for j = 0,3 do local weap_id = readdword(m_object, 0x2F8 + (j*4)) if getobject(weap_id) then destroyobject(weap_id) end end end end end sendresponse("Noweapons is now on. You cannot pick up weapons.", command, executor) noweapons = true elseif boolean == "1" or boolean == "true" then sendresponse("Noweapons is already enabled!", command, executor) elseif boolean ~= "0" and boolean ~= "false" then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and noweapons then for i = 0,15 do if getplayer(i) and getplayerobjectid(i) ~= 0xFFFFFFFF then local hash = gethash(i) if Noweapons[hash] then Noweapons[hash] = nil end resetweapons(i) end end sendresponse("Noweapons mode is now off.", command, executor) noweapons = false elseif noweapons == nil then sendresponse("Noweapons mode is now off.", command, executor) noweapons = false elseif boolean == "0" or boolean == "false" then sendresponse("Noweapons 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_Takeweapons(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(players[i]) if Noweapons[hash] == nil then Noweapons[hash] = 1 local m_object = getobject(getplayerobjectid(players[i])) if m_object then for j = 0,3 do local m_weaponId = readdword(m_object, 0x2F8 + j*4) local m_weapon = getobject(m_weaponId) if m_weapon then destroyobject(m_weaponId) end end end sendresponse(getname(players[i]) .. " now has no weapons!", command, executor) else sendresponse(getname(players[i]) .. " already has no weapons!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Textban(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) local file = io.open(string.format("%s\\textbanlist.txt", profilepath), "a") if players then for i = 1,#players do local name = getname(players[i]) local ip = getip(players[i]) local hash = gethash(players[i]) if admin_table[hash] or ipadmins[ip] then sendresponse("Admins cannot be banned from the chat.", command, executor) else mute_banlist[name] = {ip, hash} file:write(tostring(name) .. "," .. tostring(hash) .. "," .. tostring(ip) .. "\n") sendresponse(tostring(name) .. " has been banned from the chat!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end file:close() elseif count == 1 then sendresponse("Syntax: " .. command .. " [player]", command, executor) else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Textbanlist(executor, command, count) if count == 1 then local banlist = io.open(profilepath .. "\\textbanlist.txt") local j = 1 local bool = false if banlist then sendresponse("[Num - Name - Hash - IP]", command, executor) for line in banlist:lines() do if line and line ~= "" then local count = gettokencount(line, ",") local words = {} for i = 1,count do local word = gettoken(line, ",", i - 1) table.insert(words, word) end sendresponse("[" .. tostring(j) .. " - " .. tostring(words[1]) .. " - " .. tostring(words[2]) .. " - " .. tostring(words[3]) .. "]", command, executor) j = j + 1 bool = true end end banlist:close() if not bool then sendresponse("The textbanlist is empty!", command, executor) end else sendresponse("The textbanlist is empty!", command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function RefreshTextBanlist(id, count) mute_banlist = {} for line in io.lines(string.format("%s\\textbanlist.txt", profilepath)) 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 return 0 end function Command_Textunban(executor, command, ID, count) local bool = false if count == 2 and tonumber(ID) then local file = io.open(profilepath .. "\\textbanlist.txt", "r") local Lines = {} if file then for line in file:lines() do if line ~= "" then table.insert(Lines, line) end end file:close() file = io.open(string.format("%s\\textbanlist.txt", profilepath), "w") ID = tonumber(ID) for i = 1,#Lines do if i ~= ID then file:write(tostring(Lines[i]) .. "\n") else bool = true end end file:close() registertimer(500, "RefreshTextBanlist") else sendresponse(tostring(ID) .. " is not a valid banlist ID", command, executor) return end if bool then sendresponse(gettoken(tostring(Lines[ID]), ",", 0) .. " has been unbanned from the chat!", command, executor) else sendresponse(tostring(ID) .. " is not a valid banlist ID!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [ID]", command, executor) end end function Command_Resetweapons(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(players[i]) if Noweapons[hash] then Noweapons[hash] = nil local m_object = getobject(getplayerobjectid(players[i])) if m_object then resetweapons(players[i]) sendresponse(getname(players[i]) .. " had their weapons reset!", command, executor) end else sendresponse(getname(players[i]) .. " never had their weapons taken away!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Setpassword(executor, command, password, count) if count == 1 then local response = svcmd("sv_password") if response then sendresponse(response, command, executor) else sendresponse("Critical error." .. passwrd .. "'", command, executor) end elseif count == 2 then if password == "" then svcmd('sv_password ""') sendresponse("Password has been taken off", command, executor) passwrd = nil elseif passwrd then svcmd('sv_password ' .. password) sendresponse("The password is now " .. password, command, executor) passwrd = password else sendresponse("An internal error has occured.\nPlease inform the developer «¬EpºWizard", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " {password}", command, executor) end end function Command_Getplayerlist(executor, command, count) if count == 1 then local message = svcmd("sv_players") sendresponse(message, command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Mapreset(executor, command, count) if count == 1 then sendresponse("The map has been reset", command, executor) svcmd("sv_map_reset") else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Viewadmins(executor, command, count) if count == 1 then sendresponse("The current admins in the server are listed below:", command, executor) sendresponse("[Level] Name: Admin types", command, executor) local admins = {} for i = 0,15 do local hash = gethash(i) if hash then local name = getname(i) if admin_table[hash] then admins[name] = {"hash", "notip", admin_table[hash].level} end if ipadmins[getip(i)] then if admins[name] and admins[name] ~= {} then admins[name][2] = "ip" else admins[name] = {"nothash", "ip", ipadmins[getip(i)].level} end end end end for k,v in pairs(admins) do local message = "" if admins[k][1] == "hash" and admins[k][2] == "ip" then message = "[" .. admins[k][3] .. "] " .. k .. ": Hash Admin IP Admin" elseif admins[k][1] == "hash" then message = "[" .. admins[k][3] .. "] " .. k .. ": Hash Admin" elseif admins[k][2] == "ip" then message = "[" .. admins[k][3] .. "] " .. k .. ": IP Admin" end sendresponse(message, command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Adminrevoke(executor, command, player, count, type) if count == 2 then local players = getvalidplayers(player, executor) if players then for j = 1,#players do local hash = gethash(players[j]) local ip = getip(players[j]) if ipadmins[ip] or admin_table[hash] then admin_table[hash] = nil ipadmins[ip] = nil sendresponse(getname(players[j]) .. " is no longer an admin!", command, executor) else sendresponse("Error! " .. getname(players[j]) .. " is not an admin!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function reloadadmins(id, count) local file = io.open(string.format("%s\\admin.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 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 file = io.open(profilepath .. "\\ipadmins.txt", "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 not ipadmins[words[2]] then ipadmins[words[2]] = {} end ipadmins[words[2]].name = words[1] ipadmins[words[2]].level = words[3] end file:close() end return 0 end function Command_Banlist(executor, command, count) if count == 1 then sendresponse(svcmd("sv_banlist"), command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Resp(executor, command, player, time, count) if count == 3 and tonumber(time) then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) writedword(m_player, 0x2c, time * 33) sendresponse("Setting " .. getname(players[i]) .. "'s respawn time to " .. time .. " seconds!", command, executor) end else sendresponse("Invalid Player", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] [time]", command, executor) end end function Command_Timelimit(executor, command, time, count) if count == 1 then local time_passed = readdword(readdword(gametime_base, 0x0), 0xC) / 1800 local timelimit = readdword(gametype_base, 0x78) / 1800 local time_left = timelimit - time_passed local Timelimit = readdword(timelimit_address, 0x0) sendresponse("Current Timelimit is " .. Timelimit .. " minutes. Time remaining: " .. tostring(round(time_left, 0)) .. " minutes.", command, executor) elseif count == 2 and tonumber(time) then settimelimit(time) sendresponse("Timelimit set to " .. time .. " minutes!", command, executor) else sendresponse("Invalid Syntax: " .. command .. " {time}", command, executor) end end function Command_Setassists(executor, command, player, assists, count) if count == 3 and tonumber(assists) then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local Assists = tonumber(assists) if Assists > 0x7FFF then writewordsigned(m_player, 0xA4, 0x7FFF) elseif Assists < -0x7FFF then writewordsigned(m_player, 0xA4, -0x7FFF) else writewordsigned(m_player, 0xA4, Assists) end sendresponse(getname(players[i]) .. " had their assists set to " .. assists, command, executor) end else sendresponse("Invalid Player", command, executor) end else regstertimer(0, "delayMsg", "Invalid Syntax: " .. command .. " [player] [assists]", command, executor) end end function Command_Setdeaths(executor, command, player, deaths, count) if count == 3 and tonumber(deaths) then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) Deaths = tonumber(deaths) if Deaths > 0x7FFF then writewordsigned(m_player, 0xAE, 0x7FFF) elseif Deaths < -0x7FFF then writewordsigned(m_player, 0xAE, -0x7FFF) else writewordsigned(m_player, 0xAE, Deaths) end sendresponse(getname(players[i]) .. " had their deaths set to " .. deaths, command, executor) end else sendresponse("Invalid Player", command, executor) end else regstertimer(0, "delayMsg", "Invalid Syntax: " .. command .. " [player] [deaths]", command, executor) end end function Command_Setfrags(executor, command, player, frags, count) if count == 3 and tonumber(frags) 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 writebyte(m_object, 0x31E, frags) sendresponse("Setting " .. getname(players[i]) .. "'s frag grenades to " .. frags, command, executor) sendresponse("Your frag grenades were set to " .. frags, "\\", players[i]) 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] [amount]", command, executor) end end function Command_Setname(executor, command, player, name, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local name2 = getname(players[i]) local player_name = readstring(m_player, 0x4, 11) local player_name2 = readstring(m_player, 0x48, 11) local player_name3 = tostring(readtagname(name_base+players[i]*4)) if tostring(player_name) == tostring(player_name2) and tostring(player_name) == tostring(player_name3) then sendresponse(name2 .. "'s current name is " .. tostring(player_name), command, executor) else sendresponse("An unknown error has occured.", command, executor) end end else sendresponse("Invalid Player!", command, executor) end elseif count == 3 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do if players[2] == nil then local name2 = getname(players[i]) local m_player = getplayer(players[i]) local player_name = tostring(readtagname(name_base+players[i]*4)) local length = string.len(name2) if string.len(name) < length then for i = string.len(name),length do name = name .. " " end end --writestring(tostring(name), m_player, 0x4, 0x2) --writestring(tostring(name), m_player, 0x48, 0x2) writestring(tostring(name), name_base, 0x20*players[i], 0x2) sendresponse(name2 .. "'s name has been changed to " .. name, command, executor) else sendresponse("You cannot change multiple people's name at once.", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] {name}", command, executor) end end function Command_Setkills(executor, command, player, kills, count) if count == 3 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) kills = tonumber(kills) if kills > 0x7FFF then writewordsigned(m_player, 0x9C, 0x7FFF) elseif kills < -0x7FFF then writewordsigned(m_player, 0x9C, -0x7FFF) else writewordsigned(m_player, 0x9C, kills) end sendresponse(getname(players[i]) .. " had their kills set to " .. kills, command, executor) end else sendresponse("Invalid Player", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] [kills]", command, executor) end end function Command_Setresp(executor, command, time, count) if count == 2 then if time == "default" then respset = false sendresponse("Respawn time set to the gametype's default setting!", command, executor) elseif tonumber(time) then resptime = time respset = true sendresponse("Respawn time set to " .. time .. " seconds!", command, executor) elseif respset == nil then sendresponse("Respawn time not set. Defaulting to gametype's default setting.", command, executor) else sendresponse("Invalid Syntax: " .. command .. " [seconds]", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [seconds]", command, executor) end end Command_Setplasmas = function(executor, command, player, plasmas, count) if count == 3 and tonumber(plasmas) 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 writebyte(m_object, 0x31F, plasmas) sendresponse("Setting " .. getname(players[i]) .. "'s plasma grenades to " .. plasmas, command, executor) else sendresponse("Error! " .. getname(players[i]) .. " is dead!", command, executor) end end else sendresponse("Invalid Player", command, executor) end else sendresponse("Invalid Syntax: sv_setplasmas [player] [amount]", command, executor) end end GetGameAddresses = function() local map_header_version = readbyte(0x630e74, 0x4) if map_header_version == 7 then ctf_globals = 0x639B98 -- Confirmed. oddball_globals = 0x639E18 -- Confirmed. slayer_globals = 0x63A0E8 name_base = 0x745D4A specs_addr = 0x662D04 map_addr = 0x698F21 hashcheck_addr = 0x59c280 versioncheck_addr = 0x5152E7 map_pointer = 0x63525c gametype_base = 0x671340 gametime_base = 0x671420 machine_pointer = 0x745BA0 version_address = 0x5DF840 timelimit_address = 0x626630 profilepath = 0x6A0A99 special_chars = 0x517D6B -- special chars in svname patch gametype_patch = 0x481F3C -- gametype patch devmode_patch1 = 0x4A4DBF -- devmode devmode_patch2 = 0x4A4E7F -- devmode return "PC" else ctf_globals = 0x5BDBB8 -- Confirmed. oddball_globals = 0x5BDE78 -- Confirmed. slayer_globals = 0x5BE108 name_base = 0x6C7B6A specs_addr = 0x5E6E63 map_addr = 0x61D151 hashcheck_addr = 0x530130 versioncheck_addr = 0x4CB587 map_pointer = 0x5B927C gametype_base = 0x5F5498 gametime_base = 0x5F55BC machine_pointer = 0x6C7980 version_address = 0x564B34 gametype_patch = 0x45E50C devmode_patch1 = 0x47DF0C devmode_patch2 = 0x47DFBC -- devmode return "CE" end end function Command_Setspeed(executor, command, player, speed, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local cur_speed = readfloat(m_player, 0x6C) sendresponse(getname(players[i]) .. "'s speed is currently " .. cur_speed, command, executor) end else sendresponse("Invalid Player!", command, executor) end elseif count == 3 and tonumber(speed) then local players = getvalidplayers(player, executor) if players then for i = 1,#players do setspeed(players[i], speed) sendresponse(getname(players[i]) .. " had their speed changed to " .. speed, command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] {speed}", command, executor) end end function Command_Specs(executor, command, count) if count == 1 then local specs = readtagname(specs_addr) sendresponse("The server specs are: " .. tostring(specs), command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Spawn(executor, command, object, player, amount, resptime, recycle, type, count) local bool = true if type == "enter" then if count == 2 then if executor ~= 0xFFFFFFFF then player = resolveplayer(executor) else sendresponse("what are you doing, the server isn't a player, it can't enter a vehicle...", command, executor) return end elseif count == 3 then if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then player = resolveplayer(executor) end else sendresponse("Invalid Syntax: " .. command .. " [vehicle] {player}", command, executor) return end message = command .. " " .. object .. " " .. player elseif type == "give" then if count == 2 then if executor ~= 0xFFFFFFFF then player = resolveplayer(executor) else sendresponse("what are you doing, the server isn't a player, it can't be given a weapon...", command, executor) return end elseif count == 3 then if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then player = resolveplayer(executor) end else sendresponse("Invalid Syntax: " .. command .. " [weapon] {player}", command, executor) return end message = command .. " " .. object .. " " .. player elseif type == "spawn" then if count == 2 then if executor ~= 0xFFFFFFFF then message = command .. " " .. object .. " " .. resolveplayer(executor) else sendresponse("what are you doing, the server isn't a player, you can't spawn at its locations...", command, executor) return end elseif count == 3 then if string.lower(player) == "me" and executor ~= 0xFFFFFFFF then player = resolveplayer(executor) end message = command .. " " .. object .. " " .. player elseif count == 4 then message = command .. " " .. object .. " " .. player .. " " .. amount elseif count == 5 then message = command .. " " .. object .. " " .. player .. " " .. amount .. " " .. resptime elseif count == 6 then message = command .. " " .. object .. " " .. player .. " " .. amount .. " " .. resptime .. " " .. recycle else sendresponse("Invalid Syntax: " .. command .. " [object] {player} {amount} {resptime} {recycle}", command, executor) return end else sendresponse("An unknown error has occured.", command, executor) end if type == "spawn" then bool = true if object == "cyborg" or object == "bot" or object == "mastercheif" or object == "biped" or object == "bipd" then Spawn(message, "Cyborg", "bipd", "characters\\cyborg_mp\\cyborg_mp", executor, type) elseif object == "captain" or object == "keyes" then Spawn(message, "Captain Keyes", "bipd", "characters\\captain\\captain", executor, type) elseif object == "cortana" then Spawn(message, "Cortana", "bipd", "characters\\cortana\\cortana", executor, type) elseif object == "cortana2" then Spawn(message, "Cortana2", "bipd", "characters\\cortana\\halo_enhanced\\halo_enhanced", executor, type) elseif object == "crewman" then Spawn(message, "Crewman", "bipd", "characters\\crewman\\crewman", executor, type) elseif object == "elite" then Spawn(message, "elite", "bipd", "characters\\elite\\elite", executor, type) elseif object == "elite2" then Spawn(message, "Elite Special", "bipd", "characters\\elite\\elite special", executor, type) elseif object == "engineer" then Spawn(message, "Engineer", "bipd", "characters\\engineer\\engineer", executor, type) elseif object == "flood" then Spawn(message, "Flood Captain", "bipd", "characters\\flood_captain\\flood_captain", executor, type) elseif object == "flood2" then Spawn(message, "Flood Infection", "bipd", "characters\\flood_infection\\flood_infection", executor, type) elseif object == "flood3" then Spawn(message, "Flood Carrier", "bipd", "characters\\floodcarrier\\floodcarrier", executor, type) elseif object == "floodelite" then Spawn(message, "FloodCombat Elite", "bipd", "characters\\floodcombat elite\\floodcombat elite", executor, type) elseif object == "floodhuman" then Spawn(message, "FloodCombat Human", "bipd", "characters\\floodcombat_human\\floodcombat_human", executor, type) elseif object == "pedobear" or object == "grunt" then Spawn(message, "Pedobear", "bipd", "characters\\grunt\\grunt", executor, type) elseif object == "hunter" then Spawn(message, "Hunter", "bipd", "characters\\hunter\\hunter", executor, type) elseif object == "marine" then Spawn(message, "Marine", "bipd", "characters\\marine\\marine", executor, type) elseif object == "marinesuicide" or object == "marine2" then Spawn(message, "Marine Suicidal", "bipd", "characters\\marine_suicidal\\marine_suicidal", executor, type) elseif object == "monitor" then Spawn(message, "Monitor", "bipd", "characters\\monitor\\monitor", executor, type) elseif object == "sentinel" then Spawn(message, "Sentinel", "bipd", "characters\\sentinel\\sentinel", executor, type) elseif object == "johnson" then Spawn(message, "Sgt. Johnson", "bipd", "characters\\johnson\\johnson", executor, type) --Objects with 'eqip' tags elseif object == "camo" or object == "camouflage" then Spawn(message, "Camouflage", "eqip", "powerups\\active camouflage", executor, type) elseif object == "dblspd" then Spawn(message, "Double Speed", "eqip", "powerups\\double speed", executor, type) elseif object == "fullspec" then Spawn(message, "Full-Spectrum Vision", "eqip", "powerups\\full-spectrum vision", executor, type) elseif object == "fnade" or object == "nades" then Spawn(message, "Frag Grenade", "eqip", "weapons\\frag grenade\\frag grenade", executor, type) elseif object == "pnade" then Spawn(message, "Plasma Grenade", "eqip", "weapons\\plasma grenade\\plasma grenade", executor, type) elseif object == "overshield" or object == "os" then Spawn(message, "Overshield", "eqip", "powerups\\over shield", executor, type) elseif object == "rifleammo" then Spawn(message, "Assault Rifle Ammo", "eqip", "powerups\\assault rifle ammo\\assault rifle ammo", executor, type) elseif object == "healthpack" then Spawn(message, "Health Pack", "eqip", "powerups\\health pack", executor, type) elseif object == "needlerammo" then Spawn(message, "Needler Ammo", "eqip", "powerups\\needler ammo\\needler ammo", executor, type) elseif object == "pistolammo" then Spawn(message, "Pistol Ammo", "eqip", "powerups\\pistol ammo\\pistol ammo", executor, type) elseif object == "rocketammo" then Spawn(message, "Rocket Ammo", "eqip", "powerups\\rocket launcher ammo\\rocket launcher ammo", executor, type) elseif object == "shottyammo" then Spawn(message, "Shotgun Ammo", "eqip", "powerups\\shotgun ammo\\shotgun ammo", executor, type) elseif object == "sniperammo" then Spawn(message, "Sniper Ammo", "eqip", "powerups\\sniper rifle ammo\\sniper rifle ammo", executor, type) elseif object == "flameammo" then Spawn(message, "Flamethrower Ammo", "eqip", "powerups\\flamethrower ammo\\flamethrower ammo", executor, type) else bool = false end if bool then return end end if type ~= "enter" then bool = true --Objects with 'weap' tag if object == "energysword" or object == "esword" then Spawn(message, "Energy Sword", "weap", "weapons\\energy sword\\energy sword", executor, type) elseif object == "ball" or object == "oddball" then Spawn(message, "Oddball", "weap", "weapons\\ball\\ball", executor, type) elseif object == "flag" then Spawn(message, "Flag", "weap", "weapons\\flag\\flag", executor, type) elseif object == "frg" or object == "fuelrod" or object == "rod" or object == "plasmacannon" then Spawn(message, "Fuel Rod", "weap", "weapons\\plasma_cannon\\plasma_cannon", executor, type) elseif object == "ggun" or object == "gravitygun" then Spawn(message, "Gravity Gun", "weap", "weapons\\gravity rifle\\gravity rifle", executor, type) elseif object == "needler" then Spawn(message, "Needler", "weap", "weapons\\needler\\mp_needler", executor, type) elseif object == "pistol" then Spawn(message, "Pistol", "weap", "weapons\\pistol\\pistol", executor, type) elseif object == "ppistol" or object == "plasmapistol" then Spawn(message, "Plasma Pistol", "weap", "weapons\\plasma pistol\\plasma pistol", executor, type) elseif object == "prifle" or object == "plasmarifle" then Spawn(message, "Plasma Rifle", "weap", "weapons\\plasma rifle\\plasma rifle", executor, type) elseif object == "rifle" or object == "arifle" or object == "assaultrifle" then Spawn(message, "Assault Rifle", "weap", "weapons\\assault rifle\\assault rifle", executor, type) elseif object == "rocket" or object == "rocketlauncher" or object == "rox" then Spawn(message, "Rocket Launcher", "weap", "weapons\\rocket launcher\\rocket launcher", executor, type) elseif object == "shotty" or object == "shotgun" then Spawn(message, "Shotgun", "weap", "weapons\\shotgun\\shotgun", executor, type) elseif object == "sniper" then Spawn(message, "Sniper Rifle", "weap", "weapons\\sniper rifle\\sniper rifle", executor, type) else bool = false end if bool then return end end if type ~= "give" then bool = true --Objects with 'vehi' tag if object == "wraith" then Spawn(message, "Wraith", "vehi", "vehicles\\wraith\\wraith", executor, type) elseif object == "peli" or object == "pelican" then Spawn(message, "Pelican", "vehi", "vehicles\\pelican\\pelican", executor, type) elseif object == "ghost" then Spawn(message, "Ghost", "vehi", "vehicles\\ghost\\ghost_mp", executor, type) elseif object == "hog" or object == "warthog" then Spawn(message, "Warthog", "vehi", "vehicles\\warthog\\mp_warthog", executor, type) elseif object == "rhog" or object == "rocketwarthog" then Spawn(message, "Rocket Warthog", "vehi", "vehicles\\rwarthog\\rwarthog", executor, type) elseif object == "shee" or object == "banshee" then Spawn(message, "Banshee", "vehi", "vehicles\\banshee\\banshee_mp", executor, type) elseif object == "tank" or object == "scorpion" then Spawn(message, "Tank", "vehi", "vehicles\\scorpion\\scorpion_mp", executor, type) elseif object == "turret" or object == "shade" then Spawn(message, "Gun Turret", "vehi", "vehicles\\c gun turret\\c gun turret_mp", executor, type) else bool = false end if bool then return end end if bool == false then if type == "give" then sendresponse("Invalid Weapon!", command, executor) elseif type == "enter" then sendresponse("Invalid Vehicle!", command, executor) elseif type == "spawn" then sendresponse("Invalid Object!", command, executor) end end end function Command_Setteleport(executor, command, locname, player, count) if count == 2 then player = tostring(resolveplayer(executor)) elseif count ~= 3 then sendresponse("Invalid Syntax: " .. command .. " [locname] [player]", command, executor) return end local players = getvalidplayers(player, executor) if players then for i = 1,#players do if getobject(getplayerobjectid(players[i])) then response = svcmd("sv_teleport_add " .. tostring(locname), players[i]) if response == nil then say("This command does not work on 057") return end if string.find(response, "corresponds") then sendresponse("Teleport location " .. locname .. " now corresponds to " .. getname(players[i]) .. "'s location!", command, executor) else say(tostring(response)) sendresponse(locname .. " is already added!", command, executor) end else sendresponse("Cannot add teleport because the player is dead.", command, executor) end end else sendresponse("Invalid Player!", command, executor) end end function Command_ShowTeleportList(executor, command, count) if count == 2 then local file = io.open(profilepath .. "\\data\\locations.txt", "r") if file then local map = readtagname(map_addr) local response = "" for line in file:lines() do local count = gettokencount(line, ",") words = {} for i=1,count do local word = gettoken(line, ",", i - 1) word = string.lower(word) table.insert(words, word) end if string.lower(tostring(words[1])) == string.lower(tostring(map)) then if response == "" then response = tostring(words[2]) else response = response .. ", " .. tostring(words[2]) end end end sendresponse("Current teleport locations for this map\n" .. tostring(response), command, executor) else sendresponse("There are no teleports added for this map.", command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Teledelete(executor, command, location, count) if count == 3 then local file = io.open(profilepath .. "\\data\\locations.txt", "r") if file then local bool = false local map = readtagname(map_addr) for line in file:lines() do local count = gettokencount(line, ",") words = {} for i=1,count do local word = gettoken(line, ",", i - 1) word = string.lower(word) table.insert(words, word) end if tostring(words[2]) == tostring(location) and tostring(words[1]) == tostring(map) then bool = true break end end if bool then svcmd("sv_teleport_del " .. tostring(location)) sendresponse("Teleport location " .. tostring(location) .. " has been successfully removed from this map.", command, executor) else sendresponse("Location does not exist on this map!", command, executor) end else sendresponse("There are no teleports added for this map.", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [location]", command, executor) end end function Command_Alias(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do sendresponse(svcmd("sv_alias " .. resolveplayer(players[i]), executor), command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Suspend(executor, command, player, time, count) local players = getvalidplayers(player, executor) if players then for i = 1,#players do if suspend_table[gethash(players[i])] == nil then local m_player = getplayer(players[i]) local player_respawn_time = readdword(m_player, 0x2c) if count == 2 then kill(players[i]) writedword(m_player, 0x2C, 2592000) suspend_table[gethash(players[i])] = 2 sendresponse(getname(players[i]) .. " was suspended by an admin!", command, executor) elseif count == 3 then kill(players[i]) writedword(m_player, 0x2C, time * 30) suspend_table[gethash(players[i])] = 1 if tonumber(time) == 1 then sendresponse(getname(players[i]) .. " was suspended by an admin for " .. time .. " second!", command, executor) else sendresponse(getname(players[i]) .. " was suspended by an admin for " .. time .. " seconds!", command, executor) end else sendresponse("Invalid Syntax: sv_suspend [player] {time}", command, executor) end else sendresponse(getname(players[i]) .. " has already been suspended.", command, executor) end end else sendresponse("Invalid Player!", command, executor) end end function Command_Teleport(executor, command, player, location, count) if count == 3 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local response = svcmd("sv_teleport " .. resolveplayer(players[i]) .. " " .. location, executor) if string.find(response, "valid") then sendresponse("Location '" .. tostring(location) .. "' does not exist for this map!", command, executor) else sendresponse("Teleporting " .. getname(players[i]) .. " to location '" .. location .. "'", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] [location]", command, executor) end end function Command_Teletoplayer(executor, command, player, player2, count) if count == 3 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local name = getname(players[i]) local m_player = getplayer(players[i]) local m_playerObjId = readdword(m_player, 0x34) local m_object = getobject(m_playerObjId) if m_object then local m_vehicle = getobject(readdword(m_object, 0x11C)) local players2 = getvalidplayers(player2, executor) if players2 then if players2[2] == nil and players[i] ~= players2[1] and getobject(getplayerobjectid(players2[1])) then local t_name = getname(players2[1]) local player_x_coord,player_y_coord,player_z_coord = getobjectcoords(getplayerobjectid(players2[1])) if m_vehicle then writefloat(m_vehicle, 0x5C, player_x_coord) writefloat(m_vehicle, 0x60, player_y_coord) writefloat(m_vehicle, 0x64, player_z_coord + 1.5) sendresponse(name .. " was teleported to " .. t_name, command, executor) elseif tonumber(player_z_coord) then movobjcoords(m_playerObjId, player_x_coord, player_y_coord, player_z_coord+1) sendresponse(name .. " was teleported to " .. t_name, command, executor) end elseif getobject(getplayerobjectid(players2[1])) == nil then sendresponse("The player you are trying to teleport to is dead!", command, executor) elseif player[2] then sendresponse("You cannot teleport to multiple people.", command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("The player(s) you are trying to teleport are dead", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] [player]", command, executor) end end function Command_Changeteam(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do changeteam(players[i], false) kill(players[i]) sendresponse(getname(players[i]) .. " has been forced to change teams!", command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end Command_BalanceTeams = function(executor, command, count) if count == 1 then local response = svcmd("sv_teams_balance") sendresponse(tostring(response), command, executor) else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Unhax(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) setscore(players[i], 0) writeword(m_player, 0x9C, 0) writeword(m_player, 0xA4, 0) writeword(m_player, 0xAC, 0) writeword(m_player, 0xAE, 0) writeword(m_player, 0xB0, 0) sendresponse(getname(players[i]) .. " has been unhaxed!", command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Unmute(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(i) if mute_table[hash] or spam_table[hash] ~= 0 then mute_table[hash] = nil spamtimeout_table[hash] = nil spam_table[hash] = 0 sendresponse(getname(players[i]) .. " has been unmuted!", command, executor) else sendresponse(getname(players[i]) .. " has not been muted.", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Uninvis(executor, command, player, count) if count == 2 and tonumber(command) == nil then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(players[i]) if ghost_table[hash] == nil then sendresponse(getname(players[i]) .. " is not invisible!", command, executor) else ghost_table[hash] = nil sendresponse(getname(players[i]) .. " is no longer invisible!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Unsuspend(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) if suspend_table[gethash(players[i])] then writedword(m_player, 0x2C, 0) sendresponse(getname(players[i]) .. " has been unsuspended!", command, executor) else sendresponse(getname(players[i]) .. " has not been suspended.", command, executor) end end else sendresponse("Invalid Player!") end else sendresponse("Invalid Syntax: " .. command .. " [player]") end end function Command_RTVEnabled(executor, command, boolean, count) if count == 1 then if rockthevote then sendresponse("RTV is currently enabled.", command, executor) else sendresponse("RTV is currently disabled.", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and rockthevote ~= true then rockthevote = true if rtv_required == nil then rtv_required = 0.6 end sendresponse("RockTheVote is now enabled! The default percentage needed is 60%.", command, executor) sendresponse("Change this with sv_rtv_needed", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("RockTheVote is already enabled!", command, executor) elseif (boolean ~= "0" and boolean ~= "false") then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and rockthevote then rockthevote = false sendresponse("RockTheVote is now disabled!", command, executor) elseif (boolean == "0" or boolean == "false") then sendresponse("RockTheVote 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_RTVRequired(executor, command, percent, count) if count == 1 then sendresponse(tostring(rtv_required*100) .. "% votes required for RTV") elseif count == 2 and tonumber(percent) then if tonumber(percent) <= 1 then sendresponse("Votes required for RTV has been set to " .. tonumber(percent) * 100 .. "%", command, executor) rtv_required = tonumber(percent) end else sendresponse("Invalid Syntax: " .. command .. " [votes required (as a decimal)]", command, executor) end end function Command_VotekickEnabled(executor, command, boolean, count) if count == 1 then if votekick_allowed then sendresponse("VoteKick is currently enabled.", command, executor) else sendresponse("VoteKick is currently disabled.", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and not votekick_allowed then votekick_allowed = true if votekick_required == nil then votekick_required = 0.7 end sendresponse("VoteKick is now enabled! The default percentage needed is 70%.", command, executor) sendresponse("Change this with sv_votekick_needed", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("VoteKick is already enabled!", command, executor) elseif (boolean ~= "0" and boolean ~= "false") then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and votekick_allowed then votekick_allowed = false sendresponse("VoteKick is now disabled!", command, executor) elseif (boolean == "0" or boolean == "false") then sendresponse("VoteKick 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_VotekickRequired(executor, command, percent, count) if count == 1 then sendresponse(tostring(votekick_required*100) .. "% votes required for VoteKick", command, executor) elseif count == 2 and tonumber(percent) then if tonumber(percent) <= 1 then sendresponse("Votes required for VoteKick has been set to " .. tonumber(percent) * 100 .. "%", command, executor) votekick_required = tonumber(percent) end else sendresponse("Invalid Syntax: " .. command .. " [votes required (as a decimal)]", command, executor) end end function Command_VotekickAction(executor, command, action, count) if count == 1 then sendresponse("The current action for people who are votekicked is '" .. tostring(votekick_action) .. "'", command, executor) sendresponse("Valid actions are 'kick' and 'ban'", command, executor) elseif count == 2 and (action == "kick" or action == "ban") then sendresponse("The current VoteKick action has been changed to '" .. action .. "'", command, executor) votekick_action = tostring(action) else sendresponse("Invalid Syntax: " .. command .. " {action}", command, executor) end end function Command_Hashcheck(executor, command, boolean, count) if count == 1 then if hash_check then sendresponse("Hash Checking is currently on", command, executor) else sendresponse("Hash Checking is currently off", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and hash_check ~= true then hash_check = true writebyte(hashcheck_addr, 0, 0x74) sendresponse("Hash Checking is now enabled!", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("Hash Checking is already enabled!", command, executor) elseif (boolean ~= "0" and boolean ~= "false") then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and hash_check then hash_check = false writebyte(hashcheck_addr, 0, 0xEB) sendresponse("Hash Checking is now disabled!", command, executor) elseif hash_check == nil then hash_check = false writebyte(hashcheck_addr, 0, 0xEB) sendresponse("Hash Checking is now disabled!", command, executor) elseif (boolean == "0" or boolean == "false") then sendresponse("Hash Checking 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_Versioncheck(executor, command, boolean, count) if count == 1 then if version_check then sendresponse("Version Checking is currently on", command, executor) else sendresponse("Version Checking is currently off", command, executor) end elseif count == 2 then if (boolean == "1" or boolean == "true") and version_check ~= true then version_check = true writebyte(versioncheck_addr, 0, 0x7D) sendresponse("Version Checking is now enabled!", command, executor) elseif (boolean == "1" or boolean == "true") then sendresponse("Version Checking is already enabled!", command, executor) elseif (boolean ~= "0" and boolean ~= "false") then sendresponse("Invalid Boolean: 0 for false, 1 for true", command, executor) elseif (boolean == "0" or boolean == "false") and version_check then version_check = false writebyte(versioncheck_addr, 0, 0xEB) sendresponse("Version Checking is now disabled!", command, executor) elseif version_check == nil then version_check = false sendresponse("Version Checking is now disabled!", command, executor) writebyte(versioncheck_addr, 0x0, 0xEB) elseif (boolean == "0" or boolean == "false") and readbyte(versioncheck_addr, 0) == 0xEB then sendresponse("Version Checking 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_Version(executor, command, version, count) if count == 1 then sendresponse("The current version is " .. tostring(Version), command, executor) elseif count == 2 and tonumber(version) then if game == "PC" then local bool if version == "1.00" or version == "00" or version == "0" then Version = "01.00.00.0564" writestring("01.00.00.0564", 0x5DF840) elseif version == "1.01" or version == "01" or version == "1" then Version = "01.00.01.0580" writestring("01.00.01.0580", 0x5DF840) elseif version == "1.02" or version == "02" or version == "2" then Version = "01.00.02.0581" writestring("01.00.02.0581", 0x5DF840) elseif version == "1.03" or version == "03" or version == "3" then Version = "01.00.03.0605" writestring("01.00.03.0605", 0x5DF840) elseif version == "1.04" or version == "04" or version == "4" then Version = "01.00.04.0607" writestring("01.00.04.0607", 0x5DF840) elseif version == "1.05" or version == "05" or version == "5" then Version = "01.00.05.0610" writestring("01.00.05.0610", 0x5DF840) elseif version == "1.06" or version == "06" or version == "6" then Version = "01.00.06.0612" writestring("01.00.06.0612", 0x5DF840) elseif version == "1.07" or version == "07" or version == "7" then Version = "01.00.07.0613" writestring("01.00.07.0613", 0x5DF840) elseif version == "1.08" or version == "08" or version == "8" then Version = "01.00.08.0615" writestring("01.00.08.0615", 0x5DF840) elseif version == "1.09" or version == "09" or version == "9" then Version = "01.00.09.0620" writestring("01.00.09.0620", 0x5DF840) else bool = true end if not bool then sendresponse("Server version has been changed to " .. tostring(Version) .. "!", command, executor) else sendresponse("That is an invalid server version.", command, executor) end elseif tonumber(version) then local bool = true if version == "1.00" or version == "00" or version == "0" then Version = "01.00.00.0609" writestring("01.00.00.0609", 0x564B34) elseif version == "1.01" or version == "01" or version == "1" then Version = "01.00.01.0580" writestring("01.00.01.0580", 0x564B34) elseif version == "1.02" or version == "02" or version == "2" then Version = "01.00.02.0581" writestring("01.00.02.0580", 0x564B34) elseif version == "1.07" or version == "07" or version == "7" then Version = "01.00.07.0613" writestring("01.00.07.0613", 0x564B34) elseif version == "1.08" or version == "08" or version == "8" then Version = "01.00.08.0616" writestring("01.00.08.0616", 0x564B34) elseif version == "1.09" or version == "09" or version == "9" then Version = "01.00.09.0620" writestring("01.00.09.0620", 0x564B34) else bool = true end if not bool then sendresponse("Server version has been changed to " .. tostring(Version) .. "!", command, executor) else sendresponse("That is an invalid server version.", command, executor) end end else sendresponse("Invalid Syntax: " .. command .. " {version}", command, executor) end end function Command_Setcolor(executor, command, player, color, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do sendresponse(getname(players[i]) .. " is currently " .. getcolor(players[i]), command, executor) end else sendresponse("Invalid Player!", command, executor) end elseif count == 3 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_player = getplayer(players[i]) local m_objectId = getplayerobjectid(players[i]) local x,y,z = getobjectcoords(m_objectId) if color == "white" then writebyte(m_player, 0x60, 0) elseif color == "black" then writebyte(m_player, 0x60, 1) elseif color == "red" then writebyte(m_player, 0x60, 2) elseif color == "blue" then writebyte(m_player, 0x60, 3) elseif color == "gray" then writebyte(m_player, 0x60, 4) elseif color == "yellow" then writebyte(m_player, 0x60, 5) elseif color == "green" then writebyte(m_player, 0x60, 6) elseif color == "pink" then writebyte(m_player, 0x60, 7) elseif color == "purple" then writebyte(m_player, 0x60, 8) elseif color == "cyan" then writebyte(m_player, 0x60, 9) elseif color == "cobalt" then writebyte(m_player, 0x60, 10) elseif color == "orange" then writebyte(m_player, 0x60, 11) elseif color == "teal" then writebyte(m_player, 0x60, 12) elseif color == "sage" then writebyte(m_player, 0x60, 13) elseif color == "brown" then writebyte(m_player, 0x60, 14) elseif color == "tan" then writebyte(m_player, 0x60, 15) elseif color == "maroon" then writebyte(m_player, 0x60, 16) elseif color == "salmon" then writebyte(m_player, 0x60, 17) else sendresponse("Invalid Color", command, executor) return end sendresponse(getname(players[i]) .. " had their color changed to " .. color .. "!", command, executor) if m_objectId ~= 0xFFFFFFFF then destroyobject(m_objectId) if colorspawn == nil then colorspawn = {} end if colorspawn[players[i]] == nil then colorspawn[players[i]] = {} end colorspawn[players[i]][1] = x colorspawn[players[i]][2] = y colorspawn[players[i]][3] = z end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player] {color}", command, executor) end end function Command_Boslist(executor, command, count) if count == 1 then sendresponse("[Num Name - Hash - IP]", command, executor) for k,v in pairs(boslog_table) do if v then local words = {} local count = gettokencount(v, ",") for i = 1,count do local word = gettoken(v, ",", i-1) table.insert(words, word) end local name = words[1] local hash = words[2] local ip = words[3] sendresponse("[" .. k .. " " .. name .. " - " .. hash .. " - " .. ip .. "]", command, executor) end end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Overshield(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local m_playerObjId = getplayerobjectid(players[i]) local m_object = getobject(m_playerObjId) if m_object then local m_vehicleId = readdword(m_object, 0x11C) if m_vehicleId == 0xFFFFFFFF then local obj_shields = readfloat(m_object, 0xE4) if obj_shields <= 1 then local x,y,z = getobjectcoords(m_playerObjId) createobject("eqip", "powerups\\over shield", 0, 0, false, x, y, z+0.5) sendresponse(getname(players[i]) .. " has been given an overshield!", command, executor) else sendresponse(getname(players[i]) .. " already has an overshield!", command, executor) end else writefloat(m_object, 0xE4, 3) 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]", command, executor) end end function Command_Info(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local player_number = resolveplayer(players[i]) local m_player = getplayer(players[i]) local hash = gethash(players[i]) local m_playerObjId = readdword(m_player, 0x34) local m_object = getobject(m_playerObjId) if m_object then local player_name = readstring(m_player, 0x4) local player_team = readdword(m_player, 0x20) local player_respawn_time = readdword(m_player, 0x2C) local player_invis_time = readword(m_player, 0x68) local player_speed = readfloat(m_player, 0x6C) local player_objective_mode = readbyte(m_player, 0x74) local player_objective_mode2 = readbyte(m_player, 0x7A) local player_killstreak = readword(m_player, 0x96) local player_kills = readword(m_player, 0x9C) local player_assists = readword(m_player, 0xA4) local player_betrays = readword(m_player, 0xAC) local player_deaths = readword(m_player, 0xAE) local player_suicides = readword(m_player, 0xB0) local player_ping = readword(m_player, 0xDC) local player_x_coord = readfloat(m_player, 0xF8) local player_y_coord = readfloat(m_player, 0xFC) local player_z_coord = readfloat(m_player, 0x100) local obj_max_health = readfloat(m_object, 0xD8) local obj_max_shields = readfloat(m_object, 0xDC) local obj_health = readfloat(m_object, 0xE0) local obj_shields = readfloat(m_object, 0xE4) local obj_flashlight_mode = readbyte(m_object, 0x206) local obj_crouch = readbyte(m_object, 0x2A0) local obj_weap_type = readbyte(m_object, 0x2F2) local obj_nade_type = readbyte(m_object, 0x31C) local obj_primary_nades = readbyte(m_object, 0x31E) local obj_secondary_nades = readbyte(m_object, 0x31F) local obj_flashlight_level = readfloat(m_object, 0x344) local obj_invis_scale = readfloat(m_object, 0x37C) local obj_airborne = readbyte(m_object, 0x4CC) local obj_primary_weap_id = readdword(m_object, 0x2F8) local obj_secondary_weap_id = readdword(m_object, 0x2FC) local primary_weap = getobject(obj_primary_weap_id) local secondary_weap = getobject(obj_secondary_weap_id) local m_vehicle = getobject(readdword(m_object, 0x11C)) if obj_crouch == 1 or obj_crouch == 5 or obj_crouch == 6 or obj_crouch == 13 or obj_crouch == 17 then primary_weap = getobject(readdword(m_vehicle, 0x2F8)) end local primary_weap_heat = readfloat(primary_weap, 0x23C) local primary_weap_age = readfloat(primary_weap, 0x240) local primary_weap_ammo = readword(primary_weap, 0x2B6) local primary_weap_clip = readword(primary_weap, 0x2B8) local secondary_weap_heat = readfloat(secondary_weap, 0x23C) local secondary_weap_age = readfloat(secondary_weap, 0x240) local secondary_weap_ammo = readword(secondary_weap, 0x2B6) local secondary_weap_clip = readword(secondary_weap, 0x2B8) local teamsize = getteamsize(player_team) if player_team == 0 then player_team = "Red" elseif player_team == 1 then player_team = "Blue" else player_team = "Hidden" end if player_objective_mode == 0x22 and player_objective_mode2 == 0x71 then player_objective_mode = "Hill" elseif player_objective_mode == 0x23 and player_objective_mode2 == 0x71 then player_objective_mode = "Juggernaut" elseif player_objective_mode == 0x23 and player_objective_mode2 == 0x72 then player_objective_mode = "It" elseif player_objectivemode == 0x29 and player_objective_mode2 == 0x70 then player_objective_mode = "Ball" else player_objective_mode = "None" end if obj_weap_type == 2 and player_objective_mode == "None" then player_objective_mode = "Flag" end player_respawn_time = round(player_respawn_time / 30, 2) player_invis_time = round(player_invis_time / 30, 2) player_betrays = player_betrays - player_suicides player_x_coord = round(player_x_coord) player_y_coord = round(player_y_coord) player_z_coord = round(player_z_coord) obj_invis_scale = round(obj_invis_scale * 100, 2) if obj_invis_scale == 0 then obj_invis_scale = "No" else obj_invis_scale = obj_invis_scale .. "%" end local invis_info = "Invis: " .. obj_invis_scale if obj_invis_scale ~= "No" then invis_info = "Invis: " .. obj_invis_scale .. " (" .. player_invis_time .. " secs)" end if obj_flashlight_mode == 8 then obj_flashlight_mode = "On" else obj_flashlight_mode = "Off" end obj_flashlight_level = round(obj_flashlight_level * 100) if primary_weap_age == 0 then if primary_weap_ammo ~= 0 or primary_weap_clip ~= 0 then writefloat(primary_weap, 0x240, 1) primary_weap_age = 1 end end if secondary_weap_age == 0 then if secondary_weap_ammo ~= 0 or secondary_weap_clip ~= 0 then writefloat(secondary_weap, 0x240, 1) secondary_weap_age = 1 end end if obj_weap_type == 1 then primary_weap_heat = readfloat(secondary_weap, 0x23C) primary_weap_age = readfloat(secondary_weap, 0x240) primary_weap_ammo = readword(secondary_weap, 0x2B6) primary_weap_clip = readword(secondary_weap, 0x2B8) secondary_weap_heat = readfloat(primary_weap, 0x23C) secondary_weap_age = readfloat(primary_weap, 0x240) secondary_weap_ammo = readword(primary_weap, 0x2B6) secondary_weap_clip = readword(primary_weap, 0x2B8) end primary_weap_heat = round(primary_weap_heat * 100) primary_weap_age = round((1 - primary_weap_age) * 100) secondary_weap_heat = round(secondary_weap_heat * 100) secondary_weap_age = round((1 - secondary_weap_age) * 100) local primary_weap_info = "Primary: Empty" local secondary_weap_info = "Secondary: Empty" if obj_health ~= 0 then if obj_crouch == 1 or obj_crouch == 5 or obj_crouch == 6 or obj_crouch == 13 or obj_crouch == 17 then if primary_weap_age == 100 and primary_weap_ammo == 0 and primary_weap_clip == 0 then primary_weap_info = "Primary: Infinite" else primary_weap_info = "Primary Ammo: " .. primary_weap_clip .. " / " .. primary_weap_ammo end else if primary_weap then if primary_weap_age == 0 then if primary_weap_ammo ~= 0 or primary_weap_clip ~= 0 then primary_weap_info = "Primary Ammo: " .. primary_weap_clip .. " / " .. primary_weap_ammo end else primary_weap_info = "Primary Battery: " .. primary_weap_heat .. "% / " .. primary_weap_age .. "%" end end if secondary_weap then if secondary_weap_age == 0 then if secondary_weap_ammo ~= 0 or secondary_weap_clip ~= 0 then secondary_weap_info = "Secondary Ammo: " .. secondary_weap_clip .. " / " .. secondary_weap_ammo end else secondary_weap_info = "Secondary Battery: " .. secondary_weap_heat .. "% / " .. secondary_weap_age .. "%" end end end end local nade_info = "Frag Grenades: " .. obj_primary_nades .. " | " .. "Plasma Grenades: " .. obj_secondary_nades if obj_nade_type == 1 then nade_info = "Plasma Grenades: " .. obj_secondary_nades .. " | " .. "Frag Grenades: " .. obj_primary_nades end if obj_crouch == 0 then obj_crouch = "Warthog: Driver" elseif obj_crouch == 1 then obj_crouch = "Warthog: Gunner" elseif obj_crouch == 2 then obj_crouch = "Warthog: Passenger" elseif obj_crouch == 3 then obj_crouch = "Stance: Crouching" elseif obj_crouch == 4 then obj_crouch = "Stance: Standing" elseif obj_crouch == 5 then obj_crouch = "Ghost: Driver" elseif obj_crouch == 6 then obj_crouch = "Banshee: Pilot" elseif obj_crouch == 13 then obj_crouch = "Scorpion: Driver" elseif obj_crouch == 17 then obj_crouch = "Shade: Gunner" elseif obj_crouch == 20 or obj_crouch == 21 or obj_crouch == 22 or obj_crouch == 23 then obj_crouch = "Scorpion: Passenger" end if obj_crouch == "Stance: Crouching" or obj_crouch == "Stance: Standing" then if obj_airborne == 1 then obj_crouch = "Stance: Airborne" end end if obj_health == 0 and obj_shields == 0 then obj_crouch = "Stance: Dead" end obj_max_health = round(obj_health * obj_max_health) obj_max_shields = round(obj_shields * obj_max_shields) obj_health = round(obj_health * 100) obj_shields = round(obj_shields * 100) local health_info = "Health: " .. obj_health .. "% (" .. obj_max_health .. ") | " .. "Shields: " .. obj_shields .. "% (" .. obj_max_shields .. ")" if obj_health == 0 and obj_shields == 0 and player_respawn_time ~= 0 then if player_respawn_time == 1 then health_info = "Respawn: " .. player_respawn_time .. " sec" else health_info = "Respawn: " .. player_respawn_time .. " secs" end end if suspend_table[hash] == 2 then health_info = "Respawn: Never" end sendresponse("----------", command, executor) sendresponse("Name: " .. player_name .. " (" .. player_number .. ") | " .. "Team: " .. player_team .. " (" .. teamsize .. ") | " .. "Speed: " .. player_speed .. " | " .. "Location: " .. player_x_coord .. ", " .. player_y_coord .. ", " .. player_z_coord, command, executor) sendresponse("Hash: " .. hash .. " | " .. "Ping: " .. player_ping .. " | " .. obj_crouch, command, executor) sendresponse("Kills: " .. player_kills .. " (" .. player_killstreak .. ") | " .. "Assists: " .. player_assists .. " | " .. "Betrays: " .. player_betrays .. " | " .. "Suicides: " .. player_suicides .. " | " .. "Deaths: " .. player_deaths, command, executor) sendresponse(health_info .. " | " .. invis_info .. " | " .. "Light: " .. obj_flashlight_mode .. " (" .. obj_flashlight_level .. "%)", command, executor) sendresponse(primary_weap_info .. " | " .. secondary_weap_info .. " | " .. "Objective: " .. player_objective_mode, command, executor) sendresponse(nade_info, command, executor) sendresponse("----------", command, executor) else sendresponse("Error! The selected player is dead!", command, executor) end end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_Gethash(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local hash = gethash(players[i]) local name = getname(players[i]) sendresponse(name .. ": " .. hash, command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_getip(executor, command, player, count) if count == 2 then local players = getvalidplayers(player, executor) if players then for i = 1,#players do local id = resolveplayer(players[i]) ip = getip(players[i]) sendresponse(getname(players[i]) .. ": " .. tostring(ip), command, executor) end else sendresponse("Invalid Player!", command, executor) end else sendresponse("Invalid Syntax: " .. command .. " [player]", command, executor) end end function Command_ShowAdminList(executor, command, count) if count == 1 or command == "\\a list" or command == "/a list" then sendresponse("Showing both IP Admins and Hash Admins.", command, executor) sendresponse("[Num] - Name: level - Admin types", command, executor) 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] = {"hash", "notip", 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] = {"nothash", "ip", level} end end for k,v in pairs(admins) do local message = "" if admins[k][1] == "hash" and admins[k][2] == "ip" then message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - Hash admin IP Admin" elseif admins[k][1] == "hash" then message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - Hash admin" elseif admins[k][2] == "ip" then message = "[" .. x .. "] " .. k .. " - " .. admins[k][3] .. " - IP Admin" end x = x + 1 sendresponse(message, command, executor) end else sendresponse("Invalid Syntax: " .. command, command, executor) end end function Command_Help(executor, command, cmd, count) for i = 1,#commands_table do if commands_table[i] then if string.find(commands_table[i], cmd) then sendresponse(GetHelp(commands_table[i]), command, executor) end end end end function Command_Launch(executor, command, player, count) if count == 2 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_vehicleId = readdword(m_object, 0x11C) local m_vehicle = getobject(m_vehicleId) if m_vehicle then sendresponse(getname(players[i]) .. " has been launched!", command, executor) local tagName = getobjecttag(m_vehicleId) writebit(m_vehicle, 0x10, 2, 0) if tagName == "vehicles\\scorpion\\scorpion_mp" then writefloat(m_vehicle, 0x94, 15) writefloat(m_vehicle, 0x70, 0.35) writefloat(m_vehicle, 0x6C, 0.35) elseif tagName == "vehicles\\banshee\\banshee_mp" then writefloat(m_vehicle, 0x90, 30) writefloat(m_vehicle, 0x70, 0.35) writefloat(m_vehicle, 0x6C, -0.4) elseif tagName == "vehicles\\ghost\\ghost_mp" then writefloat(m_vehicle, 0x8C, 7) writefloat(m_vehicle, 0x70, 0.35) elseif tagName == "vehicles\\warthog\\mp_warthog" then writefloat(m_vehicle, 0x94, 10) writefloat(m_vehicle, 0x70, 0.35) elseif tagName == "vehicles\\rwarthog\\rwarthog" then writefloat(m_vehicle, 0x94, 15) writefloat(m_vehicle, 0x70, 0.35) else writefloat(m_vehicle, 0x94, 10) writefloat(m_vehicle, 0x70, 0.35) end else sendresponse(getname(players[i]) .. " is not in a vehicle!", 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]", command, executor) end end function GetHelp(command) if t[2] == "sv_admin_add" then hprintf("Syntax: sv_admin_add [player] [nickname] [level]") hprintf("Adds a player to the admin list.") elseif t[2] == "sv_setammo" then hprintf("Syntax: sv_setammo [player] [ammo]") hprintf("Sets the player's primary weapon's ammo. Use * for all players.") elseif t[2] == "ban" then hprintf("Syntax: sv_ban [player] {time}") hprintf("Bans a player indefinitely, or for the time specified.") elseif t[2] == "sv_deathless" then hprintf("Syntax: sv_deathless [boolean]") hprintf("Will set the game so no one can die. 0 for off, 1 for on.") hprintf("Using 'heal' will override this, however") elseif t[2] == "e" then hprintf("Syntax: sv_e [Command]") hprintf("This will execute any command that you would normally put in the console.") hprintf("This is also used more commonly to tell if the script is working.") hprintf("Or if a player has admin.") elseif t[2] == "eject" then hprintf("Syntax: sv_eject [player]") hprintf("Ejects a player. Use * for all players.") elseif t[2] == "enter" then hprintf("Syntax: sv_enter [player] [seat]") hprintf("Will cause you to enter the player's vehicle, and the seat specified.") elseif t[2] == "getloc" then hprintf("Syntax: sv_getloc [player]") hprintf("Will display the location of the player specified.") elseif t[2] == "godmode" then hprintf("Syntax: sv_godmode [player]") hprintf("Will make this person unkillable. Backtaps, however, will still kill them.") elseif t[2] == "hax" then hprintf("Syntax: sv_hax") hprintf("I made this command because I was bored.") elseif t[2] == "heal" then hprintf("Syntax: sv_heal [player]") hprintf("Will heal the specified player.") elseif t[2] == "help" then hprintf("Syntax: sv_help [Command]") hprintf("Will provide details on any specified command.") hprintf("Do not include sv_ or \ for the [Command]") elseif t[2] == "hitler" then hprintf("Syntax: sv_hitler") hprintf("Will lethaly inject everyone.") elseif t[2] == "infammo" then hprintf("Syntax: sv_infinite_ammo [boolean]") hprintf("Will set the game so everyone has infinite ammo. 0 for off, 1 for on") elseif t[2] == "give" then hprintf("Syntax: sv_give [weapon] {player}") hprintf("Will give yourself, or the person specified, a weapon.") hprintf("You can hold up to 4 weapons. If you are holding 4 weapons,") hprintf("you cannot pickup the flag, or the oddball.") elseif t[2] == "gethash" then hprintf("Syntax: sv_gethash [player]") hprintf("This will get the hash of the player specified.") elseif t[2] == "invis" then hprintf("Syntax: sv_invis [player] {time}") hprintf("This will camouflage the person specified for the amount of time specified.") elseif t[2] == "j" then hprintf("Syntax: sv_j [player] [x] [y] [z]") hprintf("Moves the specified player by coords specified.") elseif t[2] == "k" then hprintf("Syntax: sv_k [player]") hprintf("Will kick the player specified.") elseif t[2] == "kill" then hprintf("Syntax: sv_kill [player]") hprintf("Will kill the player specified.") elseif t[2] == "lo3" then hprintf("Syntax: sv_lo3") hprintf("Will lo3 the game.") elseif t[2] == "m" then hprintf("Syntax: sv_m [map] [gametype] {script} {script2} . . .") hprintf("Will load the map specified. No need to specify chatcommands script.") elseif t[2] == "mc" then hprintf("Syntax: sv_mc") hprintf("Starts the mapcycle.") elseif t[2] == "mnext" then hprintf("Syntax: sv_mnext") hprintf("Loads the next map in the mapcycle.") elseif t[2] == "mute" then hprintf("Syntax: sv_mute [player] {time}") hprintf("Mutes the player. Admins cannot be muted.") elseif t[2] == "pass" then hprintf("Syntax: sv_pass [password]") hprintf("Sets the server password.") elseif t[2] == "reset" then hprintf("Syntax: sv_reset") hprintf("Resets the map.") elseif t[2] == "resp" then hprintf("Syntax: sv_resp [player] [time]") hprintf("Sets respawn time of player. Only works if player is dead.") elseif t[2] == "say" then hprintf("Syntax: sv_say [message]") hprintf("Will say something as the server. No quotes needed.") elseif t[2] == "sc" then hprintf("Syntax: sv_sc [player] [nickname]") hprintf("Will set the player's nickname. Used instead of player IDs") elseif t[2] == "setassists" then hprintf("Syntax: sv_setassists [player] [# of assists]") hprintf("Will set the assists of the player specified.") elseif t[2] == "setdeaths" then hprintf("Syntax: sv_setdeaths [player] [# of deaths]") hprintf("Will set the deaths of the player specified.") elseif t[2] == "setfrags" then hprintf("Syntax: sv_setfrags [player] [# of frags]") hprintf("Will set the # of frag grenades of the player specified.") elseif t[2] == "setkills" then hprintf("Syntax: sv_setkills [player] [# of kills]") hprintf("Will set the kills of the player specified.") elseif t[2] == "setname" then hprintf("Syntax: sv_setname [player] [name]") hprintf("Sets the name of the player specified.") hprintf("You will only notice a difference on rejoin.") elseif t[2] == "setresp" then hprintf("Syntax: sv_respawn_time [time]") hprintf("Sets the universal respawn time of all maps.") elseif t[2] == "setplasmas" then hprintf("Syntax: sv_setplasmas [player] [# of plasma grenades]") hprintf("Will set the plasma grenades of the player specified.") elseif t[2] == "spd" then hprintf("Syntax: sv_setspeed [player] [speed]") hprintf("Will set the speed of the player specified.") elseif t[2] == "spawn" then hprintf("Syntax: sv_spawn [object] {player} {ammount} {resptime} {recycle}") hprintf("Will spawn a object over a player if specified.") elseif t[2] == "st" then hprintf("Syntax: sv_teleport_add [location]") hprintf("Will set a teleport location to wherever you're standing.") elseif t[2] == "suspend" then hprintf("Syntax: sv_suspend [player] {time}") hprintf("Will suspend the player for the time specified.") elseif t[2] == "t" then hprintf("Syntax: sv_teleport [player] [location]") hprintf("Will teleport the player specified to the location specified.") elseif t[2] == "td" then hprintf("Syntax: sv_teleport_del [location]") hprintf("Will delete the teleport location specified.") elseif t[2] == "test" then hprintf("Syntax: sv_test [player]") hprintf("I use this to test the returns of some addresses and offsets.") elseif t[2] == "tp" then hprintf("Syntax: sv_teleport_pl [player] [t_player]") hprintf("Will teleport player to t_player") elseif t[2] == "ts" then hprintf("Syntax: sv_changeteam [player]") hprintf("Will switch the players team.") elseif t[2] == "unhax" then hprintf("Syntax: sv_unhax") hprintf("Unhax's you. I was bored, what can i say?") elseif t[2] == "unmute" then hprintf("Syntax: sv_unmute [player]") hprintf("Unmutes the player specified.") elseif t[2] == "unsuspend" then hprintf("Syntax: sv_unsuspend [player]") hprintf("Unsuspends the player specified.") elseif t[2] == "credits" then hprintf("Created by [DWM]Wizard") hprintf("Base script created by Smiley") else hprintf("Invalid Command! Use sv_list for list of commands!") end end --[[ LUA LANES STUFF -- I think there's a bug with LuaLanes. All functions called from the lane should be declared as local. ----------------------------------------------------------------------------------------------------------- --]] lanes_reported_error = false env = nil con = nil -- These two functions are used for communicating between the threads function sendNotificationToWorker(command, data) if command == nil or data == nil then return end linda:send("command", command) linda:send("data", data) end -- Notifies the worker thread that it needs to close function cleanupLanes() sendNotificationToWorker("cleanup", "unused") while (worker.status == "running" or worker.status == "waiting") do end end -- Executes the specified function if it exists in the global table -- Credits to [SC]Nuggets function exec(func, ...) if type(_G[func]) == "function" then return 1, _G[func](...) end end -- Processes the output from the worker function m_getstats(data) hprintf("main: getstats reply received :)") end function WorkerThread() hprintf("********TEST************") -- http = require("http.tcp") -- Executes the specified function if it exists in the global table -- Credits to [SC]Nuggets function exec(func, ...) if type(_G[func]) == "function" then return 1, _G[func](...) end end function CheckForUpdate() results = http.request("http://dl.dropbox.com/u/32815290/update.txt") if results[1] ~= 0 then if results[2] == 200 then if results[3] ~= script_version then sendNotificationToBoss("hprintf", "There is an updated commands script. Get it from wizard. Xfire: th3w1zard3") needsupdate = true end end end end -- Sends a message to the main thread function sendNotificationToBoss(command, data) if command == nil or data == nil then return end linda:send("outcommand", command) linda:send("outdata", data) end ------------------------------------------------------------------------- -- BEGIN PROCESSING CODE ------------------------------------------------------------------------- while true do -- loop until we're told to stop local data = linda:receive(1, "data") -- this will wait until there is a command to do local command = linda:receive(1, "command") if (command == "cleanup") then break else exec(command, data) end CheckForUpdate() end return 0 end -- Called every ~100ms by the main thread to check on the worker function CheckWorker(id, count) if (lanes_reported_error == false and worker.status == "error") then hprintf("There was an error in the worker thread.") v,err= worker:join() -- no propagation hprintf(err) return 0 -- no point continuing end local data = linda:receive(0, "outdata") if data == nil then return 1 end local command = linda:receive(0, "outcommand") hprintf("data: " .. data .. " command: " .. command) exec(command, data) return 1 -- repeat end