Plugin code is regular PHP, and should be written as if editing the vBulletin scripts directly.
When adding code to a plugin, you should bear in mind that your code will have access to all variables and classes that are exposed at the point where the hook is placed.