CS0246 is the error i get

Here is the errors Assets/Scipts/MultiplayerManager.cs(8,23): error CS0246: The type or namespace name GUIManager' could not be found. Are you missing a using directive or an assembly reference? also i get Assets/Scipts/MultiplayerManager.cs(238,16): error CS0118: MPPlayer.PlayerManager’ is a field' but a type’ was expected
Here is the script

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MultiplayerManager : MonoBehaviour
{
public static MultiplayerManager instance;
public static GUIManager guiManager;

public GameObject PlayerManagerPrefab;

public string PlayerName;

private string MatchName = “”;
private string MatchPassword = “”;
private int MatchMaxUsers = 32;

public List PlayerList = new List();
public List MapList = new List();

public MapSetting CurrentMap = null;
public int oldprefix;
public bool IsMatchStarted = false;

//General Multiplayer Modes
public bool MatchLoaded;
public MPPlayer MyPlayer;
public GameObject[ ] Spawnpoints;

void Start()
{
instance = this;
PlayerName = PlayerPrefs.GetString(“PlayerName”);
CurrentMap = MapList[0];
DontDestroyOnLoad(gameObject);
}

void FixedUpdate()
{
instance = this;
}

public void StartServer(string servername, string serverpassword, int maxusers)
{
MatchName = servername;
MatchPassword = serverpassword;
MatchMaxUsers = maxusers;
Network.InitializeServer(MatchMaxUsers, 2550, false);
MasterServer.RegisterHost(“DeathMatch”, MatchName, “”);
//Network.InitializeSecurity();
}

void OnServerInitialized()
{
Server_PlayerJoinRequest(PlayerName, Network.player);
}

void OnConnectedToServer()
{
networkView.RPC(“Server_PlayerJoinRequest”, RPCMode.Server, PlayerName, Network.player);
}

void OnPlayerDisconnected(NetworkPlayer id)
{
networkView.RPC(“Client_RemovePlayer”, RPCMode.All, id);
}

void OnPlayerConnected(NetworkPlayer player)
{
foreach(MPPlayer pl in PlayerList)
{
networkView.RPC(“Client_AddPlayerToList”, player, pl.PlayerName, pl.PlayerNetwork);
}
networkView.RPC(“Client_GetMultiplayerMatchSettings”, player, CurrentMap.MapName, “”, “”);
}

void OnDisconnectedFromServer()
{
PlayerList.Clear();
}

[RPC]
void Server_PlayerJoinRequest(string playername, NetworkPlayer view)
{
networkView.RPC(“Client_AddPlayerToList”, RPCMode.All, playername, view);
}

[RPC]
void Client_AddPlayerToList(string playername, NetworkPlayer view)
{
MPPlayer tempplayer = new MPPlayer();
tempplayer.PlayerName = playername;
tempplayer.PlayerNetwork = view;
PlayerList.Add(tempplayer);
if (Network.player == view)
{
MyPlayer = tempplayer;
GameObject play = Network.Instantiate(PlayerManagerPrefab, Vector3.zero, Quaternion.identity, 5) as GameObject;
//play.GetComponent().thisplayer = MyPlayer; //Remove This Part
}
}

[RPC]
void Client_RemovePlayer(NetworkPlayer view)
{
MPPlayer temppl = null;
foreach(MPPlayer pl in PlayerList)
{
if (pl.PlayerNetwork == view)
{
temppl = pl;
}
}
if (temppl != null)
{
PlayerList.Remove(temppl);
}
}

[RPC]
void Client_GetMultiplayerMatchSettings(string map, string mode, string others)
{
CurrentMap = GetMap(map);
}

public MapSetting GetMap(string name)
{
MapSetting get = null;

foreach (MapSetting st in MapList)
{
if (st.MapName == name)
{
get = st;
break;
}
}

return get;
}

[RPC]
void Client_LoadMultiplayerMap(string map, int prefix)
{
//Network.SetLevelPrefix(prefix);
Application.LoadLevel(map);
}

void OnGUI()
{
if (!MyPlayer.PlayerIsAlive && IsMatchStarted)
SpawnMenu();
if (IsMatchStarted && Input.GetKey(KeyCode.Tab))
{
guiManager.ScoreBoard();
}
}

[RPC]
void Server_SpawnPlayer(NetworkPlayer player)
{
int numberspawn = Random.Range(0, Spawnpoints.Length - 1);
networkView.RPC(“Client_SpawnPlayer”, RPCMode.All, player, Spawnpoints[numberspawn].transform.position + new Vector3(0, 2, 0), Spawnpoints[numberspawn].transform.rotation);
}

[RPC]
void Client_SpawnPlayer(NetworkPlayer player, Vector3 position, Quaternion rotation)
{
MultiplayerManager.GetMPPlayer(player).PlayerIsAlive = true;
MultiplayerManager.GetMPPlayer(player).PlayerHealth = 100;
if (player == MyPlayer.PlayerNetwork)
{
MyPlayer.PlayerManager.ControllerTransform.position = position;
MyPlayer.PlayerManager.ControllerTransform.rotation = rotation;
MyPlayer.PlayerManager.networkView.RPC(“Client_PlayerAlive”, RPCMode.All);
}
else
{

}
}

void OnLevelWasLoaded()
{
if (Application.loadedLevelName == CurrentMap.MapLoadName && Network.isServer)
{
MatchLoaded = true;
Spawnpoints = GameObject.FindGameObjectsWithTag(“spawnpoint”);
networkView.RPC(“Client_ServerLoaded”, RPCMode.AllBuffered, IsMatchStarted);//Add parameter for boolean IsMatchStarted
}
}

[RPC]
void Client_ServerLoaded(bool started)//Add parameter for boolean IsMatchStarted
{
MatchLoaded = true;
IsMatchStarted = started;
}

public static MPPlayer GetMPPlayer(NetworkPlayer player)
{
foreach (MPPlayer play in MultiplayerManager.instance.PlayerList)
{
if (play.PlayerNetwork == player)
{
return play;
}
}
return null;
}

//Deathmatch
void SpawnMenu()
{
if (GUI.Button(new Rect(5, Screen.height - 40, 250, 35), “Spawn”))
{
if (Network.isServer)
Server_SpawnPlayer(Network.player);
else
networkView.RPC(“Server_SpawnPlayer”, RPCMode.Server, Network.player);
}
}

[RPC]
public void Client_UpdatePlayerHealthAndAlive(NetworkPlayer targetplayer, bool IsAlive, int CurrentHealth)
{
MPPlayer player = MultiplayerManager.GetMPPlayer(targetplayer);
player.PlayerIsAlive = IsAlive;
player.PlayerHealth = CurrentHealth;
}
}

[System.Serializable]
public class MPPlayer
{
public string PlayerName = “”;
public NetworkPlayer PlayerNetwork;
public PlayerManager PlayerManager;
public int PlayerHealth = 100;
public bool PlayerIsAlive;
public int PlayerScore;
public int PlayerKills;
public int PlayerDeahts;
}

[System.Serializable]
public class MapSetting
{
public string MapName;
public string MapLoadName;
public Texture MapLoadTexture;
}

Code tags.

how

I’m not very framiler with them can you just tell me how to fix please

You can use the Insert option on the bar when you’re editing ^ and no, no one’s going to even try to read your code without code tags first. Also, try not to double-post, it takes time to see that a response occurred and more time to respond myself.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MultiplayerManager : MonoBehaviour
{
    public static MultiplayerManager instance;
    public static GUIManager guiManager;

    public GameObject PlayerManagerPrefab;

    public string PlayerName;

    private string MatchName = "";
    private string MatchPassword = "";
    private int MatchMaxUsers = 32;

    public List<MPPlayer> PlayerList = new List<MPPlayer>();
    public List<MapSetting> MapList = new List<MapSetting>();

    public MapSetting CurrentMap = null;
    public int oldprefix;
    public bool IsMatchStarted = false;

    //General Multiplayer Modes
    public bool MatchLoaded;
    public MPPlayer MyPlayer;
    public GameObject[] Spawnpoints;

    void Start()
    {
        instance = this;
        PlayerName = PlayerPrefs.GetString("PlayerName");
        CurrentMap = MapList[0];
        DontDestroyOnLoad(gameObject);
    }

    void FixedUpdate()
    {
        instance = this;
    }

    public void StartServer(string servername, string serverpassword, int maxusers)
    {
        MatchName = servername;
        MatchPassword = serverpassword;
        MatchMaxUsers = maxusers;
        Network.InitializeServer(MatchMaxUsers, 2550, false);
        MasterServer.RegisterHost("DeathMatch", MatchName, "");
        //Network.InitializeSecurity();
    }

    void OnServerInitialized()
    {
        Server_PlayerJoinRequest(PlayerName, Network.player);
    }

    void OnConnectedToServer()
    {
        networkView.RPC("Server_PlayerJoinRequest", RPCMode.Server, PlayerName, Network.player);
    }

    void OnPlayerDisconnected(NetworkPlayer id)
    {
        networkView.RPC("Client_RemovePlayer", RPCMode.All, id);
    }

    void OnPlayerConnected(NetworkPlayer player)
    {
        foreach(MPPlayer pl in PlayerList)
        {
            networkView.RPC("Client_AddPlayerToList", player, pl.PlayerName, pl.PlayerNetwork);
        }
        networkView.RPC("Client_GetMultiplayerMatchSettings", player, CurrentMap.MapName, "", "");
    }

    void OnDisconnectedFromServer()
    {
        PlayerList.Clear();
    }

    [RPC]
    void Server_PlayerJoinRequest(string playername, NetworkPlayer view)
    {
        networkView.RPC("Client_AddPlayerToList", RPCMode.All, playername, view);
    }

    [RPC]
    void Client_AddPlayerToList(string playername, NetworkPlayer view)
    {
        MPPlayer tempplayer = new MPPlayer();
        tempplayer.PlayerName = playername;
        tempplayer.PlayerNetwork = view;
        PlayerList.Add(tempplayer);
        if (Network.player == view)
        {
            MyPlayer = tempplayer;
            GameObject play = Network.Instantiate(PlayerManagerPrefab, Vector3.zero, Quaternion.identity, 5) as GameObject;
            //play.GetComponent<PlayerManager>().thisplayer = MyPlayer; //Remove This Part
        }
    }

    [RPC]
    void Client_RemovePlayer(NetworkPlayer view)
    {
        MPPlayer temppl = null;
        foreach(MPPlayer pl in PlayerList)
        {
            if (pl.PlayerNetwork == view)
            {
                temppl = pl;
            }
        }
        if (temppl != null)
        {
            PlayerList.Remove(temppl);
        }
    }

    [RPC]
    void Client_GetMultiplayerMatchSettings(string map, string mode, string others)
    {
        CurrentMap = GetMap(map);
    }

    public MapSetting GetMap(string name)
    {
        MapSetting get = null;

        foreach (MapSetting st in MapList)
        {
            if (st.MapName == name)
            {
                get = st;
                break;
            }
        }

        return get;
    }

    [RPC]
    void Client_LoadMultiplayerMap(string map, int prefix)
    {
        //Network.SetLevelPrefix(prefix);
        Application.LoadLevel(map);
    }

    void OnGUI()
    {
        if (!MyPlayer.PlayerIsAlive && IsMatchStarted)
            SpawnMenu();
        if (IsMatchStarted && Input.GetKey(KeyCode.Tab))
        {
            guiManager.ScoreBoard();
        }
    }

    [RPC]
    void Server_SpawnPlayer(NetworkPlayer player)
    {
        int numberspawn = Random.Range(0, Spawnpoints.Length - 1);
        networkView.RPC("Client_SpawnPlayer", RPCMode.All, player, Spawnpoints[numberspawn].transform.position + new Vector3(0, 2, 0), Spawnpoints[numberspawn].transform.rotation);
    }

    [RPC]
    void Client_SpawnPlayer(NetworkPlayer player, Vector3 position, Quaternion rotation)
    {
        MultiplayerManager.GetMPPlayer(player).PlayerIsAlive = true;
        MultiplayerManager.GetMPPlayer(player).PlayerHealth = 100;
        if (player == MyPlayer.PlayerNetwork)
        {
            MyPlayer.PlayerManager.ControllerTransform.position = position;
            MyPlayer.PlayerManager.ControllerTransform.rotation = rotation;
            MyPlayer.PlayerManager.networkView.RPC("Client_PlayerAlive", RPCMode.All);
        }
        else
        {

        }
    }

    void OnLevelWasLoaded()
    {
        if (Application.loadedLevelName == CurrentMap.MapLoadName && Network.isServer)
        {
            MatchLoaded = true;
            Spawnpoints = GameObject.FindGameObjectsWithTag("spawnpoint");
            networkView.RPC("Client_ServerLoaded", RPCMode.AllBuffered, IsMatchStarted);//Add parameter for boolean IsMatchStarted
        }
    }

    [RPC]
    void Client_ServerLoaded(bool started)//Add parameter for boolean IsMatchStarted
    {
        MatchLoaded = true;
        IsMatchStarted = started;
    }

    public static MPPlayer GetMPPlayer(NetworkPlayer player)
    {
        foreach (MPPlayer play in MultiplayerManager.instance.PlayerList)
        {
            if (play.PlayerNetwork == player)
            {
                return play;
            }
        }
        return null;
    }

    //Deathmatch
    void SpawnMenu()
    {
        if (GUI.Button(new Rect(5, Screen.height - 40, 250, 35), "Spawn"))
        {
            if (Network.isServer)
                Server_SpawnPlayer(Network.player);
            else
                networkView.RPC("Server_SpawnPlayer", RPCMode.Server, Network.player);
        }
    }

    [RPC]
    public void Client_UpdatePlayerHealthAndAlive(NetworkPlayer targetplayer, bool IsAlive, int CurrentHealth)
    {
        MPPlayer player = MultiplayerManager.GetMPPlayer(targetplayer);
        player.PlayerIsAlive = IsAlive;
        player.PlayerHealth = CurrentHealth;
    }
}

[System.Serializable]
public class MPPlayer
{
    public string PlayerName = "";
    public NetworkPlayer PlayerNetwork;
    public PlayerManager PlayerManager;
    public int PlayerHealth = 100;
    public bool PlayerIsAlive;
    public int PlayerScore;
    public int PlayerKills;
    public int PlayerDeahts;
}

[System.Serializable]
public class MapSetting
{
    public string MapName;
    public string MapLoadName;
    public Texture MapLoadTexture;
}

there

Click the insert button.

i did

The first problem is that no script called GUIManager exists in the current namespace. The following are possibilities:

  • There’s no script with that name. Check the spelling and capitalization and make sure it matches the name of the script/class perfectly.
  • There is a script with that name, but the class is not the same namespace. In that case you’ll either have to refer to it with namespace.GUIManager instead, or include the namespace in the current scope with “using NamespaceName;” at the top of your script.

The second problem appears to be that in the following line:

public PlayerManager PlayerManager;

the name of the variable is the same as the name of the variable type. Change the name so it doesn’t conflict with a typename and it should work fine. Or rather, does that type even exist? Did you mean to say MultiplayerManager PlayerManager? You’ll figure it out, I’m sure.