Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- In order to use this script, you will first need to determine a main server that will house the main ban and admin list.
- This main ban/admin list will be constantly updated from the other servers running this script. Changes to any ban/admin list
- will not take effect immediately, you must restart the servers in order for the new ban/admin lists to be loaded.
- Requirements:
- - More than one server
- - LuaSocket installed on all servers you wish to use this script with
- - A main server that will house the main ban and admin lists
- ----------------------------------------------------------------------------------------------------------------------
- To setup the FTP portion of the script, you must manually input all the FTP logins of all the servers that you
- wish to run this script on inside the FTPlogins table. The main server that will house the main banlist must take
- up the first position in the table.
- URLs MUST conform to RFC 1738, that is, an URL is a string in the form:
- [ftp://][<user>[:<password>]@]<host>[:<port>][/<path>]
- • PASSWORD: default anonymous password
- • PORT: default port used for the control connection
- • TIMEOUT: sets the timeout for all I/O operations
- • USER: default anonymous user
- A typical example: ftp://fulano:silva@ftp.example.com/
- ----------------------------------------------------------------------------------------------------------------------
- ]]--
- -- don't touch these
- FTPlogins = {}
- admins = {}
- banned = {}
- -- feel free to modify the variables below:
- main = true -- True if this is the main server that will house the main admin and banlist
- FTPlogins[1] = "" -- Main Server goes here!
- FTPlogins[2] = "" -- Additional servers go here and below. Feel free to add as many servers as you wish, there is no limit
- function GetRequiredVersion()
- return 10057
- end
- function OnScriptLoad(process)
- hprintf("ListSync is loading...")
- svcmd("sv_sync")
- end
- function OnScriptUnload()
- end
- function OnNewGame(map)
- end
- function OnGameEnd(mode)
- end
- function OnServerChat(player, chattype, message)
- return 1
- end
- function OnServerCommand(player, command)
- -- some code below partially created by Wizzy
- local response = 1
- local toksize = getcmdtokencount(command)
- local cmd = getcmdtoken(command, 0)
- local count = gettokencount(command, " ")
- t = {}
- for i=1,count do
- local word = gettoken(command, " ", i - 1)
- word = string.lower(word)
- word = word:gsub('"', "")
- table.insert(t, word)
- end
- if t[1] == "sv_sync" then
- hprintf("Importing lists...")
- LoadAdminsList() -- imports admins from admin.txt, and places them in the admins table
- LoadBannedList() -- imports banned players from banned.txt, places them in banned table
- hprintf("Imported " .. table.getn(admins) .. " entrees from admin.txt")
- hprintf("Imported " .. table.getn(banned) .. " entrees from banned.txt")
- return 0
- end
- return 1
- end
- function OnTeamDecision(team)
- return team
- end
- function OnPlayerJoin(player, team)
- end
- function OnPlayerLeave(player, team)
- end
- function OnPlayerKill(killer, victim, mode)
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, m_objId)
- end
- function OnPlayerSpawnEnd(player, m_objId)
- end
- function OnTeamChange(relevant, player, cur_team, dest_team)
- return 1
- end
- function OnObjectCreation(m_objId, player, tagName)
- end
- function OnObjectInteraction(player, m_objId, tagType, tagName)
- return 1
- end
- function OnWeaponAssignment(player, m_objId, slot, tagName)
- return 0
- end
- function OnWeaponReload(player, m_weapId)
- return 1
- end
- function OnDamageLookup(receiver, causer, tagData, tagName)
- end
- function OnVehicleEntry(relevant, player, m_vehicleId, tagName, seat)
- return 1
- end
- function OnVehicleEject(player, forced)
- return 1
- end
- function OnClientUpdate(player, m_objId)
- end
- function LoadAdminsList() -- this function retrieves the data on the adminlist and puts it in the admin table
- admins = {} -- clears the admin table
- local profilepath = getprofilepath()
- local file = io.open(profilepath .. "\\admin.txt", "r")
- if (file ~= nil) then
- local t = {}
- for line in file:lines() do
- local count = gettokencount(line, ",")
- if count == 3 then
- local name = gettoken(line, ",", 0)
- local hash = gettoken(line, ",", 1)
- local levl = gettoken(line, ",", 2)
- table.insert(t, {name, hash, levl})
- end
- end
- local tableCount = table.getn(t)
- for x = 1, tableCount do
- table.insert(admins, t[x])
- end
- else
- say("The admin list was not found!")
- end
- end
- function LoadBannedList() -- this function retrieves the data on the banlist and puts it in the banned table
- banned = {} -- clears the ban table
- local profilepath = getprofilepath()
- local file = io.open(profilepath .. "\\banned.txt", "r")
- if (file ~= nil) then
- local t = {}
- local line_count = 0
- for line in file:lines() do
- if line_count ~= 0 then -- skips first line in banned.txt
- local name = gettoken(line, ",", 0)
- local hash = gettoken(line, ",", 1)
- local ban_count = gettoken(line, ",", 2)
- local ban_end_date = gettoken(line, ",", 3)
- table.insert(t, {name, hash, ban_count, ban_end_date})
- end
- line_count = line_count + 1
- end
- local tableCount = table.getn(t)
- for x = 1, tableCount do
- table.insert(banned, t[x])
- end
- else
- say("The ban list was not found!")
- end
- end
Add Comment
Please, Sign In to add comment