I think this question has already been asked many times, but I can't find any of them. I have a game project (I'm using Marmalade),and a few trusted developers, but I want to invite more. For adding some functionality, for writing scripts and so on. The question is - how can I don't give them the whole source code (only compiled part of it maybe), and/or give them limited rights to the project for doing them their work, but dont have the opportunity to steal the code?
Rights and capabilities are very different. In fact, legal rights were invented largely because access issues couldn't be solved by enforcing technical capabilities. Sure, we put locks on our cars and houses; but that's really only a first level of defense to deter casual vandalism - a career criminal isn't deterred, and not much hindered either. There is also a layer of legal convention that we rely on, and all things considered, the legal protection is more important: it doesn't prevent individual abuses, but it has the full weight of the state and the community behind it, and when it hits, the perp is going down.
Applied to your question: software law, inconvenient and difficult as it can be, is almost certainly more important for protecting your assets than access control. It's unlikely that you can really separate parts of your application so that others can do useful work on only parts. Overall it is almost certainly better to get a legal agreement in place and hold them to it than try to establish technical controls that are probably either ineffective or hinder their work.
If you're contracting into an area where you don't trust the legal system to protect you, then you're pretty much on your own. In such a situation I would seriously reconsider whether you should be outsourcing at all.
You'll have to split the code repository (assuming you want to give them access to the repo) or have a SCN that allows you to set access permissions so certain groups cannot read parts of the repo. If you use git, you're stuck with the former - splitting the code into modules and only giving out access to some modules.
You'll have to determine how much of the code is required for their access, if they only need binaries (and headers/wdsl/etc) then you could store binaries and required sources in a new repo (populated automatically by your CI system) and give them access to that.
You'll have to tell more in order to get better answers, without knowing the specific details, your question is a bit 'generic'.
Have the core of your game engine as a binary, but implement most gameplay-relevant systems and components in form of separately compiled plugins which use a common API to communicate with the core engine. This should enable developers to create plugins with just the binary versions of the core and the other plugins. This architecture can then also be used by modders to create 3rd party add-ons for your game.
However, this will be a lot of work and won't be the most productive way of working for your team members. When you want to be productive, you should just give them access to the source and control them legally through having them sign a non-disclosure agreement. Also remember that you retain the copyright of your code even when you show it to others. So when they really steal your code and you can prove it, you can sue them for copyright violation.