Skip to content

Instantly share code, notes, and snippets.

@AliLogic
Last active November 24, 2019 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AliLogic/06ecfcd09473282161305d5677b126f0 to your computer and use it in GitHub Desktop.
Save AliLogic/06ecfcd09473282161305d5677b126f0 to your computer and use it in GitHub Desktop.
Formerly hard bans, IP bans is a IP range based system that completely stops the client from connecting to the server. This is tested and works, you will need to setup a database table for it however.
-- START OF THE FILE
--
-- Developed by 28days (AliLogic)
-- for Roleplay Studios (RPS)
-- 2019 (c)
--
AddEvent("OnClientConnectionRequest", function(ip, port)
local string = ip
local check = {}
local bReturn = true
string = string .. "."
for w in string:gmatch("(%d+).") do
table.insert(check, w)
end
local result = mariadb_await_query(db, "SELECT * FROM ipbans WHERE ip LIKE '"..check[1].."."..check[2]..".%.%' LIMIT 1", true)
if mariadb_get_row_count() ~= 0 then
bReturn = false
end
mariadb_delete_result(result)
return bReturn
end)
--
-- END OF THE FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment