• Is it possible to get IP address of player in singleplayer and client side?
    12 replies, posted
In singleplayer "playerIPAddress()" returns "loopback" D:
well, it's against GDPR, but you can ping a website like https://api.ipify.org/ with HTTP library
I'm wondering why you would want to get the IP of a player in singleplayer?
Yeah... One could be forgiven for being a little suspicious about this.
He lives in Russia and it isn't even against it because this is a needed information.
It depends on what the data is used for. Here is a good snippet about geolocation: If the data is not precise enough to indicate the specific geographic position of the terminal equipment of an individual (for example when the IP address is used to determine the country for statistics or to select a language or applicable legislation for a given individual), it would most likely not require consent. Doesn't matter. GDPR is applied globally, If you process any EU residents´ personal data or target the EU market. I'm surprised that a lot of people on FP, still think that GDPR doesn't apply to companies and web-services outside EU. The keyword here is 'consent'. Just because some information is needed, doesn't mean you don't have to ask the user for consent.
I don't think there is a real "singleplayer" in Gmod, what is really happening is that you are connecting to a local server on your computer using the loopback. This function works as intended. (tbh I think it should return localhost or 127.0.0.1 instead of loopback but who am I to judge?)
GDPR is only good when it's enforced. Russia isn't enforcing it, they certainly won't extradite for it, and there's no retaliation EU powers can make in such a case.
This is not how the market, politics or anything in the world works. I would strongly suggest you read on how the GDPR works and are enforced. There are a good reason why US-newsites are blocking EU-citizens.
I'm aware of how it works. I'm also aware that without any physical presence (which these news sites you mention are likely to have with their parent companies) in the EU, enforcement falls onto the home country. Good luck having anyone outside the EU enforce GDPR without high profile cases and a treaty to back it up. They're certainly not doing anything about anything anyone on this forum is doing. If they were, again, how do you expect that to be enforced outside of an angry letter to blocked traffic at worse?
You guys are talking about GDPR when all this guy asks is how to get an IP address in Lua. If he stores it, yeah sure GDPR kicks in, but hes talking about singleplayer AND client-side. There's nowhere that he implies he'll save it or even move it off the users device.
It's very suspicious to be trying to get a player's IP address in single-player and without their consent. It sounds to me like you're trying to create some sort of backdoor, especially with that smiley face in your post: D: But if your intentions are legitimate, then it would be ethical to get the player's consent in some form. You could simply write "This addon will track your IP address and store it, if necessary." on the addon's Steam Workshop page, as a form of consent. You may use http.Fetch or http.Post to accomplish what you're trying to do. Just do keep in mind the ethical aspect and the legalities.
Using IP adresses in this situation seems unavoidable, but I can't be sure unless I know what you plan to do with it. Possibly... Broad Geolocation? https://wiki.garrysmod.com/page/system/GetCountry User Gateway (admin list, dev access, white/blacklist, etc)? Player/SteamID64 WHOIS info such as ISP for some reason? Just don't. There is no practical reason for that. Sidenote, if you want to use IP adresses for more specific location, including even the city they are in, then you definitely want to ask them about it. Unprotected public IP adresses can yield this type of info. Sidenote #2, if the "and client side" part is the limiting factor, look into this: Net Library Usage
Sorry, you need to Log In to post a reply to this thread.