Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Commands by: Skylace
- -- Website: bud.boards.net
- -- Thanks to Kennan & others for helping making and testing this script.
- -- PUBLIC VERSION 1.3.4
- ------------------------------------------------------------------------------------------
- -------------------------------------- [[Presets]] ---------------------------------------
- ------------------------------------------------------------------------------------------
- -- This will ban players trying to use a bruteforcer to find your rcon since the the server
- -- does not validate hashes while running this script.
- rcon_fails_to_ban = 5
- rtv_enabled = true -- Enables map skipping
- rtv_needed = 0.65 -- amount needed to skip 1 = 100% 0.50 = 50%
- votekick_enabled = false -- Enables votekick
- votekick_needed = 0.7 -- Amount needed to kick 1 = 100% 0.50 = 50%
- votekick_timeout = 5 -- Minutes
- fall_damage = true -- Turn fall damage on or off.
- -- This will count how many unique names have joined the server while the script has been loaded.
- unique_counter = true
- -- Welcome back message (Tells players their number of visits under a specific name.)
- welcome_back_msg = false
- -- Should we allow players on the same ip or hash to connect to the server at the same time?
- allow_ip_duplicates = true
- allow_hash_duplicates = true
- ------------------------------------------------------------------------------------------
- --------------------------------- [[Tables (Don't Touch)]] -------------------------------
- ------------------------------------------------------------------------------------------
- rtvcount = 0
- kickcount = 0
- unique_count = 0
- vname = nil
- vindex = nil
- players = {}
- hidden = {}
- rtved = {}
- kills = {}
- deaths = {}
- votekick = {}
- voted = {}
- dyslexic = {}
- bannedips = {}
- ipadmin = {}
- haxed = {}
- uniques = {}
- failedrcons = {}
- forcedentry = {}
- commands = {
- {"sv_setammo"},{"sv_setscore"},{"sv_setassists"},{"sv_setdeaths"},{"sv_setkills"},
- {"sv_dyslexic"},{"sv_undyslexic"},{"sv_pl"},{"sv_hax"},{"sv_unhax"},{"sv_kil"},
- {"sv_ipbanlist"},{"sv_ipunban"},{"sv_ipban"},{"sv_god"},{"sv_ungod"},{"sv_ghost"},
- {"sv_unghost"},{"sv_hide"},{"sv_unhide"},{"sv_teamswap"},{"sv_spawn"},{"sv_give"},
- {"sv_enter"}
- }
- ------------------------------------------------------------------------------------------
- ---------------------------------- [[Main Function(s)]] ----------------------------------
- ------------------------------------------------------------------------------------------
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(processId, game, persistent)
- GetGameAddresses(game)
- getTagIds()
- savetables()
- log_file = getprofilepath() .. "\\logs\\commands.log"
- svcmd("sv_admin_check false") -- This will let the script work.
- if allow_hash_duplicates then
- writebit(hash_duplicate_patch, 0, 0)
- else
- writebit(hash_duplicate_patch, 0, 1)
- end
- end
- function OnNewGame(map)
- rtvactive = false
- kickactive = false
- readtables()
- getTagIds()
- end
- function OnScriptUnload()
- savetables()
- end
- function OnGameEnd(stage)
- if stage == 2 then
- savetables()
- end
- haxedtimer = false
- -- stage 1: F1 Screen
- -- stage 2: PGCR Appears
- -- stage 3: Players may quit
- end
- function readtables()
- uniques = table.load("uniques.data")
- kills = table.load("kills.data")
- deaths = table.load("deaths.data")
- bannedips = table.load("bannedips.data")
- ipadmin = table.load("ipadmins.data")
- end
- function savetables()
- table.save(uniques, "uniques.data")
- table.save(kills, "kills.data")
- table.save(deaths, "deaths.data")
- table.save(bannedips, "bannedips.data")
- table.save(ipadmin, "ipadmins.data")
- end
- function OnServerChat(player, type, message)
- local allowchat = true
- if player then
- local name = getname(player)
- if dyslexic[name] then
- newmsg = getnewmessage(message)
- allowchat = true, newmsg
- end
- local t = tokenizecmdstring(message)
- if (string.sub(message, 1, 1) == "\\" or string.sub(message, 1, 1) == "/") then
- local ip = getip(player)
- if isadmin(player) == true or ipadmin[ip] == true then
- allowchat = false
- newcommands(message, player)
- else
- allowchat = false
- local line = "(Non-Admin User: %s) (Attempted Command: %s)"
- local Line = string.format(line, getname(player), message)
- WriteLog(log_file, Line)
- --sendconsoletext(player, "You are not an admin!!! This incident has been reported!")
- end
- else
- local chatlog = getprofilepath() .. "\\logs\\chatlog.log"
- local line = "(User: %s) (Message: %s)"
- local Line = string.format(line, getname(player), message)
- WriteLog(chatlog, Line)
- end
- if t[1] == "\\stats" or t[1] == "/stats" then
- if tonumber(deaths[name]) ~= nil then else deaths[name] = 0 end
- if tonumber(kills[name]) ~= nil then else kills[name] = 0 end
- privatesay(player, "Overall stats for this server.")
- privatesay(player, "Kills: " .. kills[name])
- privatesay(player, "Deaths: " .. deaths[name])
- privatesay(player, "K/D Ratio: " .. getplayerkdr(player))
- allowchat = false
- elseif t[1] == "\\info" or t[1] == "/info" then
- local server_name = readwidestring(network_struct + 0x8, 0x42)
- local svmap = readstring(network_struct + 0x8C, 0x80)
- local svgt = readwidestring(network_struct + 0x10C, 0x18)
- local curplayers = readword(network_struct + (0x1A8+ce))
- local maxplayers = readbyte(network_struct + (0x1A5+ce))
- if curplayers ~= nil then else curplayers = 0 end
- privatesay(player, "Server Name: " .. tostring(server_name))
- privatesay(player, "Map: " .. tostring(svmap) .. " Gametype: " .. tostring(svgt))
- privatesay(player, "Players: " .. tonumber(curplayers) .. "/" .. tonumber(maxplayers))
- allowchat = false
- elseif t[1] == "\\lead" or t[1] == "/lead" then
- privatesay(player, "This server does not have nolead!")
- privatesay(player, "You have to lead now!")
- allowchat = false
- end
- if t[1] == "rtv" or t[1] == "skip" then
- local needed = math.ceil(getteamsize(0) + getteamsize(1) / rtv_needed)
- if not rtvactive then
- rtvactive = true
- if not rtved[name] then
- rtved[name] = true
- say(name .. " has voted to skip the map! Type 'rtv' or 'skip' in chat to join.")
- if rtvcount then
- rtvcount = tonumber(rtvcount) + 1
- if rtvcount >= needed then
- say("Enough votes to skip the map. The game will now end!")
- svcmd("sv_map_next")
- else
- say(rtvcount .. " / " .. needed.. " votes needed to skip the current map!")
- end
- else
- rtvcount = 1
- end
- else
- privatesay(player, "You have already voted to skip the map!")
- end
- else
- if not rtved[name] then
- say(name .. " has voted to skip the map! Type 'rtv' or 'skip' in chat to join.")
- rtved[name] = true
- if rtvcount then
- rtvcount = rtvcount + 1
- if rtvcount >= needed then
- say("Enough votes to skip the map. The game will now end!")
- svcmd("sv_map_next")
- else
- say(rtvcount .. " / " .. needed.. " votes needed to skip the current map!")
- end
- else
- rtvcount = 1
- end
- else
- privatesay(player, "You have already voted to skip the map!")
- end
- end
- allowchat = false
- elseif t[1] == "votekick" or t[1] == "kick" then
- allowchat = false
- local needed = math.ceil(getteamsize(0) + getteamsize(1) / votekick_needed)
- if not kickactive then
- if t[2] ~= nil then
- for i = 0,15 do
- if getplayer(i) ~= nil then
- if tonumber(t[2]) ~= nil then
- if rresolveplayer(t[2]) == i then
- votekick[getname(i)] = true
- voted[name] = true
- kickactive = true
- kickcount = 1
- say(name .. " has started a votekick on " .. getname(i) .. "! Type 'votekick' or 'kick' in chat to join.")
- vname = getname(i)
- registertimer(votekick_timeout*60*1000, "vktimeout", i)
- else
- privatesay(player, "Invalid Player! Must use number or full name!")
- end
- elseif tostring(t[2]) ~= nil then
- if t[2] == getname(i) then
- votekick[getname(i)] = true
- voted[name] = true
- kickactive = true
- kickcount = 1
- say(name .. " has started a votekick on " .. getname(i) .. "! Type 'votekick' or 'kick' in chat to join.")
- vname = getname(i)
- vindex = i
- registertimer(votekick_timeout*60*1000, "vktimeout", i)
- else
- privatesay(player, "Invalid Player! Must use number or full name!")
- end
- else
- privatesay(player, "Invalid Player! Must use number or full name!")
- end
- end
- end
- end
- else
- if t[2] == nil then
- if kickactive then
- if not voted[name] then
- say(name .. " has voted to kick " .. vname)
- if kickcount then
- kickcount = kickcount + 1
- if kickcount >= needed then
- say("Enough votes to kick " .. vname .. "!")
- svcmd("sv_kick " .. resolveplayer(vindex))
- kickactive = false
- kickcount = 0
- vname = nil
- vindex = nil
- else
- say(kickcount .. " / " .. needed .. " votes to kick " .. vname .. "!")
- end
- else
- kickcount = 1
- end
- else
- privatesay(player, "You have already voted to kick " .. vname .. ".")
- end
- else
- privatesay(player, "A votekick has not been called.")
- end
- end
- end
- end
- end
- return allowchat
- end
- function vktimeout(idk, idk1, player)
- if kickactive then
- if getplayer(player) ~= nil then
- say("The votekick on " .. vname .. " is no longer active!")
- kickactive = false
- kickcount = 0
- vname = nil
- vindex = nil
- else
- say("The votekick on " .. vname .. " is no longer active!")
- kickactive = false
- kickcount = 0
- vname = nil
- vindex = nil
- end
- end
- end
- function OnServerCommandAttempt(player, command, password)
- local allow = false
- local real = true
- local ip = getip(player)
- if isadmin(player) == true or ipadmin[ip] == true then
- allow = true
- if string.sub(command, 0,3) ~= "cls" then
- if "sv_" ~= string.sub(command, 0,3) then
- command = "sv_" .. command
- end
- end
- local t = tokenizecmdstring(command)
- for i=1,#commands do
- if t[1] == commands[i][1] then
- real = false
- end
- end
- if real == false then
- newcommands(command, player)
- allow = false
- end
- else
- allow = false
- sendconsoletext(player, "Incorrect Rcon!")
- if failedrcons[ip] then
- failedrcons[ip] = tonumber(failedrcons[ip]) + 1
- if tonumber(failedrcons[ip]) < 2 then -- warning level
- privatesay(player, "WARNING!!! Failed RCON attempt number: " .. tonumber(failedrcons[ip]) .. " Your next attempt may result in a ban!")
- if tonumber(failedrcons[ip]) <= rcon_fails_to_ban then
- svcmd("sv_ban " .. resolveplayer(player) .. " 1d")
- end
- end
- else
- failedrcons[ip] = 1
- end
- end
- return allow
- end
- function OnServerCommand(player, command)
- local allow = true
- local real = true
- if string.sub(command, 0,3) ~= "cls" then
- if "sv_" ~= string.sub(command, 0,3) then
- command = "sv_" .. command
- end
- end
- local t = tokenizecmdstring(command)
- for i=1,#commands do
- if t[1] == commands[i][1] then
- real = false
- end
- end
- if real == false then
- newcommands(command, player)
- allow = false
- end
- return allow
- end
- function OnPlayerJoin(player)
- local name = getname(player)
- local hash = gethash(player)
- local ip = getip(player)
- rtved[name] = false
- for x = 1,#bannedips do
- if ip == bannedips[x][1] and bannedips[x][2] == true then
- Ipban(player)
- end
- end
- for i = 0,15 do
- if getplayer(i) ~= nil then
- if not allow_ip_duplicates then
- if getip(i) == ip then
- kick(player)
- end
- end
- end
- end
- if kills[name] then else kills[name] = 0 end
- if deaths[name] then else deaths[name] = 0 end
- if unique_counter then
- if not uniques[name] then
- uniques[name] = 1
- unique_count = tonumber(unique_count) + 1
- say(name .. " is unique player #" .. unique_count)
- else
- if welcome_back_msg then
- uniques[name] = tonumber(uniques[name]) + 1
- privatesay(player, "Welcome back to the server " .. name .. "! You have been here " .. tonumber(uniques[name]) .. " times.")
- end
- end
- end
- end
- function tokenizestring(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- function OnPlayerLeave(player)
- end
- function OnVehicleEntry(player, vehiId, seat, mapId, voluntary)
- if not voluntary then
- forcedentry[player] = true
- else
- forcedentry[player] = false
- end
- end
- function OnVehicleEject(player, voluntary)
- if forcedentry[player] then
- destroyobject(getplayerobjectid(player)) -- Destroys vehicles spawned by phasor if a player decides to leave it (should prevent the server from crashing on maps that should not have vehicles.)
- forcedentry[player] = false
- end
- end
- function OnDamageLookup(receiving, causing, tagid, tagdata)
- if fall_damage == false then
- local tagname = gettaginfo(tagid)
- if (tagname == "globals\\falling" or tagname == "globals\\distance") then
- odl_multiplier(0.001)
- end
- end
- end
- function OnPlayerKill(killer, victim, mode)
- if mode == 0 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 1 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 2 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 3 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 4 then
- if victim then
- local name = getname(victim)
- local kname = getname(killer)
- if kills[kname] then
- kills[kname] = tonumber(kills[kname]) + 1
- else
- kills[kname] = 1
- end
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 5 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- elseif mode == 6 then
- if victim then
- local name = getname(victim)
- if deaths[name] then
- deaths[name] = tonumber(deaths[name]) + 1
- else
- deaths[name] = 1
- end
- end
- end
- end
- function OnClientUpdate(player)
- local m_player = getplayer(player)
- if hidden[player] == true then
- writefloat(m_player + 0x100, -1000)
- end
- end
- ------------------------------------------------------------------------------------------
- -------------------------------------- [[Commands]] --------------------------------------
- ------------------------------------------------------------------------------------------
- function newcommands(command, player)
- local t = tokenizecmdstring(command)
- if player ~= nil then
- if t[1] == "\\e" or t[1] == "/e" then
- if t[2] ~= nil then
- svcmd(command)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: e [command] {arguments}")
- end
- elseif t[1] == "\\b" or t[1] == "/b" then
- if tonumber(t[2]) ~= nil then
- svcmd("sv_ban " .. t[2])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: b [number]")
- end
- elseif t[1] == "\\k" or t[1] == "/k" then
- if tonumber(t[2]) ~= nil then
- svcmd("sv_kick " .. t[2])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: k [number]")
- end
- elseif t[1] == "\\setscore" or t[1] == "/setscore" or t[1] == "sv_setscore" then
- if t[3] ~= nil then
- command_setscore(player, t[2], t[3])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: setscore [player] [amount]")
- end
- elseif t[1] == "\\setkills" or t[1] == "/setkills" or t[1] == "sv_setkills" then
- if t[3] ~= nil then
- command_setkills(player, t[2], t[3])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: setkills [player] [amount]")
- end
- elseif t[1] == "\\setassists" or t[1] == "/setassists" or t[1] == "sv_setassists" then
- if t[3] ~= nil then
- command_setassists(player, t[2], t[3])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: setassists [player] [amount]")
- end
- elseif t[1] == "\\setdeaths" or t[1] == "/setdeaths" or t[1] == "sv_setdeaths" then
- if t[3] ~= nil then
- command_setdeaths(player, t[2], t[3])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: setdeaths [player] [amount]")
- end
- elseif t[1] == "\\setammo" or t[1] == "/setammo" or t[1] == "sv_setammo" then
- if t[4] ~= nil then
- command_setdeaths(player, t[2], t[3], t[4])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: setammo [player] [type] [amount]")
- end
- elseif t[1] == "\\hide" or t[1] == "/hide" or t[1] == "sv_hide" then
- if t[2] ~= nil then
- command_hide(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: hide [player]")
- end
- elseif t[1] == "\\unhide" or t[1] == "/unhide" or t[1] == "sv_unhide" then
- if t[2] ~= nil then
- command_hide(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: unhide [player]")
- end
- elseif t[1] == "\\ghost" or t[1] == "/ghost" or t[1] == "sv_ghost" then
- if t[2] ~= nil then
- command_ghost(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: ghost [player]")
- end
- elseif t[1] == "\\unghost" or t[1] == "/unghost" or t[1] == "sv_unghost" then
- if t[2] ~= nil then
- command_ghost(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: unghost [player]")
- end
- elseif t[1] == "\\god" or t[1] == "/god" or t[1] == "sv_god" then
- if t[2] ~= nil then
- command_god(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: god [player]")
- end
- elseif t[1] == "\\ungod" or t[1] == "/ungod" or t[1] == "sv_ungod" then
- if t[2] ~= nil then
- command_god(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: ungod [player]")
- end
- elseif t[1] == "\\spawn" or t[1] == "/spawn" or t[1] == "sv_spawn" then
- if t[2] ~= nil and t[3] ~= nil then
- command_spawngiveenter(player, t[2], t[3], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: spawn [object] [player]")
- end
- elseif t[1] == "\\enter" or t[1] == "/enter" or t[1] == "sv_enter" then
- if t[2] ~= nil and t[3] ~= nil then
- command_spawngiveenter(player, t[2], t[3], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: enter [vehicle] [player]")
- end
- elseif t[1] == "\\give" or t[1] == "/give" or t[1] == "sv_give" then
- if t[2] ~= nil and t[3] ~= nil then
- command_spawngiveenter(player, t[2], t[3], 2)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: give [weapon or powerup] [player]")
- end
- elseif t[1] == "\\dyslexic" or t[1] == "/dyslexic" or t[1] == "sv_dyslexic" then
- if t[2] ~= nil then
- command_dyslexic(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: dyslexic [player]")
- end
- elseif t[1] == "\\undyslexic" or t[1] == "/undyslexic" or t[1] == "sv_undyslexic" then
- if t[2] ~= nil then
- command_dyslexic(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: undyslexic [player]")
- end
- elseif t[1] == "\\ipban" or t[1] == "/ipban" or t[1] == "sv_ipban" then
- if t[2] ~= nil then
- command_ipban(player, t[2], t[3], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: ipban [player] {Reason-Use-Dashes-Reason}")
- end
- elseif t[1] == "\\unipban" or t[1] == "/unipban" or t[1] == "sv_unipban" then
- if t[2] ~= nil then
- command_ipban(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: unipban [ip]")
- end
- elseif t[1] == "\\ipbanlist" or t[1] == "/ipbanlist" or t[1] == "sv_ipbanlist" then
- if t[2] == nil then
- command_ipban(player, nil, 2)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: ipbanlist")
- end
- elseif t[1] == "\\ghost" or t[1] == "/ghost" or t[1] == "sv_ghost" then
- if t[2] ~= nil then
- command_ghost(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: ghost [player]")
- end
- elseif t[1] == "\\unghost" or t[1] == "/unghost" or t[1] == "sv_unghost" then
- if t[2] ~= nil then
- command_ghost(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: unghost [player]")
- end
- elseif t[1] == "\\falldamage" or t[1] == "/falldamage" or t[1] == "sv_falldamage" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (Mode: %s)"
- local Line = string.format(line, getname(player),"falldamage", t[2])
- WriteLog(log_file, Line)
- if tonumber(t[2]) == 1 or t[2] == "true" then
- fall_damage = true
- sendconsoletext(player, "Fall damage = On")
- elseif tonumber(t[2]) == 0 or t[2] == "false" then
- fall_damage = false
- sendconsoletext(player, "Fall damage = Off")
- else
- sendconsoletext(player, "Invalid usage.")
- end
- end
- elseif t[1] == "\\ipadmin_add" or t[1] == "/ipadmin_add" or t[1] == "sv_ipadmin_add" then
- if tonumber(t[2]) ~= nil then
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(player),"ipadmin_add", t[2])
- WriteLog(log_file, Line)
- if getplayer(t[2]) ~= nil then
- local ip = getip(t[2])
- ipadmin[ip] = true
- sendconsoletext(player, getname(t[2]) .. " is now an ip admin.")
- else
- sendconsoletext(player, "Invalid Player.")
- end
- else
- sendconsoletext(player, "You must use the players number.")
- end
- elseif t[1] == "\\ipadmin_del" or t[1] == "/ipadmin_del" or t[1] == "sv_ipadmin_del" then
- if tonumber(t[2]) ~= nil then
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(player),"ipadmin_del", t[2])
- WriteLog(log_file, Line)
- if getplayer(t[2]) ~= nil then
- local ip = getip(t[2])
- ipadmin[ip] = false
- sendconsoletext(player, getname(t[2]) .. " is no longer an ip admin.")
- else
- sendconsoletext(player, "Invalid Player.")
- end
- else
- sendconsoletext(player, "You must use the players number.")
- end
- elseif t[1] == "\\pl" or t[1] == "/pl" or t[1] == "sv_pl" then
- sendconsoletext(player, "Number - Name")
- for i = 0,15 do
- if getplayer(i) ~= nil then
- sendconsoletext(player, resolveplayer(i) .. " - " .. getname(i))
- end
- end
- elseif t[1] == "\\spd" or t[1] == "/spd" then
- if t[2] ~= nil then
- local players = getvalidplayers(t[2], player)
- if t[3] ~= nil then
- if players then
- for i = 1,#players do
- local line = "(User: %s) (Command: %s) (Player: %s) (Speed: %s)"
- local Line = string.format(line, getname(player),"spd", t[2], t[3])
- WriteLog(log_file, Line)
- svcmd("sv_setspeed " .. resolveplayer(players[i]) .. " " .. t[3])
- sendconsoletext(player, getname(players[i]) .. "'s speed has been set to " .. t[3])
- end
- else
- sendconsoletext(player, "Invlaid Player")
- end
- else
- sendconsoletext(player, "You must specify a new speed.")
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- elseif t[1] == "\\votekick_enbled" or t[1] == "/votekick_enabled" or t[1] == "sv_votekick_enabled" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (Mode: %s)"
- local Line = string.format(line, getname(player),"votekick_enabled", t[2])
- WriteLog(log_file, Line)
- if tonumber(t[2]) == 1 or t[2] == "true" then
- votekick_enabled = true
- sendconsoletext(player, "Votekicking has been enabled.")
- elseif tonumber(t[2]) == 0 or t[2] == "false" then
- votekick_enabled = false
- sendconsoletext(player, "Votekicking has been disabled.")
- else
- sendconsoletext(player, "Invlaid option.")
- end
- sendconsoletext(player, "Invalid syntax: votekick_enabled [true or false]")
- end
- elseif t[1] == "\\votekick_needed" or t[1] == "/votekick_needed" or t[1] == "sv_votekick_needed" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (amount: %s)"
- local Line = string.format(line, getname(player),"votekick_needed", t[2])
- WriteLog(log_file, Line)
- if tonumber(t[2]) == 1 then
- votekick_needed = t[2]
- votekick_enabled = true
- sendconsoletext(player, "Votekick needed has been set to " .. t[2] .. "% and enabled.")
- else
- sendconsoletext(player, "Invlaid option.")
- end
- sendconsoletext(player, "Invalid syntax: votekick_needed [number] Note: Use decimals Ex: 0.65 = 65%")
- end
- elseif t[1] == "\\votekick_timeout" or t[1] == "/votekick_timeout" or t[1] == "sv_votekick_timeout" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (Time: %s)"
- local Line = string.format(line, getname(player),"votekick_needed", t[2])
- WriteLog(log_file, Line)
- if tonumber(t[2]) == 1 then
- votekick_timeout = t[2]
- sendconsoletext(player, "Votekick timeout has been set to " .. t[2] .. " minutes.")
- else
- sendconsoletext(player, "Invlaid option.")
- end
- sendconsoletext(player, "Invalid syntax: votekick_timeout [time(in minutes)]")
- end
- elseif t[1] == "\\rtv_enbled" or t[1] == "/rtv_enabled" or t[1] == "sv_rtv_enabled" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (Mode: %s)"
- local Line = string.format(line, getname(player),"rtv_enabled", t[2])
- WriteLog(log_file, Line)
- if tonumber(t[2]) == 1 or t[2] == "true" then
- rtv_enabled = true
- sendconsoletext(player, "RTV / Map skipping has been enabled.")
- elseif tonumber(t[2]) == 0 or t[2] == "false" then
- rtv_enabled = false
- sendconsoletext(player, "RTV / Map skipping has been disabled.")
- else
- sendconsoletext(player, "Invlaid option.")
- end
- sendconsoletext(player, "Invalid syntax: rtv_enabled [true or false]")
- end
- elseif t[1] == "\\rtv_needed" or t[1] == "/rtv_needed" or t[1] == "sv_rtv_needed" or t[1] == "\\map_skip" or t[1] == "/map_skip" or t[1] == "sv_map_skip" then
- if t[2] ~= nil then
- if tonumber(t[2]) == 1 then
- local line = "(User: %s) (Command: %s) (amount: %s)"
- local Line = string.format(line, getname(player),"rtv_needed", t[2])
- WriteLog(log_file, Line)
- rtv_needed = t[2]
- rtv_enabled = true
- sendconsoletext(player, "RTV / Map skipping has been set to " .. t[2] .. "% and enabled.")
- else
- sendconsoletext(player, "Invlaid option.")
- end
- sendconsoletext(player, "Invalid syntax: rtv_needed [number] Note: Use decimals Ex: 0.65 = 65%")
- end
- elseif t[1] == "\\kill" or t[1] == "/kill" or t[1] == "sv_kill" then
- if t[2] ~= nil then
- local players = getvalidplayers(t[2], player)
- if players then
- for i = 1,#players do
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(player),"kill", t[2])
- WriteLog(log_file, Line)
- svcmd("sv_kill " .. resolveplayer(players[i]))
- sendconsoletext(player, getname(players[i]) .. " has been killed.")
- end
- else
- sendconsoletext(player, "Invlaid Player")
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- elseif t[1] == "\\hax" or t[1] == "/hax" or t[1] == "sv_hax" then
- if t[2] ~= nil then
- command_hax(player, t[2], 0)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: hax [player]")
- end
- elseif t[1] == "\\unhax" or t[1] == "/unhax" or t[1] == "sv_unhax" then
- if t[2] ~= nil then
- command_hax(player, t[2], 1)
- else
- sendconsoletext(player, "Incorrect usage! Syntax: unhax [player]")
- end
- elseif t[1] == "\\teamswap" or t[1] == "/teamswap" or t[1] == "sv_teamswap" then
- if t[2] ~= nil then
- command_teamswap(player, t[2])
- else
- sendconsoletext(player, "Incorrect usage! Syntax: teamswap [player]")
- end
- elseif t[1] == "\\st" or t[1] == "/st" or t[1] == "sv_st" or t[1] == "/ts" or t[1] == "\\ts" or t[1] == "sv_ts" then
- if t[2] ~= nil then
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(player),"st", recipient)
- WriteLog(log_file, Line)
- local players = getvalidplayers(t[2], player)
- if players then
- for i = 1,#players do
- changeteam(players[i], true)
- end
- else
- sendconsoletext(player, "Invlaid Player")
- end
- else
- sendconsoletext(player, "Incorrect usage! Syntax: st [player]")
- end
- elseif t[1] == "\\info" or t[1] == "/info" or t[1] == "\\stats" or t[1] == "/stats" or t[1] == "\\lead" or t[1] == "/lead" then
- else
- sendconsoletext(player, "Invlaid command")
- end
- end
- end
- function command_teamswap(user, recipient)
- if recipient ~= nil then else recipient = resolveplayer(user) end -- Just incase the script lets something through.
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(user),"teamswap", recipient)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- changeteam(players[i], false)
- sendconsoletext(user, getname(players[i]) .. " team has been changed despite the color of his or her armor.")
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_hax(user, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end -- Just incase the script lets something through.
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"hax", recipient, mode)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- if mode == 0 then
- haxed[players[i]] = true
- sendconsoletext(user, getname(players[i]) .. " has been haxed!")
- if not haxedtimer then
- registertimer(250, "haxedplayer", players[i])
- haxedtimer = true
- end
- elseif mode == 1 then
- local m_player = getplayer(players[i])
- setscore(players[i], 0)
- writeword(m_player + 0x9C, 0)
- writeword(m_player + 0xA4, 0)
- writeword(m_player + 0xAE, 0)
- haxed[players[i]] = false
- sendconsoletext(user, getname(players[i]) .. " has been unhaxed!")
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function haxedplayer(idk, idk1, player)
- if player then
- if haxed[player] == true then
- local rand = getrandomnumber(100, 999)
- local rand1 = getrandomnumber(100, 999)
- local rand2 = getrandomnumber(100, 999)
- local rand3 = getrandomnumber(100, 999)
- local m_player = getplayer(player)
- setscore(player, rand)
- writeword(m_player + 0x9C, rand1)
- writeword(m_player + 0xA4, rand2)
- writeword(m_player + 0xAE, rand3)
- end
- end
- if haxedtimer then
- return true
- else
- return false
- end
- end
- function command_ipban(user, recipient, reason, mode)
- if recipient ~= nil then else mode = 2 end
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"ipban", recipient, reason, mode)
- WriteLog(log_file, Line)
- local log_File = getprofilepath() .. "\\logs\\Ipbans.log" -- Secondary loging
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"ipban", recipient, reason, mode)
- WriteLog(log_File, Line)
- if mode == 0 then
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local ip = getip(players[i])
- local name = getname(players[i])
- --if reason ~= nil then else reason = "None Given" end
- if not bannedips[ip] then
- bannedips[ip] = true
- say(name .. " has been ipbanned! Reason: " .. reason)
- sendconsoletext(user, name .. " has been ipbanned!")
- else
- say(name .. " has been ipbanned! Reason: " .. reason)
- sendconsoletext(user, name .. " has been ipbanned! Again...")
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- elseif mode == 1 then
- for i = 1,#bannedips do
- if recipient == bannedips[i][1] then
- if bannedips[i][2] == true then
- bannedips[i][2] = false
- sendconsoletext(user, bannedips[i][1] .. " has been unbanned.")
- end
- else
- sendconsoletext(user, "This ip does not appear to be banned. Please make sure you typed it in correctly")
- end
- end
- elseif mode == 2 then
- sendconsoletext(user, "Ip - Ban status")
- for i = 1,#bannedips do
- sendconsoletext(user, bannedips[i][1] .. " - " .. bannedips[i][2])
- end
- else
- sendconsoletext(user, "Error: Missing recipient or ip")
- end
- end
- function command_dyslexic(user, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end -- Just incase the script lets something through.
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"dyslexic", recipient, mode)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- if mode == 0 then
- dyslexic[getname(players[i])] = true
- else
- dyslexic[getname(players[i])] = false
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_spawngiveenter(user, object, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end -- Just incase the script lets something through.
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- if mode == 0 then
- spawnobject(players[i], object, user)
- elseif mode == 1 then
- enter(players[i], object, user)
- elseif mode == 2 then
- giveweapon(players[i], object, user)
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_god(user, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"God", recipient, mode)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_object = getobject(getplayerobjectid(players[i]))
- if m_object then
- if mode == 0 then
- writefloat(m_object, 0xE0, 99999999)
- writefloat(m_object, 0xE4, 99999999)
- sendconsoletext(user, getname(players[i]) .. " now has godmode!")
- privatesay(players[i], "You now have godmode!")
- else
- writefloat(m_object, 0xE0, 1)
- writefloat(m_object, 0xE4, 1)
- sendconsoletext(user, getname(players[i]) .. " no longer has godmode.")
- privatesay(players[i], "You no longer have godmode.")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_ghost(user, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"Ghost", recipient, mode)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_object = getobject(getplayerobjectid(players[i]))
- if m_object then
- if mode == 0 then
- writebit(m_object + 0x10, 7, 1)
- sendconsoletext(user, getname(players[i]) .. " is now a ghost!")
- privatesay(players[i], "You are now a ghost!")
- else
- writebit(m_object + 0x10, 7, 0)
- sendconsoletext(user, getname(players[i]) .. " is no longer a ghost.")
- privatesay(players[i], "You are no longer a ghost.")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_hide(user, recipient, mode)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s) (Mode: %s)"
- local Line = string.format(line, getname(user),"Hide", recipient, mode)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- if tonumber(mode) == 0 then
- sendconsoletext(user, getname(players[i]) .. " has been hidden!")
- privatesay(players[i], "You have been hidden!")
- hidden[players] = true
- else
- sendconsoletext(user, getname(players[i]) .. " is no longer hidden.")
- privatesay(players[i], "You are no longer hidden.")
- hidden[players] = false
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_setammo(user, recipient, type, amount)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s) (amount: %s)"
- local Line = string.format(line, getname(user),"Setammo", recipient, amount)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_objectId = getplayerobjectid(players[i]) or 0xFFFFFFFF
- local m_object = getobject(m_objectId)
- if m_object then
- local m_weaponId = readdword(m_object + 0x118) or 0xFFFFFFFF
- local m_weapon = getobject(m_weaponId)
- if m_weapon then
- if tonumber(amount) then
- if type == "unloaded" or type == "1" then
- writeword(m_weapon + 0x2B6, tonumber(ammo))
- updateammo(m_weaponId)
- sendconsoletext(user, getname(players[i]) .. " had their unloaded ammo changed to " .. amount)
- elseif type == "2" or type == "loaded" then
- writeword(m_weapon + 0x2B8, tonumber(ammo))
- updateammo(m_weaponId)
- sendconsoletext(user, getname(players[i]) .. " had their loaded ammo changed to " .. amount)
- else
- sendconsoletext(user, "Error: Type must be '1', 'unloaded', '2', 'loaded'")
- end
- else
- sendconsoletext(user, "Error: You must use a number for the amount!")
- end
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_setscore(user, recipient, amount)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s) (amount: %s)"
- local Line = string.format(line, getname(user),"Setscore", recipient, amount)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_player = getplayer(players[i])
- if m_player then
- if tonumber(amount) then
- setscore(players[i], amount)
- sendconsoletext(user, "Players score cannot be set right now.")
- else
- sendconsoletext(user, "Error: You must use a number for the amount!")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_setkills(user, recipient, amount)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(user),"Setkills", recipient)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_player = getplayer(players[i])
- if m_player then
- if tonumber(amount) then
- writeshort(m_player + 0x9c, amount)
- sendconsoletext(user, getname(players[i]) .. "'s kills has been set to " .. amount)
- else
- sendconsoletext(user, "Error: You must use a number for the amount!")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_setassists(user, recipient, amount)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(user),"Setassists", recipient)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_player = getplayer(players[i])
- if m_player then
- if tonumber(amount) then
- writeshort(m_player + 0xA4, amount)
- sendconsoletext(user, getname(players[i]) .. "'s assists has been set to " .. amount)
- else
- sendconsoletext(user, "Error: You must use a number for the amount!")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- function command_setdeaths(user, recipient, amount)
- if recipient ~= nil then else recipient = resolveplayer(user) end
- local line = "(User: %s) (Command: %s) (Player: %s)"
- local Line = string.format(line, getname(user),"Setdeaths", recipient)
- WriteLog(log_file, Line)
- local players = getvalidplayers(recipient, user)
- if players then
- for i = 1,#players do
- local m_player = getplayer(players[i])
- if m_player then
- if tonumber(amount) then
- writeshort(m_player + 0xAE, amount)
- sendconsoletext(user, getname(players[i]) .. "'s deaths has been set to " .. amount)
- else
- sendconsoletext(user, "Error: You must use a number for the amount!")
- end
- end
- end
- else
- sendconsoletext(user, "Invlaid Player")
- end
- end
- ------------------------------------------------------------------------------------------
- ----------------------------------- [[Misc Function(s)]] -----------------------------------
- ------------------------------------------------------------------------------------------
- -- From AElites commands
- function setscore(player, score)
- if tonumber(score) then
- local gametype = readbyte(gametype_base + 0x30)
- if gametype == 1 then
- local m_player = getplayer(player)
- writeword(m_player+0xC8, score)
- elseif gametype == 2 then
- writeword(slayer_globals + 0x40 + player*4, score)
- elseif gametype == 3 then
- local oddball_game = readbyte(gametype_base + 0x8C)
- local player = rresolveplayer(player)
- if oddball_game == 0 or oddball_game == 1 then
- writeword(oddball_globals + 0x84 + player*4, score * 30)
- else
- writeword(oddball_globals + 0x84 + player*4, score)
- end
- elseif gametype == 4 then
- local m_player = getplayer(player)
- writeword(m_player + 0xC4, score * 30)
- elseif gametype == 5 then
- local m_player = getplayer(player)
- writeword(m_player + 0xC6, score)
- end
- end
- end
- -- From Wiards comands
- function getvalidplayers(expression, user)
- if cur_players ~= 0 and expression 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 user ~= nil and user ~= -1 and user then
- table.insert(players, user)
- end
- elseif string.sub(expression, 1, 3) == "red" or string.sub(expression, 1, 2) == "rt" then
- for i = 0,15 do
- if getplayer(i) and getteam(i) == 0 then
- table.insert(players, i)
- end
- end
- elseif string.sub(expression, 1, 4) == "blue" or string.sub(expression, 1, 2) == "bt" then
- for i = 0,15 do
- if getplayer(i) and getteam(i) == 1 then
- table.insert(players, i)
- end
- end
- elseif (tonumber(expression) or 0) >= 1 and (tonumber(expression) or 0) <= 16 then
- local expression = tonumber(expression)
- if rresolveplayer(expression) then
- table.insert(players, rresolveplayer(expression))
- end
- elseif expression == "random" or expression == "rand" then
- if cur_players == 1 and user ~= nil then
- table.insert(players, user)
- return players
- end
- while true do
- num = math.random(0, 15)
- if getplayer(num) and num ~= user then
- break
- end
- end
- table.insert(players, num)
- else
- for i = 0,15 do
- if getplayer(i) then
- if string.wild(getname(i), expression) then
- table.insert(players, i)
- end
- end
- end
- end
- if players[1] then
- return players
- end
- end
- return false
- end
- function string.wild(match, wild, case_sensative)
- if not case_sensative then
- match, wild = string.lower(match), string.lower(wild)
- end
- 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 SelectPlayer(team)
- local t = {}
- for i=0,15 do
- if getplayer(i) and getteam(i) == team then
- table.insert(t, i)
- end
- end
- if #t > 0 then
- return t[getrandomnumber(1, #t+1)]
- end
- return nil
- end
- function GetGameAddresses(game)
- if game == "PC" then
- ce = 0x0
- stats_header = 0x639720 -- Confirmed.
- stats_globals = 0x639898 -- Confirmed.
- ctf_globals = 0x639B98 -- Confirmed.
- slayer_globals = 0x63A0E8 -- Confirmed.
- oddball_globals = 0x639E58 -- Confirmed.
- koth_globals = 0x639BD0 -- Confirmed.
- race_globals = 0x639FA0 -- Confirmed.
- race_locs = 0x670F40 -- Confirmed.
- map_pointer = 0x63525c -- Confirmed.
- gametype_base = 0x671340 -- Confirmed.
- network_struct = 0x745BA0 -- Confirmed.
- camera_base = 0x69C2F8 -- Confirmed.
- player_header_pointer = 0x75ECE4 -- Confirmed.
- obj_header_pointer = 0x744C18 -- Confirmed.
- map_header_base = 0x630E74 -- Confirmed.
- banlist_header = 0x641280 -- Confirmed.
- --game_globals = "?" -- WTF IS THIS
- gameinfo_header = 0x671420 -- Confirmed.
- mapcycle_header = 0x614B4C -- Confirmed.
- network_server_globals = 0x69B934 -- Confirmed.
- flags_pointer = 0x6A590C -- Confirmed.
- hash_table_base = 0x6A2AE4 -- Confirmed.
- --Patches
- gametype_patch = 0x481F3C
- hashcheck_patch = 0x59c280 -- Confirmed.
- servername_patch = 0x517D6B -- Confirmed.
- versioncheck_patch = 0x5152E7 -- Confirmed.
- hash_duplicate_patch = 0x59C516 -- Confirmed
- else
- ce = 0x40
- stats_header = 0x5BD740 -- Confirmed.
- stats_globals = 0x5BD8B8 -- Confirmed.
- ctf_globals = 0x5BDBB8 -- Confirmed.
- slayer_globals = 0x5BE108 -- Confirmed.
- oddball_globals = 0x5BDE78 -- Confirmed.
- koth_globals = 0x5BDBF0 -- Confirmed.
- race_globals = 0x5BDFC0 -- Confirmed.
- race_locs = 0x5F5098 -- Confirmed.
- map_pointer = 0x5B927C -- Confirmed.
- gametype_base = 0x5F5498 -- Confirmed.
- network_struct = 0x6C7980 -- Confirmed.
- camera_base = 0x62075C -- Confirmed.
- player_globals = 0x6E1478 -- From OS.
- player_header_pointer = 0x6E1480 -- Confirmed.
- obj_header_pointer = 0x6C69F0 -- Confirmed.
- map_header_base = 0x6E2CA4 -- Confirmed.
- banlist_header = 0x5C52A0 -- Confirmed.
- game_globals = 0x61CFE0 -- Confirmed.
- gameinfo_header = 0x5F55BC -- Confirmed.
- mapcycle_header = 0x598A8C -- Confirmed.
- network_server_globals = 0x61FB64 -- Confirmed.
- hash_table_base = 0x5AFB34 -- Confirmed.
- --Patches
- hashcheck_patch = 0x530130 -- Confirmed.
- servername_patch = 0x4CE0CD -- Confirmed.
- versioncheck_patch = 0x4CB587 -- Confirmed.
- hash_duplicate_patch = 0x5302E6 -- Confirmed
- end
- end
- -- From Wizards commands
- function Ipban(player)
- svcmd("sv_ban " .. resolveplayer(player))
- local banlist = io.open(getprofilepath() .. "\\banned.txt", "r")
- if banlist then
- local lines = 0
- for line in banlist:lines() do
- lines = lines + 1
- if line and line ~= "" then
- if string.find(line, gethash(player)) then
- svcmd("sv_unban " .. lines - 2)
- end
- end
- end
- end
- end
- -- Kennan's Function
- function getplayerkdr(player)
- local kdr = nil
- if getplayer(player) then
- local name = getname(player)
- local kills = tonumber(kills[name])
- local deaths = tonumber(deaths[name])
- if kills ~= nil and deaths ~= nil then
- if kills ~= 0 then
- if deaths ~= 0 then
- local value = kills / deaths
- kdr = math.round(value, 2)
- else
- kdr = tonumber(kills)
- end
- else
- kdr = "No Kills"
- end
- end
- end
- local s = tostring(kdr)
- if string.find(s, "#") then
- kdr = "0"
- end
- return kdr
- end
- -- Kennans's Function
- function getnewmessage(msg)
- local t = {}
- t = tokenizestring(msg, " ")
- local str = ""
- local count = #t
- for i in irand(1, count) do
- str = str .. t[i] .. " "
- end
- return str
- end
- -- Kennans's Function
- function irand(min, max)
- local u = {}
- for i = min,max do
- table.insert(u, i)
- end
- return function()
- if table.unpack(u) then
- local rand = getrandomnumber(1, #u + 1)
- local value = u[rand]
- table.remove(u, rand)
- return value
- end
- end
- end
- -- Nugget's Function
- function math.round(input, precision)
- return math.floor(input * (10 ^ precision) + 0.5) / (10 ^ precision)
- end
- function giveweapon(player, weapon, user)
- if player then
- local line = "(User: %s) (Command: %s) (Object: %s)"
- local Line = string.format(line, getname(user),"Give", weapon)
- WriteLog(log_file, Line)
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- local m_weaponId = readdword(m_object + 0x118)
- local x, y, z = getobjectcoords(objId)
- if weapon == "camo" or object == "camouflage" then
- createobject(camouflage_tag_id, 0, 60, false, x, y, z+0.5)
- elseif weapon == "health" or object == "hp" then
- createobject(healthpack_tag_id, 0, 60, false, x, y, z+0.5)
- elseif weapon == "os" or object == "overshield" then
- createobject(overshield_tag_id, 0, 60, false, x, y, z+0.5)
- elseif weapon == "rifle" or object == "assaultrifle" then
- local rifleid = createobject(assaultrifle_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, rifleid)
- elseif weapon == "flamethrower" or object == "flamer" or object == "flame" then
- local flameid = createobject(flamethrowerl_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, flameid)
- elseif weapon == "ggun" or object == "gravitygun" or object == "gravityrifle" then
- local ggunid = createobject(gravityrifle_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, ggunid)
- elseif weapon == "needler" then
- local needleid = createobject(needler_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, needleid)
- elseif weapon == "pistol" then
- local pistolid = createobject(pistol_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, pistolid)
- elseif weapon == "ppistol" or object == "plasmapistol" then
- local ppistolid = createobject(plasmapistol_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, ppistolid)
- elseif weapon == "prifle" or object == "plasmarifle" then
- local prifleid = createobject(plasmarifle_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, prifleid)
- elseif weapon == "rod" or object == "frod" or object == "fuelrod" then
- local rodid = createobject(plasmacannon_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, rodid)
- elseif weapon == "rox" or object == "rocket" then
- local roxid createobject(rocketlauncher_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, roxid)
- elseif weapon == "shotgun" or object == "shotty" then
- local shotgunid = createobject(shotgun_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, shotgunid)
- elseif weapon == "sniper" then
- local sniperid = createobject(sniper_tag_id, 0, 60, false, x, y, z+0.5)
- assignweapon(player, sniperid)
- else
- sendconsoletext(user, "Invalid Weapon or Powerup!")
- end
- end
- end
- function enter(player, vehicle, user)
- if player then
- local line = "(User: %s) (Command: %s) (Object: %s)"
- local Line = string.format(line, getname(user),"Enter", vehicle)
- WriteLog(log_file, Line)
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local x, y, z = getobjectcoords(objId)
- if vehivle == "shee" or vehicle == "banshee" then
- local sheeid = createobject(banshee_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, sheeid, 0)
- elseif vehicle == "turret" then
- local turretid = createobject(turret_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, turretid, 0)
- elseif vehicle == "ghost" then
- local ghostid = createobject(ghost_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, ghostid, 0)
- elseif vehicle == "rwarthog" or vehicle == "rockethog" or object == "rhog" then
- local rhogid = createobject(rwarthog_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, rhogid, 0)
- elseif vehicle == "warthog" or vehicle == "hog" then
- local hogid = createobject(warthog_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, hogid, 0)
- elseif vehicle == "tank" or vehicle == "scorpion" then
- local tankid = createobject(scorpiob_tag_id, 0, 60, false, x, y, z+2)
- entervehicle(player, tankid, 0)
- else
- sendconsoletext(user, "Invalid Vehicle!")
- end
- end
- end
- function spawnobject(player, object, user)
- if player then
- local line = "(User: %s) (Command: %s) (Object: %s)"
- local Line = string.format(line, getname(user),"Spawn", object)
- WriteLog(log_file, Line)
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local x, y, z = getobjectcoords(objId)
- if object == "camo" or object == "camouflage" then
- createobject(camouflage_tag_id, 0, 60, false, x+1, y+1, z+1)
- elseif object == "health" or object == "hp" then
- createobject(healthpack_tag_id, 0, 60, false, x+1, y+1, z+1)
- elseif object == "os" or object == "overshield" then
- createobject(overshield_tag_id, 0, 60, false, x+1, y+1, z+1)
- elseif object == "rifle" or object == "assaultrifle" then
- createobject(assaultrifle_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "flamethrower" or object == "flamer" or object == "flame" then
- createobject(flamethrower_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "ggun" or object == "gravitygun" or object == "gravityrifle" then
- createobject(gravityrifle_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "needler" then
- createobject(needler_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "pistol" then
- createobject(pistol_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "ppistol" or object == "plasmapistol" then
- createobject(plasmapistol_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "prifle" or object == "plasmarifle" then
- createobject(plasmarifle_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "rod" or object == "frod" or object == "fuelrod" then
- createobject(plasmacannon_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "rox" or object == "rocket" then
- createobject(rocketlauncher_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "shotgun" or object == "shotty" then
- createobject(shotgun_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "sniper" then
- createobject(sniper_tag_id, 0, 60, false, x, y, z+0.5)
- elseif object == "biped" or object == "cyborg" then
- createobject(cyborg_tag_id, 0, 60, false, x+1, y+1, z+1)
- elseif object == "shee" or object == "banshee" then
- createobject(banshee_tag_id, 0, 60, false, x+3, y+3, z+2)
- elseif object == "turret" then
- createobject(turret_tag_id, 0, 60, false, x+3, y+3, z+2)
- elseif object == "ghost" or object == "cyborg" then
- createobject(ghost_tag_id, 0, 60, false, x+3, y+3, z+2)
- elseif object == "rwarthog" or object == "rockethog" or object == "rhog" then
- createobject(rwarthog_tag_id, 0, 60, false, x+3, y+3, z+2)
- elseif object == "warthog" or object == "hog" then
- createobject(warthog_tag_id, 0, 60, false, x+3, y+3, z+2)
- elseif object == "tank" or object == "scorpion" then
- createobject(scorpiob_tag_id, 0, 60, false, x+3, y+3, z+2)
- else
- sendconsoletext(user, "Invalid Object!")
- end
- end
- end
- function getTagIds()
- -- Bipeds
- cyborg_tag_id = gettagid("bipd", "characters\\cyborg_mp\\cyborg_mp")
- captain_tag_id = gettagid("bipd", "characters\\captain\\captain")
- cortana_tag_id = gettagid("bipd", "characters\\cortana\\cortana")
- cortana2_tag_id = gettagid("bipd", "characters\\cortana\\halo_enhanced\\halo_enhanced")
- crewman_tag_id = gettagid("bipd", "characters\\crewman\\crewman")
- elite_tag_id = gettagid("bipd", "characters\\elite\\elite")
- elite2_tag_id = gettagid("bipd", "characters\\elite\\elite special")
- engineer_tag_id = gettagid("bipd", "characters\\engineer\\engineer")
- flood_tag_id = gettagid("bipd", "characters\\flood_captain\\flood_captain")
- flood2_tag_id = gettagid("bipd", "characters\\flood_infection\\flood_infection")
- -- Equipment
- camouflage_tag_id = gettagid("eqip", "powerups\\active camouflage")
- healthpack_tag_id = gettagid("eqip", "powerups\\health pack")
- overshield_tag_id = gettagid("eqip", "powerups\\over shield")
- doublespeed_tag_id = gettagid("eqip", "powerups\\double speed")
- fullspec_tag_id = gettagid("eqip", "powerups\\full-spectrum vision")
- fragnade_tag_id = gettagid("eqip", "weapons\\frag grenade\\frag grenade")
- plasmanade_tag_id = gettagid("eqip", "weapons\\plasma grenade\\plasma grenade")
- rifleammo_tag_id = gettagid("eqip", "powerups\\assault rifle ammo\\assault rifle ammo")
- needlerammo_tag_id = gettagid("eqip", "powerups\\needler ammo\\needler ammo")
- pistolammo_tag_id = gettagid("eqip", "powerups\\pistol ammo\\pistol ammo")
- rocketammo_tag_id = gettagid("eqip", "powerups\\rocket launcher ammo\\rocket launcher ammo")
- shotgunammo_tag_id = gettagid("eqip", "powerups\\shotgun ammo\\shotgun ammo")
- sniperammo_tag_id = gettagid("eqip", "powerups\\sniper rifle ammo\\sniper rifle ammo")
- flameammo_tag_id = gettagid("eqip", "powerups\\flamethrower ammo\\flamethrower ammo")
- -- Vehicles
- banshee_tag_id = gettagid("vehi", "vehicles\\banshee\\banshee_mp")
- turret_tag_id = gettagid("vehi", "vehicles\\c gun turret\\c gun turret_mp")
- ghost_tag_id = gettagid("vehi", "vehicles\\ghost\\ghost_mp")
- rwarthog_tag_id = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
- scorpion_tag_id = gettagid("vehi", "vehicles\\scorpion\\scorpion_mp")
- warthog_tag_id = gettagid("vehi", "vehicles\\warthog\\mp_warthog")
- wraith_tag_id = gettagid("vehi", "vehicles\\wraith\\wraith")
- pelican_tag_id = gettagid("vehi", "vehicles\\pelican\\pelican")
- -- Weapons
- assaultrifle_tag_id = gettagid("weap", "weapons\\assault rifle\\assault rifle")
- oddball_tag_id = gettagid("weap", "weapons\\ball\\ball")
- flag_tag_id = gettagid("weap", "weapons\\flag\\flag")
- flamethrower_tag_id = gettagid("weap", "weapons\\flamethrower\\flamethrower")
- gravityrifle_tag_id = gettagid("weap", "weapons\\gravity rifle\\gravity rifle")
- needler_tag_id = gettagid("weap", "weapons\\needler\\mp_needler")
- pistol_tag_id = gettagid("weap", "weapons\\pistol\\pistol")
- plasmapistol_tag_id = gettagid("weap", "weapons\\plasma pistol\\plasma pistol")
- plasmarifle_tag_id = gettagid("weap", "weapons\\plasma rifle\\plasma rifle")
- plasmacannon_tag_id = gettagid("weap", "weapons\\plasma_cannon\\plasma_cannon")
- rocketlauncher_tag_id = gettagid("weap", "weapons\\rocket launcher\\rocket launcher")
- shotgun_tag_id = gettagid("weap", "weapons\\shotgun\\shotgun")
- sniper_tag_id = gettagid("weap", "weapons\\sniper rifle\\sniper rifle")
- energysword_tag_id = gettagid("weap", "weapons\\energy sword\\energy sword")
- -- Projectiles
- bansheebolt_tag_id = gettagid("proj", "vehicles\\banshee\\banshee bolt")
- bansheeblast_tag_id = gettagid("proj", "vehicles\\banshee\\mp_banshee fuel rod")
- turretfire_tag_id = gettagid("proj", "vehicles\\c gun turret\\mp gun turret")
- ghostbolt_tag_id = gettagid("proj", "vehicles\\ghost\\ghost bolt")
- tankshot_tag_id = gettagid("proj", "vehicles\\scorpion\\bullet")
- tankblast_tag_id = gettagid("proj", "vehicles\\scorpion\\tank shell")
- warthogshot_tag_id = gettagid("proj", "vehicles\\warthog\\bullet")
- rifleshot_tag_id = gettagid("proj", "weapons\\assault rifle\\bullet")
- flame_tag_id = gettagid("proj", "weapons\\flamethrower\\flame")
- needlerfire_tag_id = gettagid("proj", "weapons\\needler\\mp_needle")
- pistolshot_tag_id = gettagid("proj", "weapons\\pistol\\bullet")
- plasmariflebolt_tag_id = gettagid("proj", "weapons\\plasma pistol\\bolt")
- plasmapistolbolt_tag_id = gettagid("proj", "weapons\\plasma rifle\\bolt")
- plasmapistolblast_tag_id = gettagid("proj", "weapons\\plasma rifle\\charged bolt")
- plasmacannonshot_tag_id = gettagid("proj", "weapons\\plasma_cannon\\plasma_cannon")
- rocket_tag_id = gettagid("proj", "weapons\\rocket launcher\\rocket")
- shotgunshot_tag_id = gettagid("proj", "weapons\\shotgun\\pellet")
- snipershot_tag_id = gettagid("proj", "weapons\\sniper rifle\\sniper bullet")
- end
- function WriteLog(filename, value)
- local File = io.open(filename, "a")
- if File then
- File:write( string.format("%s\t%s\n", os.date("!%m/%d/%Y %H:%M:%S"), tostring(value) ) )
- File:close()
- end
- end
- ------------------------------------------------------------------------------------------
- -------------------------------- [[Nuggets table saving]] --------------------------------
- ------------------------------------------------------------------------------------------
- function table.save(t, filename)
- local dir = getprofilepath()
- local file = io.open(dir .. "\\data\\" .. filename, "w")
- local spaces = 0
- local function tab()
- local str = ""
- for i = 1,spaces do
- str = str .. " "
- end
- return str
- end
- local function format(t)
- spaces = spaces + 4
- local str = "{ "
- for k,v in opairs(t) do
- -- Key datatypes
- if type(k) == "string" then
- k = string.format("%q", k)
- elseif k == math.inf then
- k = "1 / 0"
- end
- k = tostring(k)
- -- Value datatypes
- if type(v) == "string" then
- v = string.format("%q", v)
- elseif v == math.inf then
- v = "1 / 0"
- end
- if type(v) == "table" then
- if table.len(v) > 0 then
- str = str .. "\n" .. tab() .. "[" .. k .. "] = " .. format(v) .. ","
- else
- str = str .. "\n" .. tab() .. "[" .. k .. "] = {},"
- end
- else
- str = str .. "\n" .. tab() .. "[" .. k .. "] = " .. tostring(v) .. ","
- end
- end
- spaces = spaces - 4
- return string.sub(str, 1, string.len(str) - 1) .. "\n" .. tab() .. "}"
- end
- file:write("return " .. format(t))
- file:close()
- end
- function table.load(filename)
- local dir = getprofilepath()
- local file = loadfile(dir .. "\\data\\" .. filename)
- if file then
- return file() or {}
- end
- return {}
- end
- function table.len(t)
- local count = 0
- for k,v in pairs(t) do
- count = count + 1
- end
- return count
- end
- function opairs(t)
- local keys = {}
- for k,v in pairs(t) do
- table.insert(keys, k)
- end
- table.sort(keys,
- function(a,b)
- if type(a) == "number" and type(b) == "number" then
- return a < b
- end
- an = string.lower(tostring(a))
- bn = string.lower(tostring(b))
- if an ~= bn then
- return an < bn
- else
- return tostring(a) < tostring(b)
- end
- end)
- local count = 1
- return function()
- if table.unpack(keys) then
- local key = keys[count]
- local value = t[key]
- count = count + 1
- return key,value
- end
- end
- end
- function spaces(n, delimiter)
- delimiter = delimiter or ""
- local str = ""
- for i = 1, n do
- if i == math.floor(n / 2) then
- str = str .. delimiter
- end
- str = str .. " "
- end
- return str
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement