Пример #1
0
        public void OnPlayerConnected(Client player)
        {
            // Set the default skin and transparency
            NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM);
            player.Transparency = 255;

            // Initialize the player data
            Character.InitializePlayerData(player);

            Task.Factory.StartNew(() =>
            {
                NAPI.Task.Run(() =>
                {
                    AccountModel account = Database.GetAccount(player.SocialClubName);

                    switch (account.status)
                    {
                    case -1:
                        player.SendChatMessage(Constants.COLOR_INFO + InfoRes.account_disabled);
                        player.Kick(InfoRes.account_disabled);
                        break;

                    case 0:
                        // Check if the account is registered or not
                        player.TriggerEvent(account.registered ? "accountLoginForm" : "showRegisterWindow");
                        break;

                    default:
                        // Welcome message
                        string welcomeMessage = string.Format(GenRes.welcome_message, player.SocialClubName);
                        player.SendChatMessage(welcomeMessage);
                        player.SendChatMessage(GenRes.welcome_hint);
                        player.SendChatMessage(GenRes.help_hint);
                        player.SendChatMessage(GenRes.ticket_hint);

                        if (account.lastCharacter > 0)
                        {
                            // Load selected character
                            PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                            SkinModel skinModel   = Database.GetCharacterSkin(account.lastCharacter);

                            player.Name = character.realName;
                            player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                            NAPI.Player.SetPlayerSkin(player, character.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                            Character.LoadCharacterData(player, character);
                            Customization.ApplyPlayerCustomization(player, skinModel, character.sex);
                            Customization.ApplyPlayerClothes(player);
                            Customization.ApplyPlayerTattoos(player);
                        }

                        // Activate the login window
                        player.SetSharedData(EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss"));

                        break;
                    }
                });
            });
        }
Пример #2
0
        public void OnPlayerConnected(Client player)
        {
            // Set the default skin and transparency
            NAPI.Player.SetPlayerSkin(player, PedHash.Strperf01SMM);
            player.Transparency = 255;

            // Initialize the player data
            InitializePlayerData(player);

            Task.Factory.StartNew(() =>
            {
                AccountModel account = Database.GetAccount(player.SocialClubName);

                switch (account.status)
                {
                case -1:
                    player.SendChatMessage(Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED);
                    player.Kick(Messages.INF_ACCOUNT_DISABLED);
                    break;

                case 0:
                    // Show the register window
                    player.TriggerEvent("showRegisterWindow");
                    break;

                default:
                    // Welcome message
                    string welcomeMessage = string.Format(Messages.GEN_WELCOME_MESSAGE, player.SocialClubName);
                    player.SendChatMessage(welcomeMessage);
                    player.SendChatMessage(Messages.GEN_WELCOME_HINT);
                    player.SendChatMessage(Messages.GEN_HELP_HINT);
                    player.SendChatMessage(Messages.GEN_TICKET_HINT);

                    if (account.lastCharacter > 0)
                    {
                        // Load selected character
                        PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                        SkinModel skinModel   = Database.GetCharacterSkin(account.lastCharacter);

                        player.Name = character.realName;
                        player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                        NAPI.Player.SetPlayerSkin(player, character.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                        LoadCharacterData(player, character);
                        Customization.ApplyPlayerCustomization(player, skinModel, character.sex);
                        Customization.ApplyPlayerClothes(player);
                        Customization.ApplyPlayerTattoos(player);
                    }

                    // Activate the login window
                    player.SetSharedData(EntityData.SERVER_TIME, DateTime.Now.ToString("HH:mm:ss"));

                    break;
                }
            });
        }
Пример #3
0
        public void LoadCharacterEvent(Client player, string name)
        {
            Task.Factory.StartNew(() =>
            {
                PlayerModel playerModel = Database.LoadCharacterInformationByName(name);
                SkinModel skinModel     = Database.GetCharacterSkin(playerModel.id);

                // Load player's model
                player.Name = playerModel.realName;
                player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                NAPI.Player.SetPlayerSkin(player, playerModel.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                LoadCharacterData(player, playerModel);
                Customization.ApplyPlayerCustomization(player, skinModel, playerModel.sex);
                Customization.ApplyPlayerClothes(player);
                Customization.ApplyPlayerTattoos(player);

                // Update last selected character
                Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
            });
        }