1. hellos , sorry for my english but I'm french.

    I would like to create a plugin that kick the player that connects when the server reaches a number of players.

    I find this function that returns an int the number of players but I have an error when I test my plugin.
    Code:
    GameManager.GetPlayerCount()
    An object reference is required to access non-static member `GameManager.GetPlayerCount()'

    I have not much knowledge in C# but in another language yes Thanks for your help
     
  2. Wulf

    Wulf Community Admin

    Code:
    GameManager.Instance.GetPlayerCount()
    PS. I will be porting my Reserved plugin to Hurtworld once I get a chance. :)
     
  3. merci pour votre aide, tout cela était-bête


    [edit] new question


    why ? after Instance

    Code:
    ChatManager.Instance?.AppendChatboxServerAll("<color=" + CMDColor + ">" + CMDTitle + "</color> " + test);
    my code

    Code:
    void OnPlayerConnected(PlayerIdentity identity, uLink.NetworkPlayer player)
            {
             
            int nombre = GameManager.Instance.GetPlayerCount(); 
     
            if(nombre >= 77)
            {
         
            ConsoleManager.Instance?.ExecuteCommand("kick "+identity.SteamId.m_SteamID.ToString()+" Admin slot merci!!!");
             
            }
             
            }
    why no found player here?

    may be that the player is not yet in games to be kick ?

    Code:
    kick 76561198173968135 Admin slot merci!!!
    No player found with that code.
     
    Last edited by a moderator: Dec 13, 2015