how to make a security query like in monkey island 2 for example?
There: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=38367.0
You can find a very valid discussion. And I find the security measure utterly pointless. Unless you want to make a puzzle in your game in the same mechanism.
Holy shit! Peter Fonda is using AGS!!! :o Loved you in Easy Rider, man! ;)
If you intend to sell your game, there are several proprietary DRM wrappers that can protect your game moderately (though *any* software will be cracked if its popular enough to make the effort), but they're quite expensive. Also, some of the online distribution portals like Big Fish Games add their own copy protection if they choose to publish your game. Implementing your own security measures through AGS is pointless at best, as Dualnames said, but more likely just a pain in the ass for paying customers.
I just need a script for a randomly asked stuff the player has to answer to make progress, something like typing a four-digit number for opening a door. I want to protect some parts/rooms ;) the game will be free :D