Advertisement
HR_Shaft

Master Server script by Oxide for Phasor V2

Nov 27th, 2016
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. -- Master Server script by Oxide for Phasor V2
  2. -- [REQUIRED FILE FOR RUNNING A PHASOR SERVER TO BE SEEN IN THE SERVER LOBBY LIST]
  3.  
  4. -- This is the script which allows a phasor server (which runs on halo 1.09 dedicated server version)
  5. -- to the connect to the halo lobby master server (version 1.10 server list).  
  6. -- It should be saved in the 'persistent' folder located in [server]\cg\scripts\persistent.
  7. -- For some odd reason, this script was not included in the last phasor release zip file.
  8.  
  9. default_version = "01.00.10.0621"
  10. version_address = nil
  11. Game = nil
  12.  
  13. function GetRequiredVersion()
  14.     return 200
  15. end
  16.  
  17. function OnScriptLoad(processId, game, persistent)
  18.     if not persistent then
  19.         hprintf("You probably want to load this script persistently when the server starts.")
  20.         hprintf("ie. put it into scripts/persistent and don't load from your init file.")
  21.     end
  22.     local addr1 = nil
  23.     local addr2 = nil
  24.     Game = game
  25.     if (game == "PC") then
  26.         addr1 = 0x5c34b4
  27.         addr2 = 0x5c3a08
  28.         version_address = 0x5df840
  29.     else
  30.         addr1 = 0x54d384
  31.         addr2 = 0x54d720
  32.         version_address = 0x564b34
  33.     end
  34.        
  35.     -- phasor's writestring functions are ridiculously bugged (lol)
  36.     writestring(addr1, "s1.master.hosthpc.com")
  37.     writestring(addr2, "s1.ms01.hosthpc.com")
  38.     writestring(version_address, default_version)
  39. end
  40.  
  41. function OnServerCommand(admin, command)
  42.     t = tokenizecmdstring(command)
  43.     count = #t
  44.     if (count == 0) then return nil end
  45.     if t[1] == "sv_version" then
  46.         local processed = false
  47.         if (count == 2) then
  48.             v = t[2]
  49.             if (v == "1.10" or v == "110" or v == "10") then                           
  50.                 writestring(version_address, "01.00.10.0621")
  51.                 processed = true
  52.                 respond("Broadcasting on version " .. readstring(version_address))
  53.             end
  54.         else
  55.             respond("current version: " .. readstring(version_address))
  56.             respond("valid versions: 110")
  57.         end    
  58.         return not processed
  59.     end
  60. end
  61.  
  62. function writestring(addr, str)
  63.     local l = 0
  64.     for i = 1, #str do
  65.         local c = string.byte(str, i)
  66.         writebyte(addr + i - 1, c)
  67.         l = l + 1
  68.     end
  69.     writebyte(addr + l, 0)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement