LUA 33
+++ Master Server Gamespy Lobby Fix v1.2 +++ By xdedeone on 26th February 2019 05:50:23 PM
  1. -- New Master Server Gamespy Lobby Fix v1.2
  2. -- for Halo PC/CE for Phasor V2
  3. -- by Oxide/Urbanyoung/Wizard 5-14-2014
  4.  
  5. -- Changes to the new lobby that the server broadcasts to. Also allows you to change the version via console using sv_version command
  6. -- Phasor Dedi should remain at 1.09, and as of this script, you cannot yet change the version using sv_version command until phasor is patched/updated.
  7. -- Note: remove sv_version from init file, and/or defaults (if present)
  8.  
  9. default_version = "01.00.10.0621"
  10.  
  11. function GetRequiredVersion()
  12.         return 200
  13. end
  14.  
  15. function OnScriptLoad(processId, game, persistent)
  16.         if not persistent then
  17.                 hprintf("You probably want to load this server persistently when the server starts.")
  18.                 hprintf("ie. put it into scripts/persistent and don't load from your init file.")
  19.         end
  20.         local addr1 = nil
  21.         local addr2 = nil
  22.         Game = game
  23.         if (game == "PC") then
  24.                 addr1 = 0x5c34b4
  25.                 addr2 = 0x5c3a08
  26.                 addr3 = 0x5df840
  27.         else
  28.                 addr1 = 0x54d384
  29.                 addr2 = 0x54d720
  30.                 addr3 = 0x564b34
  31.         end
  32.                
  33.         writestring(addr1, "s1.master.hosthpc.com")
  34.         writestring(addr2, "s1.ms01.hosthpc.com")
  35.         writestring(addr3, default_version)
  36. end
  37.  
  38. function OnServerCommand(admin, command)
  39.         t = tokenizecmdstring(command)
  40.         count = #t
  41.         if t[1] == "sv_version" then
  42.                 Command_Version(admin, command, t[2], count)
  43.                 return false
  44.         end
  45.         return nil
  46. end
  47.  
  48.  
  49. function writestring(addr, str)
  50.         local l = 0
  51.         for i = 1, #str do
  52.                 local c = string.byte(str, i)
  53.                 writebyte(addr + i - 1, c)
  54.                 l = l + 1
  55.         end
  56.         writebyte(addr + l, 0)
  57. end
  58.  
  59. function Command_Version(executor, command, version, count)
  60.         if count == 1 then
  61.                 sendconsoletext(executor, "The current version is " .. tostring(Version))
  62.         elseif count == 2 and tonumber(version) then
  63.                 if Game == "PC" then
  64.                         local bool
  65.                         if version == "1.00" or version == "00" or version == "0" then
  66.                                 Version = "01.00.00.0564"
  67.                                 writestring("01.00.00.0564", 0x5DF840)
  68.                         elseif version == "1.01" or version == "01" or version == "1" then
  69.                                 Version = "01.00.01.0580"
  70.                                 writestring("01.00.01.0580", 0x5DF840)
  71.                         elseif version == "1.02" or version == "02" or version == "2" then
  72.                                 Version = "01.00.02.0581"
  73.                                 writestring("01.00.02.0581", 0x5DF840)
  74.                         elseif version == "1.03" or version == "03" or version == "3" then
  75.                                 Version = "01.00.03.0605"
  76.                                 writestring("01.00.03.0605", 0x5DF840)
  77.                         elseif version == "1.04" or version == "04" or version == "4" then
  78.                                 Version = "01.00.04.0607"
  79.                                 writestring("01.00.04.0607", 0x5DF840)
  80.                         elseif version == "1.05" or version == "05" or version == "5" then
  81.                                 Version = "01.00.05.0610"
  82.                                 writestring("01.00.05.0610", 0x5DF840)
  83.                         elseif version == "1.06" or version == "06" or version == "6" then
  84.                                 Version = "01.00.06.0612"
  85.                                 writestring("01.00.06.0612", 0x5DF840)
  86.                         elseif version == "1.07" or version == "07" or version == "7" then
  87.                                 Version = "01.00.07.0613"
  88.                                 writestring("01.00.07.0613", 0x5DF840)
  89.                         elseif version == "1.08" or version == "08" or version == "8" then
  90.                                 Version = "01.00.08.0616"
  91.                                 writestring("01.00.08.0616", 0x5DF840)
  92.                         elseif version == "1.09" or version == "09" or version == "9" then
  93.                                 Version = "01.00.09.0620"
  94.                                 writestring("01.00.09.0620", 0x5DF840)
  95.                         elseif version == "1.10" or version == "10" then
  96.                                 Version = "01.00.10.0621"
  97.                                 writestring("01.00.10.0621", 0x5DF840)
  98.                         else
  99.                                 bool = true
  100.                         end
  101.                         if not bool then
  102.                                 sendconsoletext(executor, "Server version has been changed to " .. tostring(Version) .. "!")
  103.                         else
  104.                                 sendconsoletext(executor, "That is an invalid server version.")
  105.                         end
  106.                 elseif tonumber(version) then
  107.                         local bool = true
  108.                         if version == "1.00" or version == "00" or version == "0" then
  109.                                 Version = "01.00.00.0609"
  110.                                 writestring("01.00.00.0609", 0x564B34)
  111.                         elseif version == "1.01" or version == "01" or version == "1" then
  112.                                 Version = "01.00.01.0580"
  113.                                 writestring("01.00.01.0580", 0x564B34)
  114.                         elseif version == "1.02" or version == "02" or version == "2" then
  115.                                 Version = "01.00.02.0581"
  116.                                 writestring("01.00.02.0580", 0x564B34)
  117.                         elseif version == "1.07" or version == "07" or version == "7" then
  118.                                 Version = "01.00.07.0613"
  119.                                 writestring("01.00.07.0613", 0x564B34)
  120.                         elseif version == "1.08" or version == "08" or version == "8" then
  121.                                 Version = "01.00.08.0616"
  122.                                 writestring("01.00.08.0616", 0x564B34)
  123.                         elseif version == "1.09" or version == "09" or version == "9" then
  124.                                 Version = "01.00.09.0620"
  125.                                 writestring("01.00.09.0620", 0x564B34)
  126.                         elseif version == "1.10" or version == "10" then
  127.                                 Version = "01.00.10.0621"
  128.                                 writestring("01.00.10.0621", 0x564B34)
  129.                         else
  130.                                 bool = true
  131.                         end
  132.                         if not bool then
  133.                                 sendconsoletext(executor, "Server version has been changed to " .. tostring(Version) .. "!")
  134.                         else
  135.                                 sendconsoletext(executor, "That is an invalid server version.")
  136.                         end
  137.                 end
  138.         else
  139.                 sendconsoletext(executor, "Invalid Syntax: " .. command .. " {version}")
  140.         end
  141. end

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.