Somehow you must define your global variable before setting it. This could be done by C-script, c-Lite or by your plugin itself.
If it is a native ENGINE-Variable, you can omit that step.

Once defined, it is possible to have it set by a plugin, e.g. by a C++ dll.
For examples see the SDK-threads in the Higher language folder.