Code: Select all
local handle = io.popen("curl http://ip-api.com/line/%IP")
local strResult = handle:read("*a")
handle:close()
if strResult ~= nil and strResult ~= "" then
local arrResult = Split(strResult, "\n")
if table.maxn(arrResult) > 1 and arrResult[1] == "success" then
local country = arrResult[2]
local bannedCountries = "Country1, Country2, Country3"
if string.find(bannedCountries, country) then
bCancelEvent = true
return
end
end
end
And you can find all the country/region names from this web page: https://www.iplocate.com/en/resources/countries