Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Replace Player Names v1.0 for SAPP
- -- by H® Shaft
- -- This will replace "unwanted names" (line 102) with the "replacement_names" you specify (line 109) and also, notify the player.
- -- You can add names to the table: (replace_table) with the name you want replaced in quotes separated by comma between names.
- -- all names are case sensitive: "Smith" is not the same as "smith" - so bad strings can be added to catch multiple names (line 124)
- -- This script is a derivation/development of OnNameRequest by Devieth/IT300/Skylace
- -- Message given to player who had their name replaced and tells them their new name:
- REPLACEMENT_MESSAGE = "The server has replaced your name. Your new name is: "
- api_version = "1.9.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_PREJOIN'], "OnPlayerPrejoin")
- register_callback(cb['EVENT_GAME_END'],"OnGameEnd")
- if halo_type == "PC" then ce = 0x0 else ce = 0x40 end
- network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3)
- LoadTables()
- 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)
- local new_name = OnNameRequest(PlayerIndex, name)
- if name ~= new_name then
- write_widestring(client_network_struct, string.sub(new_name,1,11), 12)
- notify_player = timer(6000, "NotifyPlayer", PlayerIndex, new_name)
- end
- end
- function OnNameRequest(PlayerIndex, Name)
- -- find bad strings in player names, add AsIs name to unwanted names
- local AsIs = Name
- local name = string.lower(Name)
- for k,v in pairs(bad_strings) do
- if (string.gsub(name,string.lower(v),"") ~= name) then
- table.insert(unwanted_names, AsIs)
- end
- end
- -- find unwanted player names
- for k,v in pairs(unwanted_names) do
- if v == Name then
- local rand_name = rand(1, #replacement_names+1)
- new_name = string.format("%s", replacement_names[rand_name])
- table.remove(replacement_names, rand_name) -- prevent duplicate selections
- Name = new_name
- end
- end
- return Name
- end
- function write_widestring(address, str, len)
- local Count = 0
- for i = 1,len do
- write_byte(address + Count, 0)
- Count = Count + 2
- end
- local length = string.len(str)
- local count = 0
- for i = 1,length do
- local newbyte = string.byte(string.sub(str,i,i))
- write_byte(address + count, newbyte)
- count = count + 2
- end
- 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 NotifyPlayer(PlayerIndex, new_name)
- if player_present(PlayerIndex) then
- local name = new_name
- sendresponse(REPLACEMENT_MESSAGE .. name, PlayerIndex)
- end
- return false
- end
- function sendresponse(message, PlayerIndex)
- if (PlayerIndex == nil) or (message == nil) then return end
- if PlayerIndex then
- rprint(PlayerIndex, message)
- end
- end
- function LoadTables()
- -- UTF8 character code for '%+%'
- autogen = "\43\37\43"
- -- unwanted names: case sensitive ("Bob" is not the same as "bob")
- -- most of these names are auto-generated by halo (english install), or are common noob names you wish to replace
- unwanted_names = {autogen, "+%+", "Donut", "Penguin", "Stumpy", "Whicker", "Shadow", "Howard", "Wilshire", "Darling", "Disco", "Jack", "The Bear", "Sneak", "The Big L", "Whisp",
- "Wheezy", "Crazy", "Goat", "Pirate", "Saucy", "Hambone", "Butcher", "Walla Walla", "Snake", "Caboose", "Sleepy", "Killer", "Stompy", "Mopey",
- "Dopey", "Weasel", "Ghost", "Dasher", "Grumpy", "Hollywood", "Tooth", "Noodle", "King", "Cupid", "Prancer", "POQ Sucks"
- }
- -- new replacement names to replace unwanted names.
- -- new names CANNOT be more than 10 characters long! Each entry must be in "quotes" and a comma between entries.
- replacement_names = {"Beau", "Bobby Joe", "Bodean", "Bubba", "Buck", "Cletus", "Cleon", "Billy Bob", "Beauford", "Jethro", "Orville", "Joe Bob", "Bucephelus", "Wilford", "Clyde",
- "Delmont", "Duke", "Eustice", "Earl", "Floyd", "Forrest", "Jim Bob", "Jimmy Don", "John Boy", "Otis", "Pervis", "Roscoe", "Saggory", "Rufus", "Tiberius", "Billy Bo Bob", "Bubba, Jr.",
- "Cooter", "Elrod", "Jed", "Jebediah", "Junior, Jr.", "Bubba, Jr.", "Gunther", "Ellie Mae", "Sue Ellen", "Earlene", "Bertha", "Peggy Sue", "Daisy Mae", "Henrietta", "Annabelle", "Bambi", "Betty Jo",
- "Betty Lou", "Billie Jean", "Bobbie Sue", "Buffy", "Claudette", "Delilah", "Georgette", "Jaylnn Jo", "Jozelle", "Hattie", "Layla", "Linda Sue", "Martha-Mae", "Roxxy", "Peach", "Tucker",
- "Patty Sue", "Shaneyney", "Trixibelle", "Waynelle", "Beaula", "Brandine", "Larlene", "Lilah", "Savannah", "Shelbylyn", "Lula", "Abner", "Barney", "Cal", "Chester", "Cy", "Cyrus", "Gus", "Homer",
- "Ike", "Jasper", "Jeb", "Jethro", "Lem", "Luke", "Wilbur", "Willie", "Zeb", "Zed", "Zeke", "Hayseed", "Big Daddy", "West", "Les", "Meatloaf", "Uncle Ben", "Ronda", "Cherry", "Shawnda", "Vonda",
- "Destiny", "Claudine", "Dreama", "EvaJo", "Faylene", "Gracelyn", "January", "Jazlean", "Kaylin", "Loribelle", "Misty Dawn", "Norma", "Raylene", "Rubyjane", "Sapphire", "Sheena", "Summer", "Sunset",
- "Tabitha", "Vanity", "Kandy", "Erneshia", "Jicelle", "Mandy Lynn", "Misty Rain", "Amaleen", "Baylie", "Brittney", "Tits McGee"
- }
- -- bad strings, Only lowercase! if a 'portion' (string) of these bad names enter, add players entry name to unwanted_names table, then replace
- -- example: "nigg" as a bad name will catch "nigger", "nigga" and "nigguh",
- -- whereas, a player named "grape" will have name replaced because "rape" is a bad name
- -- if "ass" was listed here (it's not), a player named Assassin would have their name replaced,
- -- "assh" is listed, so a player named "asshole" or "asshat" would have their name replaced
- bad_strings = {"fuck", "fuk", "shit", "bitch", "cock", "cok", "cunt", "nigg", "jew", "rape", "vehic", "puss", "rapist", "negro", "spic", "wetback",
- "your mom", "madre", "new00", "nuevo", "phuck", "phuk", "assh", "mike hunt", "penis", "dick", "vagina"
- }
- end
- function OnScriptUnload()
- unwanted_names = {}
- replacement_names = {}
- bad_strings = {}
- end
- function OnGameEnd()
- --re-populates replacement_names table
- LoadTables()
- 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