Ejemplo n.º 1
0
        /// <summary>
        /// Gets a list of online users.
        /// </summary>
        /// <returns>The list of online users.</returns>
        public List <CUser> GetOnlineUsers()
        {
            var list = new List <CUser>();

            var sharp = Memory();
            var cups  = GetCups();

            if (cups == null || sharp == null)
            {
                return(list);
            }

            var playerList = CupsList.Read(sharp.Read <byte>((IntPtr)cups?.UserListPointer, 4, false));

            for (var i = 0; i < playerList.capacity; i++)
            {
                if (list.Count >= playerList.quantity)
                {
                    break;
                }
                var userPointer = sharp.Read <int>((IntPtr)cups?.UserListPointer + 4 + (i * 4), false);
                if (userPointer != 0)
                {
                    var user = new CUser();
                    user.Read(sharp, (IntPtr)userPointer);
                    list.Add(user);
                }
            }

            return(list);
        }
Ejemplo n.º 2
0
 public void AddCups(int amount)
 {
     for (int i = 0; i < amount; i++)
     {
         CupsList.Add(new Cup());
     }
 }