It works because, by default, PATH environment variable has /usr/local/bin before /usr/bin.
The script uses official pamac commands only after checking the internet connection exists. If however the connection does not exist, it gives a textual warning about it inside a text editor window.

Please try this and report any issues, and give potential suggestions in this thread.
If people find it useful, I could put it onto Github as a downloadable package.