message in form

I try to give a message to the user, when the user is not allowed to call my application.

In my form I call sc_message() in OnScriptInit but then comes the error :
Uncaught Error: Call to undefined function sc_message()

Call in OnLoad is the same error. In the documentation it is correct in my event.

How can I throw a message/alert but in OnScriptInit

what about sc_error_message ?

In the onscriptinit you are not in page mode so ajax message will not work. In general I use a small control application that displays a configured error and is called from spots where I want to terminate the application.