Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- IP Ban by Player Name v1.0 for SAPP
- -- by H® Shaft 8/19/2016
- -- This script will allow admins to manually enter a players name, and when player enters the server, to IP Ban them, and
- -- to 'optionally' crash the banned players halo game
- -- NOTE: this script looks for player names as a "string", so what does that mean? It means, be careful!
- -- 1) if "ass" was listed in the table below, a players named Ass, Asshole, and Assassin would ALL be ip-banned
- -- 2) if "assh" is listed, a player named "asshole" or "asshat" BOTH will be ip-banned, but Assassin would NOT be ip-banned.
- -- 3) if "new" is listed, a player named "New001" or "Newbie" or "Brandnew" would ALL be ip-banned
- function LoadNames()
- -- Each name should be in "quotes", and each name separated by a comma, "Name1", "Name2", "Name3"
- -- names may include Alt-Codes (custom characters) such as "Ñamê"
- -- Note: if you add a name here during gameplay, save, then you should reload this script.
- -- Names of players you want auto-ip-banned. Upper and Lower case is fine (UPPER/lower), or copy/paste from sapps log.
- names_to_be_ipbanned = {"escroto", "escroto69", "escr0t0", "escr0t069"}
- end
- -- Do you want to cause the players halo to crash? true = yes, false = no
- -- works with all unprotected maps which have a stock warthog (chaingun warthog)
- -- suggestion: If you use all stock PC/CE maps, set to true, if using custom CE maps, set to false
- crash_halo = true
- -- do not edit below --
- api_version = "1.9.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_PREJOIN'], "OnPlayerPrejoin")
- if halo_type == "PC" then ce = 0x0 else ce = 0x40 end
- network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3)
- if get_var(0, "$gt") ~= "n/a" then
- game_started = true
- end
- end
- function OnScriptUnload() end
- function OnNewGame()
- game_started = true
- end
- function OnGameEnd()
- game_started = false
- end
- function OnPlayerPrejoin(PlayerIndex)
- local network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3)
- local client_network_struct = network_struct + 0x1AA + ce + to_real_index(PlayerIndex) * 0x20
- local Name = read_widestring(client_network_struct, 12)
- LoadNames()
- local found = false
- local name = string.lower(Name)
- for k,v in pairs(names_to_be_ipbanned) do
- if (string.gsub(name,string.lower(v),"") == name) then
- found = true
- end
- end
- if (found == true) then
- if (crash_halo == true) then
- -- 3 second delay allows player to fully spawn
- timer(3000, "Crash_Player", PlayerIndex)
- end
- -- 3.5 second delay allows crashing a player to complete before they are ip-banned
- timer(3500, "AUTO_IPBAN", PlayerIndex) -- 3.5 seconds
- end
- end
- -- adds player to ipbanlist in /cg directory permanently, with reason "AUTO_IP_BAN"
- -- the SAPP IP banlist is located in yourservername\sapp - named ipbans.txt
- function AUTO_IPBAN(PlayerIndex)
- if player_present(PlayerIndex) then
- execute_command("ipban " .. PlayerIndex .. " 0 " .. "AUTO_IP_BAN")
- end
- return false
- end
- -- Called from OnPlayerPrejoin by a timer with a 3.5 second delay
- function Crash_Player(PlayerIndex)
- if player_present(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- if game_started then
- if (player_object ~= 0) then
- local x,y,z = read_vector3d(player_object + 0x5C)
- local vehicleId = spawn_object("vehi", "vehicles\\warthog\\mp_warthog", x, y, z)
- local veh_obj = get_object_memory(vehicleId)
- if (veh_obj ~= 0) then
- for j = 0,20 do
- enter_vehicle(vehicleId, PlayerIndex, j)
- exit_vehicle(PlayerIndex)
- end
- destroy_object(vehicleId)
- end
- end
- end
- end
- return false
- end
- function read_widestring(address, length)
- local count = 0
- local byte_table = {}
- for i = 1,length do
- if read_byte(address + count) ~= 0 then
- byte_table[i] = string.char(read_byte(address + count))
- end
- count = count + 2
- end
- return table.concat(byte_table)
- end
- function OnError(Message)
- print(debug.traceback())
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement