예제 #1
0
 public void Ban(coGameConnection client)
     {
     MessageAll("MsgAdminForce", console.ColorEncode(@"\c2The Admin has banned %1."), client["playerName"]);
     if (!client.isAIControlled())
         console.Call_Classname("BanList", "add", new[] {client["guid"], client.getAddress(), sGlobal["$Pref::Server::BanTime"]});
     client.delete("You have been banned from this server");
     }
        public void GameConnectionOnConnect(coGameConnection client, string name)
            {
            // Send down the connection error info, the client is
            // responsible for displaying this message if a connection
            // error occures.
            MessageClient(client, "MsgConnectionError", "", sGlobal["$Pref::Server::ConnectionError"]);
            // Send mission information to the client
            SendLoadInfoToClient(client);
            // Simulated client lag for testing...
            // %client.setSimulatedNetParams(0.1, 30);

            // Get the client's unique id:
            // %authInfo = %client.getAuthInfo();
            // %client.guid = getField( %authInfo, 3 );

            client["guid"] = "0";


            AddToServerGuidList(client["guid"]);
            // Set admin status
            if (client.getAddress() == "local")
                {
                client["isAdmin"] = true.AsString();
                client["isSuperAdmin"] = true.AsString();
                }
            else
                {
                client["isAdmin"] = false.AsString();
                client["isSuperAdmin"] = false.AsString();
                }
            // Save client preferences on the connection object for later use.

            client["gender"] = "Male";
            client["armor"] = "Light";
            client["race"] = "human";
            client["skin"] = console.addTaggedString("base");

            GameConnectionSetPlayerName(client, name);
            client["team"] = "";
            client["score"] = "0";

            console.print("CADD: " + client + " " + client.getAddress());


            // If the mission is running, go ahead download it to the client
            if (missionRunning)
                GameConnectionLoadMission(client);
            else if (Server__LoadFailMsg != "")
                MessageClient(client, "MsgLoadFailed", Server__LoadFailMsg);

            Server__PlayerCount++;
            }
        public void GameConnectiononDrop(coGameConnection client, string reason)
            {
            GameConnectionOnClientLeaveGame(client);

            RemoveFromServerGuidList(client["guid"]);

            MessageAllExcept(client, "-1", "MsgClientDrop", console.ColorEncode(@"\c1%1 has left the game."), client["playerName"], client);


            console.removeTaggedString(client["playerName"]);

            console.print(string.Format("CDROP: {0} {1}", client, client.getAddress()));


            Server__PlayerCount--;
            }