The main function is executed on the server if you start a server instance, and on the client when you start the client instance. If the main function (or any function) calls another function it is executed on the same place where the calling function is running.

If you create an entity with ent_create, its function is executed on the server.

If you create an entity with ent_createlocal, its function is executed on the creating client.

Actions run on the server by default, unless dplay_localfunction is on.