mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
31
lua/e_protect/modules/sv_iplogger.lua
Normal file
31
lua/e_protect/modules/sv_iplogger.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local function handleIPLoggin(ply, ip)
|
||||
local sid64 = ply:SteamID64()
|
||||
http.Fetch("http://ip-api.com/json/"..ip, function(json)
|
||||
json = util.JSONToTable(json)
|
||||
local result = json["countryCode"]
|
||||
|
||||
if !result then result = "N/A" end
|
||||
|
||||
eProtect.registerIP(sid64, ip, result)
|
||||
end, function()
|
||||
eProtect.registerIP(sid64, ip, "N/A")
|
||||
end)
|
||||
end
|
||||
|
||||
hook.Add("PlayerInitialSpawn", "eP:IPLogging", function(ply)
|
||||
if ply:IsBot() or eProtect.config["disabledModules"]["identifier"] then return end
|
||||
local plyIP = ply:IPAddress()
|
||||
local ip = string.sub(plyIP, 1, string.find(plyIP, ":") - 1)
|
||||
|
||||
handleIPLoggin(ply, ip)
|
||||
end)
|
||||
Reference in New Issue
Block a user