[Script] Check if connected to the internet

RizbIT

Member
Code:
/*
Internet Connected Script
By RizbIT, UK
http://Rizbit.uk

This script is a rather simple approach to check if your device or PC is connected to the internet.
It seems to work on all the devices i tested it on.  Android, PC, Windows Phone etc..

It will return true if internet connection present or false if non present

It does this by trying to resolve the IP address of a website.  So if it cant we "assume" that
there is no internet connection.  We use Google as its more likely to be working compared to other
sites, thus prevents us from getting false results.

*/


if !string_count(".",string(network_resolve("www.google.com")))
 return false
else
 return true
Hope you find it useful
 

Slyddar

Member
Hi, thanks for the script. It does work, but on Android it takes about 30 seconds to resolve if there is no network, during which time the screen is black. I have it set to check at game start. How have you utilised it to avoid this problem?
 

RizbIT

Member
tbh on my phone it did it quite fast on no connection.

what country are you in?

maybe use a website in your own country
like google.mycountry
 
Top