Last active
November 24, 2019 15:02
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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