Exemple #1
0
        public String GetWelcomeMessage(bool includeUsername = false)
        {
            int    currentDay     = DateTime.Now.Day;
            int    currentMonth   = DateTime.Now.Month;
            String replace        = "";
            String welcomeMessage = "Welcome to ^5WeRP^0!\n › Run ^5/help^0 to see the available commands\n › ^5/rules^0 to see our rules\n › ^5/contact^0 to contact us!";

            if (currentMonth == 1 && currentDay == 1)             // New Years
            {
                replace = "Happy New Years";
            }
            else if (currentMonth == 12)             // Christmas
            {
                replace = "^1Happy ^2Holidays^0";
            }

            if (replace != "")
            {
                welcomeMessage = welcomeMessage.Replace("Welcome to", replace + " from");
            }

            if (includeUsername)
            {
                int    playerId   = Game.Player.ServerId;
                String playerName = API.GetPlayerName(API.GetPlayerFromServerId(playerId));

                welcomeMessage = welcomeMessage.Replace("^5WeRP^0", "^5WeRP^0, " + playerName);
            }

            return(welcomeMessage);
        }
Exemple #2
0
        private void PlayerSpawned(ExpandoObject spawned)
        {
            if (this.welcomeMessageShown)
            {
                return;
            }

            int    playerId   = API.GetPlayerIndex();
            String playerName = API.GetPlayerName(API.GetPlayerFromServerId(playerId));

            // TODO: Change the message to say "Welcome back" instead of "Welcome" if the player has joined before
            TriggerEvent("chatMessage", "", new int[] { 255, 255, 255 }, this.GetWelcomeMessage(true));
            this.welcomeMessageShown = true;
        }