client network ..........

I have a game where a server and many different clients can connect. The network system is set up and right now we can have many players playing the game. I got alot of help from the unity car racing tutorial. My is question is the following I have many different player prefabs( mainly the difference is the model), however right now every client that connects gets the same player prefab. How can I set it up such that each client that connects to the server gets a different player prefab. For example lets say I have 5 prefabs and the game has a total of 5 players. How can the client know that this prefab was already chose by a different client. Mianly what Im trying to do is that these 5 players have the 5 different prefabs.

var playerPrefab : Transform;
var playerPrefab1 : Transform;
var playerPrefab2 : Transform;
var playerPrefab3 : Transform;
var playerPrefab4 : Transform;
function OnNetworkLoadedLevel ()
{
    // Randomize starting location
    var pos : Vector3;
    pos.x = 0;
    pos.y = 0;
    pos.z = 0;
    Network.Instantiate(playerPrefab, pos, transform.rotation, 0);
}

function OnPlayerDisconnected (player : NetworkPlayer)
{
    Debug.Log("Server destroying player");
    Network.RemoveRPCs(player, 0);
    Network.DestroyPlayerObjects(player);
}

The problem with doing this is that all clients are going to be running the OnNetworkLoadedLevel() at roughly the same moment in time. So they would all just grab the first prefab no matter what.

A better way to do it would be to have the server keep track of the players who are connected to the game, and each time the level changes start handing out the prefabs instead of letting the clients grab them.

So you would probably set up and RPC in the code that reads something like this.

OnNetworkLoadedLevel(){

    if(Network.isServer){
        foreach(var player in playerArray){
            player.networkView.RPC("SendPrefab", RPCMode.Others, playerPrefab);
        }
    }
}

function SendPrefab(prefabToAssign : Transform){
    myPrefab = prefabToAssign;
}

Now after doing this all the players will have whichever prefab you told them to have and you can go about instantiating the objects on the network whichever way to want and all will have the different prefabs that you told them to have.

Hope this helps a little.