示例#1
0
        public static async Task SetPlayerOnline(ClassicPlayer player, int charId)
        {
            if (player == null || !player.Exists)
            {
                return;
            }
            player.SetCharacterMetaId(Convert.ToUInt64(charId));

            var pl = Player.FirstOrDefault(p => p.socialClub == player.SocialClubId);

            if (pl != null)
            {
                player.CharacterId = charId;
                pl.Online          = charId;

                try
                {
                    using (gtaContext db = new gtaContext())
                    {
                        db.Accounts.Update(pl);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    Alt.Log($"{e}");
                }
            }
        }