daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     --[[
  3.  
  4.     In order to use this script, you will first need to determine a main server that will house the main ban and admin list.
  5.     This main ban/admin list will be constantly updated from the other servers running this script. Changes to any ban/admin list
  6.     will not take effect immediately, you must restart the servers in order for the new ban/admin lists to be loaded.
  7.  
  8.  
  9.     Requirements:
  10.  
  11.         - More than one server
  12.         - LuaSocket installed on all servers you wish to use this script with
  13.         - A main server that will house the main ban and admin lists
  14.  
  15.     ----------------------------------------------------------------------------------------------------------------------
  16.  
  17.         To setup the FTP portion of the script, you must manually input all the FTP logins of all the servers that you
  18.         wish to run this script on inside the FTPlogins table. The main server that will house the main banlist must take
  19.         up the first position in the table.
  20.  
  21.         URLs MUST conform to RFC 1738, that is, an URL is a string in the form:
  22.  
  23.         [ftp://][<user>[:<password>]@]<host>[:<port>][/<path>]
  24.  
  25.         • PASSWORD: default anonymous password
  26.         • PORT: default port used for the control connection
  27.         • TIMEOUT: sets the timeout for all I/O operations
  28.         • USER: default anonymous user
  29.  
  30.         A typical example: ftp://fulano:silva@ftp.example.com/
  31.  
  32.  
  33.     ----------------------------------------------------------------------------------------------------------------------
  34.     ]]--
  35.  
  36.     -- don't touch these
  37.     FTPlogins = {}
  38.     admins = {}
  39.     banned = {}
  40.  
  41.  
  42.     -- feel free to modify the variables below:
  43.  
  44.     main = true -- True if this is the main server that will house the main admin and banlist
  45.  
  46.     FTPlogins[1] = "" -- Main Server goes here!
  47.     FTPlogins[2] = "" -- Additional servers go here and below. Feel free to add as many servers as you wish, there is no limit
  48.  
  49.  
  50.  
  51.  
  52. function GetRequiredVersion()
  53.  
  54.     return 10057
  55. end
  56.  
  57. function OnScriptLoad(process)
  58.  
  59.     hprintf("ListSync is loading...")
  60.  
  61.     svcmd("sv_sync")
  62.  
  63.  
  64. end
  65.  
  66. function OnScriptUnload()
  67.  
  68.  
  69. end
  70.  
  71. function OnNewGame(map)
  72.  
  73.  
  74. end
  75.  
  76. function OnGameEnd(mode)
  77.  
  78.  
  79. end
  80.  
  81. function OnServerChat(player, chattype, message)
  82.  
  83.     return 1
  84. end
  85.  
  86. function OnServerCommand(player, command)
  87.  
  88.     -- some code below partially created by Wizzy
  89.     local response = 1
  90.     local toksize = getcmdtokencount(command)
  91.     local cmd = getcmdtoken(command, 0)
  92.     local count = gettokencount(command, " ")
  93.     t = {}
  94.  
  95.     for i=1,count do
  96.             local word = gettoken(command, " ", i - 1)
  97.             word = string.lower(word)
  98.             word = word:gsub('"', "")
  99.             table.insert(t, word)
  100.     end
  101.     if t[1] == "sv_sync" then
  102.  
  103.             hprintf("Importing lists...")
  104.            
  105.             LoadAdminsList() --  imports admins from admin.txt, and places them in the admins table
  106.             LoadBannedList() -- imports banned players from banned.txt, places them in banned table
  107.  
  108.             hprintf("Imported " .. table.getn(admins) .. " entrees from admin.txt")
  109.             hprintf("Imported " .. table.getn(banned) .. " entrees from banned.txt")
  110.            
  111.             return 0
  112.     end
  113.  
  114.     return 1
  115. end
  116.  
  117. function OnTeamDecision(team)
  118.  
  119.     return team
  120. end
  121.  
  122. function OnPlayerJoin(player, team)
  123.  
  124.  
  125. end
  126.  
  127. function OnPlayerLeave(player, team)
  128.  
  129.  
  130. end
  131.  
  132. function OnPlayerKill(killer, victim, mode)
  133.  
  134.  
  135. end
  136.  
  137. function OnKillMultiplier(player, multiplier)
  138.  
  139.  
  140. end
  141.  
  142. function OnPlayerSpawn(player, m_objId)
  143.  
  144.  
  145. end
  146.  
  147. function OnPlayerSpawnEnd(player, m_objId)
  148.  
  149.  
  150. end
  151.  
  152. function OnTeamChange(relevant, player, cur_team, dest_team)
  153.  
  154.     return 1
  155. end
  156.  
  157. function OnObjectCreation(m_objId, player, tagName)
  158.  
  159.  
  160. end
  161.  
  162. function OnObjectInteraction(player, m_objId, tagType, tagName)
  163.  
  164.     return 1
  165. end
  166.  
  167. function OnWeaponAssignment(player, m_objId, slot, tagName)
  168.  
  169.     return 0
  170. end
  171.  
  172. function OnWeaponReload(player, m_weapId)
  173.  
  174.     return 1
  175. end
  176.  
  177. function OnDamageLookup(receiver, causer, tagData, tagName)
  178.  
  179.  
  180. end
  181.  
  182. function OnVehicleEntry(relevant, player, m_vehicleId, tagName, seat)
  183.  
  184.     return 1
  185. end
  186.  
  187. function OnVehicleEject(player, forced)
  188.  
  189.     return 1
  190. end
  191.  
  192. function OnClientUpdate(player, m_objId)
  193.  
  194.  
  195. end
  196.  
  197. function LoadAdminsList() -- this function retrieves the data on the adminlist and puts it in the admin table
  198.  
  199.         admins = {} -- clears the admin table
  200.  
  201.         local profilepath = getprofilepath()
  202.         local file = io.open(profilepath .. "\\admin.txt", "r")
  203.         if (file ~= nil) then
  204.                 local t = {}
  205.                 for line in file:lines() do
  206.                         local count = gettokencount(line, ",")
  207.                         if count == 3 then
  208.                                 local name = gettoken(line, ",", 0)
  209.                                 local hash = gettoken(line, ",", 1)
  210.                                 local levl = gettoken(line, ",", 2)
  211.                                 table.insert(t, {name, hash, levl})
  212.                         end
  213.                 end
  214.  
  215.                 local tableCount = table.getn(t)
  216.                 for x = 1, tableCount do
  217.                     table.insert(admins, t[x])
  218.                 end
  219.         else
  220.                 say("The admin list was not found!")
  221.         end
  222.  
  223. end
  224.  
  225. function LoadBannedList() -- this function retrieves the data on the banlist and puts it in the banned table
  226.  
  227.         banned = {} -- clears the ban table
  228.  
  229.         local profilepath = getprofilepath()
  230.         local file = io.open(profilepath .. "\\banned.txt", "r")
  231.         if (file ~= nil) then
  232.                 local t = {}
  233.                 local line_count = 0
  234.                 for line in file:lines() do
  235.                         if line_count ~= 0 then -- skips first line in banned.txt
  236.                                 local name = gettoken(line, ",", 0)
  237.                                 local hash = gettoken(line, ",", 1)
  238.                                 local ban_count = gettoken(line, ",", 2)
  239.                                 local ban_end_date = gettoken(line, ",", 3)
  240.                                 table.insert(t, {name, hash, ban_count, ban_end_date})
  241.                         end
  242.                         line_count = line_count + 1
  243.                 end
  244.  
  245.                 local tableCount = table.getn(t)
  246.                 for x = 1, tableCount do
  247.                     table.insert(banned, t[x])
  248.                 end
  249.         else
  250.                 say("The ban list was not found!")
  251.         end
  252.  
  253. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top