th3w1zard1

Multi-lobby

Jun 6th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. warning_msg = true -- Send players a warning to update their halo (intentions of this script, please use it!)
  2.  
  3. function GetRequiredVersion()
  4.     return 200
  5. end
  6.  
  7. function OnScriptLoad(processid, game, persistent)
  8.     Game = game
  9.     if (game == "PC") then
  10.         version_address = 0x5df840
  11.         addr1 = 0x5992DE
  12.         game_lobby = 0x6A1C80
  13.         network_base = 0x745BA8
  14.         sockaddr_pointer = 0x6A1F08
  15.     else
  16.         version_address = 0x564b34
  17.         addr1 = 0x52DB7E
  18.         game_lobby = 0x626100
  19.         network_base = 0x6C7988
  20.         sockaddr_pointer = 0x626388
  21.     end
  22.     sockaddr_in = readdword(sockaddr_pointer) + 0xC4
  23.     writedword(addr1, 0x7530)
  24.     lchanger = registertimer(30000, "lobbyChanger")
  25. end
  26.  
  27. function OnScriptUnload()
  28.  
  29. end
  30.  
  31. function OnNewGame(map)
  32.     sockaddr_in = readdword(sockaddr_pointer) + 0xC4
  33.     if not lchanger then
  34.         lchanger = registertimer(30000, "lobbyChanger")
  35.     end
  36. end
  37.  
  38.  
  39. function OnGameEnd(stage)
  40.     if stage == 1 then
  41.         if lchanger then
  42.             removetimer(lchanger)
  43.             lchanger = nil
  44.         end
  45.     end
  46. end
  47.  
  48. function OnPlayerJoin(player)
  49.     if warning_msg then
  50.         privatesay(player, "WARNING: Gamespy shutdown imminent. Update your halo if you haven't already.")
  51.         privatesay(player, "http://tinyurl.com/EnHalo")
  52.     end
  53. end
  54.  
  55. function lobbyChanger(id, count)
  56.     if Game == "PC" then
  57.         if count % 2 == 0 then
  58.             --Send to gamespy master server.
  59.             writedword(sockaddr_in + 0x4, 0xF81E0A45)
  60.             writestring(version_address, "01.00.09.0620")
  61.         else
  62.             --Send to new master server.
  63.             writedword(sockaddr_in + 0x4, 0x77E65436)
  64.             writestring(version_address, "01.00.10.0621")
  65.         end
  66.     else
  67.         if count % 2 == 0 then
  68.             --Send to gamespy master server.
  69.             writedword(sockaddr_in + 0x4, 0xF81E0A45)
  70.             writestring(version_address, "01.00.09.0620")
  71.         else
  72.             --Send to new master server.
  73.             writedword(sockaddr_in + 0x4, 0x77E65436)
  74.             writestring(version_address, "01.00.10.0621")
  75.         end
  76.     end
  77.     return true
  78. end
  79.  
  80. function writestring(addr, str)
  81.     local l = 0
  82.     for i = 1, #str do
  83.         local c = string.byte(str, i)
  84.         writebyte(addr + i - 1, c)
  85.         l = l + 1
  86.     end
  87.     writebyte(addr + l, 0)
  88. end
Add Comment
Please, Sign In to add comment