Advertisement
HR_Shaft

Replace Player Names v2 for Phasor v2+

Feb 29th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.42 KB | None | 0 0
  1. -- Replace Player Names v2 for Phasor v2+
  2. -- by H® Shaft
  3.  
  4. -- This will replace "unwanted names" (line 47) with the "replacement_names" you specify (line 54) and also, notify the player.  
  5. -- You can add names to the table: (replace_table) with the name you want replaced in quotes separated by comma between names.
  6. -- all names are case sensitive: "Smith" is not the same as "smith" - so bad strings can be added to catch multiple names (line 69)
  7. -- This script is a derivation/development of my original Replace Player Names v1 and OnNameRequest by Devieth/IT300/Skylace,
  8.  
  9. -- Message given to player who had their name replaced and tells them their new name:
  10. REPLACEMENT_MESSAGE = "The server has replaced your name.  Your new name is: "
  11.  
  12. -- don't edit --
  13. newnames = {}
  14.  
  15. function GetRequiredVersion()
  16.     return 200
  17. end
  18.  
  19. function OnScriptLoad(process, game, persistent)
  20.     for i=0,15 do
  21.         if getplayer(i) then
  22.             newnames[gethash(i)] = false
  23.         end
  24.     end
  25. end
  26.  
  27. function OnPlayerJoin(player)
  28.     if getplayer(player) then
  29.         if newnames[gethash(player)] then
  30.             sendresponse(REPLACEMENT_MESSAGE .. getname(player), player)
  31.         end
  32.     end
  33. end
  34.  
  35. function OnPlayerLeave(player)
  36.     if getplayer(player) then
  37.         newnames[gethash(player)] = nil
  38.     end
  39. end
  40.  
  41. function OnNameRequest(hash, name, new_name)   
  42.     -- UTF8 character code for '%+%'
  43.     autogen = "\43\37\43"
  44.  
  45.     -- unwanted names: case sensitive ("Bob" is not the same as "bob") You can add exact ALT-Coded entries here (copy/paste from your logs)
  46.     -- most of these names are auto-generated by halo (english install), or are common noob names you wish to replace
  47.     unwanted_names = {autogen, "+%+", "Donut", "Penguin", "Stumpy", "Whicker", "Shadow", "Howard", "Wilshire", "Darling", "Disco", "Jack", "The Bear", "Sneak", "The Big L", "Whisp",  
  48.     "Wheezy", "Crazy", "Goat", "Pirate", "Saucy", "Hambone", "Butcher", "Walla Walla", "Snake", "Caboose", "Sleepy", "Killer", "Stompy", "Mopey",  
  49.     "Dopey", "Weasel", "Ghost", "Dasher", "Grumpy", "Hollywood", "Tooth", "Noodle", "King", "Cupid", "Prancer", "POQ Sucks"
  50.     }
  51.  
  52.     -- new replacement names to replace unwanted names.  
  53.     -- new names CANNOT be more than 10 characters long! Each entry must be in "quotes" and a comma between entries.
  54.     replacement_names = {"Beau", "Bobby Joe", "Bodean", "Bubba", "Buck", "Cletus", "Cleon", "Billy Bob", "Beauford", "Jethro", "Orville", "Joe Bob", "Bucephelus", "Wilford", "Clyde",
  55.     "Delmont", "Duke", "Eustice", "Earl", "Floyd", "Forrest", "Jim Bob", "Jimmy Don", "John Boy", "Otis", "Pervis", "Roscoe", "Saggory", "Rufus", "Tiberius", "Billy Bo Bob", "Bubba, Jr.",
  56.     "Cooter", "Elrod", "Jed", "Jebediah", "Junior, Jr.", "Bubba, Jr.", "Gunther", "Ellie Mae", "Sue Ellen", "Earlene", "Bertha", "Peggy Sue", "Daisy Mae", "Henrietta", "Annabelle", "Bambi", "Betty Jo",
  57.     "Betty Lou", "Billie Jean", "Bobbie Sue", "Buffy", "Claudette", "Delilah", "Georgette", "Jaylnn Jo", "Jozelle", "Hattie", "Layla", "Linda Sue", "Martha-Mae", "Roxxy", "Peach", "Tucker",
  58.     "Patty Sue", "Shaneyney", "Trixibelle", "Waynelle", "Beaula", "Brandine", "Larlene", "Lilah", "Savannah", "Shelbylyn", "Lula", "Abner", "Barney", "Cal", "Chester", "Cy", "Cyrus", "Gus", "Homer",
  59.     "Ike", "Jasper", "Jeb", "Jethro", "Lem", "Luke", "Wilbur", "Willie", "Zeb", "Zed", "Zeke", "Hayseed", "Big Daddy", "West", "Les", "Meatloaf", "Uncle Ben", "Ronda", "Cherry", "Shawnda", "Vonda",
  60.     "Destiny", "Claudine", "Dreama", "EvaJo", "Faylene", "Gracelyn", "January", "Jazlean", "Kaylin", "Loribelle", "Misty Dawn", "Norma", "Raylene", "Rubyjane", "Sapphire", "Sheena", "Summer", "Sunset",
  61.     "Tabitha", "Vanity", "Kandy", "Erneshia", "Jicelle", "Mandy Lynn", "Misty Rain", "Amaleen", "Baylie", "Brittney", "Tits McGee"
  62.     }
  63.    
  64.     -- bad strings, Only lowercase! if a 'portion' (string) of these bad names enter, add players entry name to unwanted_names table, then replace
  65.     -- example: "nigg" as a bad name will catch "nigger", "nigga" and "nigguh",  
  66.     -- whereas, a player named "grape" will have name replaced because "rape" is a bad string
  67.     -- if "ass" was listed here (it's not), a player named Assassin would have their name replaced,
  68.     -- "assh" is listed, so a player named "asshole" or "asshat" would have their name replaced
  69.     bad_strings = {"fuck", "fuk", "shit", "bitch", "cock", "cok", "cunt", "nigg", "jew", "rape", "vehic", "puss", "rapist", "negro", "spic", "wetback",
  70.     "your mom", "madre", "new00", "nuevo", "phuck", "phuk", "assh", "mike hunt", "penis", "dick", "vagina", "kkk", "hitler"
  71.     }      
  72.    
  73.     -- find unwanted strings in player names
  74.     local AsIs = name
  75.     local name = string.lower(name)
  76.     for k,v in pairs(bad_strings) do
  77.         if (string.gsub(name,string.lower(v),"") ~= name) then
  78.             table.insert(unwanted_names, AsIs)
  79.         end
  80.     end
  81.    
  82.     -- find unwanted player names, replace them, and log into phasors game log
  83.     for k,v in pairs(unwanted_names) do
  84.         if v == name then
  85.             local rand_name = getrandomnumber(1, #replacement_names+1)
  86.             new_name = string.format("%s",  replacement_names[rand_name])
  87.             log_msg(1, name .. " was given the new name of " .. new_name .. ", hash: " .. hash)
  88.             table.remove(replacement_names, rand_name)
  89.             newnames[hash] = true  
  90.             return true, new_name
  91.         else
  92.             new_name = AsIs
  93.         end        
  94.     end
  95.    
  96.     return true, new_name
  97. end
  98.  
  99. function sendresponse(message, player)
  100.     if player then
  101.         privatesay(player, message)
  102.     else
  103.         hprintf(message)
  104.     end
  105. end
  106.  
  107. -- Created by H® Shaft
  108. -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement