コード例 #1
0
        // Get Roll
        private bool GetBonyById(Int64 pEnemySoldier, int Id, out Vector3 _World)
        {
            _World = new Vector3();

            Int64 pRagdollComp = RPM.ReadInt64(pEnemySoldier + Offsets.ClientSoldierEntity.m_ragdollComponent);

            if (!RPM.IsValid(pRagdollComp))
            {
                return(false);
            }

            byte m_ValidTransforms = RPM.ReadByte(pRagdollComp + (Offsets.ClientRagDollComponent.m_ragdollTransforms + Offsets.UpdatePoseResultData.m_ValidTransforms));

            if (m_ValidTransforms != 1)
            {
                return(false);
            }

            Int64 pQuatTransform = RPM.ReadInt64(pRagdollComp + (Offsets.ClientRagDollComponent.m_ragdollTransforms + Offsets.UpdatePoseResultData.m_ActiveWorldTransforms));

            if (!RPM.IsValid(pQuatTransform))
            {
                return(false);
            }

            _World = RPM.ReadVector3(pQuatTransform + Id * 0x20);
            return(true);
        }
コード例 #2
0
        // Get SoldierEntity
        private Int64 GetClientSoldierEntity(Int64 pClientPlayer, Player player)
        {
            Int64 pAttached = RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);

            if (RPM.IsValid(pAttached))
            {
                Int64 m_ClientSoldier = RPM.ReadInt64(RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_character)) - sizeof(Int64);
                if (RPM.IsValid(m_ClientSoldier))
                {
                    player.InVehicle = true;

                    Int64 pVehicleEntity = RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);
                    if (RPM.IsValid(pVehicleEntity))
                    {
                        // Driver
                        if (RPM.ReadInt32(pClientPlayer + Offsets.ClientPlayer.m_attachedEntryId) == 0)
                        {
                            Int64 _EntityData = RPM.ReadInt64(pVehicleEntity + Offsets.ClientSoldierEntity.m_data);
                            if (RPM.IsValid(_EntityData))
                            {
                                Int64 _NameSid = RPM.ReadInt64(_EntityData + Offsets.VehicleEntityData.m_NameSid);

                                string strName = RPM.ReadString(_NameSid, 20);
                                if (strName.Length > 11)
                                {
                                    // AttachedControllable Name
                                    player.VehicleName = strName.Remove(0, 11);
                                    player.IsDriver    = true;
                                }
                            }
                        }
                    }
                }
                return(m_ClientSoldier);
            }
            return(RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pControlledControllable));
        }
コード例 #3
0
        // Read Game Memorry
        private void Read()
        {
            // Reset Old Data
            players.Clear();
            localPlayer = new Player();

            // Read Local
            #region Get Local Player
            Int64 pGContext = RPM.ReadInt64(Offsets.ClientGameContext.GetInstance());
            if (!RPM.IsValid(pGContext))
            {
                return;
            }

            Int64 pPlayerManager = RPM.ReadInt64(pGContext + Offsets.ClientGameContext.m_pPlayerManager);
            if (!RPM.IsValid(pPlayerManager))
            {
                return;
            }

            Int64 pLocalPlayer = RPM.ReadInt64(pPlayerManager + Offsets.ClientPlayerManager.m_pLocalPlayer);
            if (!RPM.IsValid(pLocalPlayer))
            {
                return;
            }

            //RPM.ReadInt64(pLocalPlayer + Offsets.ClientPlayer.m_pControlledControllable);
            Int64 pLocalSoldier = GetClientSoldierEntity(pLocalPlayer, localPlayer);
            if (!RPM.IsValid(pLocalSoldier))
            {
                return;
            }

            Int64 pHealthComponent = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
            if (!RPM.IsValid(pHealthComponent))
            {
                return;
            }

            Int64 m_pPredictedController = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
            if (!RPM.IsValid(m_pPredictedController))
            {
                return;
            }

            // Health
            localPlayer.Health    = RPM.ReadFloat(pHealthComponent + Offsets.HealthComponent.m_Health);
            localPlayer.MaxHealth = RPM.ReadFloat(pHealthComponent + Offsets.HealthComponent.m_MaxHealth);

            if (localPlayer.Health <= 0.1f) // YOU DEAD :D
            {
                return;
            }

            // Origin
            localPlayer.Origin = RPM.ReadVector3(m_pPredictedController + Offsets.ClientSoldierPrediction.m_Position);

            // Other
            localPlayer.Team = RPM.ReadInt32(pLocalPlayer + Offsets.ClientPlayer.m_teamId);
            //localPlayer.Name = RPM.ReadString(pLocalPlayer + Offsets.ClientPlayer.szName, 10);
            localPlayer.Pose       = RPM.ReadInt32(pLocalSoldier + Offsets.ClientSoldierEntity.m_poseType);
            localPlayer.Yaw        = RPM.ReadFloat(pLocalSoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
            localPlayer.IsOccluded = RPM.ReadByte(pLocalSoldier + Offsets.ClientSoldierEntity.m_occluded);

            // Weapon Ammo
            if (!localPlayer.InVehicle)
            {
                Int64 pClientWeaponComponent = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_soldierWeaponsComponent);
                if (RPM.IsValid(pClientWeaponComponent))
                {
                    Int64 pWeaponHandle = RPM.ReadInt64(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_handler);
                    Int32 ActiveSlot    = RPM.ReadInt32(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_activeSlot);

                    if (RPM.IsValid(pWeaponHandle))
                    {
                        Int64 pSoldierWeapon = RPM.ReadInt64(pWeaponHandle + ActiveSlot * 0x8);
                        if (RPM.IsValid(pSoldierWeapon))
                        {
                            Int64 pCorrectedFiring = RPM.ReadInt64(pSoldierWeapon + Offsets.ClientSoldierWeapon.m_pPrimary);
                            if (RPM.IsValid(pCorrectedFiring))
                            {
                                // Ammo
                                localPlayer.Ammo     = RPM.ReadInt32(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesLoaded);
                                localPlayer.AmmoClip = RPM.ReadInt32(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesInMagazines);
                            }
                        }
                    }
                }
            }
            #endregion

            // Render View
            Int64 pGameRenderer = RPM.ReadInt64(Offsets.GameRenderer.GetInstance());
            Int64 pRenderView   = RPM.ReadInt64(pGameRenderer + Offsets.GameRenderer.m_pRenderView);

            // Read Screen Matrix
            viewProj            = RPM.ReadMatrix(pRenderView + Offsets.RenderView.m_ViewProj);
            m_ViewMatrixInverse = RPM.ReadMatrix(pRenderView + Offsets.RenderView.m_ViewMatrixInverse);

            // Pointer to Players Array
            Int64 m_ppPlayer = RPM.ReadInt64(pPlayerManager + Offsets.ClientPlayerManager.m_ppPlayer);
            if (!RPM.IsValid(m_ppPlayer))
            {
                return;
            }

            // Reset
            spectatorCount = 0;

            // Get Player by Id
            #region Get Player by Id
            for (uint i = 0; i < 70; i++)
            {
                // Create new Player
                Player player = new Player();

                // Pointer to ClientPlayer class (Player Array + (Id * Size of Pointer))
                Int64 pEnemyPlayer = RPM.ReadInt64(m_ppPlayer + (i * sizeof(Int64)));
                if (!RPM.IsValid(pEnemyPlayer))
                {
                    continue;
                }

                if (pEnemyPlayer == pLocalPlayer)
                {
                    continue;
                }

                player.IsSpectator = Convert.ToBoolean(RPM.ReadByte(pEnemyPlayer + Offsets.ClientPlayer.m_isSpectator));

                if (player.IsSpectator)
                {
                    spectatorCount++;
                }

                // Name
                player.Name = RPM.ReadString2(pEnemyPlayer + Offsets.ClientPlayer.szName, 10);

                // RPM.ReadInt64(pEnemyPlayer + Offsets.ClientPlayer.m_pControlledControllable);
                Int64 pEnemySoldier = GetClientSoldierEntity(pEnemyPlayer, player);
                if (!RPM.IsValid(pEnemySoldier))
                {
                    continue;
                }

                Int64 pEnemyHealthComponent = RPM.ReadInt64(pEnemySoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
                if (!RPM.IsValid(pEnemyHealthComponent))
                {
                    continue;
                }

                Int64 pEnemyPredictedController = RPM.ReadInt64(pEnemySoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
                if (!RPM.IsValid(pEnemyPredictedController))
                {
                    continue;
                }

                // Health
                player.Health    = RPM.ReadFloat(pEnemyHealthComponent + Offsets.HealthComponent.m_Health);
                player.MaxHealth = RPM.ReadFloat(pEnemyHealthComponent + Offsets.HealthComponent.m_MaxHealth);

                if (player.Health <= 0.1f) // DEAD
                {
                    continue;
                }

                // Origin (Position in Game X, Y, Z)
                player.Origin = RPM.ReadVector3(pEnemyPredictedController + Offsets.ClientSoldierPrediction.m_Position);

                // Other
                player.Team       = RPM.ReadInt32(pEnemyPlayer + Offsets.ClientPlayer.m_teamId);
                player.Pose       = RPM.ReadInt32(pEnemySoldier + Offsets.ClientSoldierEntity.m_poseType);
                player.Yaw        = RPM.ReadFloat(pEnemySoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
                player.IsOccluded = RPM.ReadByte(pEnemySoldier + Offsets.ClientSoldierEntity.m_occluded);

                // Distance to You
                player.Distance = Vector3.Distance(localPlayer.Origin, player.Origin);

                if (player.IsValid())
                {
                    #region Bone ESP
                    if (ESP_Bone)
                    {
                        // Player Bone
                        if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTFOOT, out player.Bone.BONE_RIGHTFOOT) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTHAND, out player.Bone.BONE_RIGHTHAND) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTKNEEROLL, out player.Bone.BONE_RIGHTKNEEROLL) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTSHOULDER, out player.Bone.BONE_RIGHTSHOULDER) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE, out player.Bone.BONE_SPINE) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE1, out player.Bone.BONE_SPINE1) &&
                            GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE2, out player.Bone.BONE_SPINE2))
                        {
                            DrawBone(player);
                        }
                    }
                    #endregion

                    Vector3 Foot, Head;
                    if (WorldToScreen(player.Origin, out Foot) &&
                        WorldToScreen(player.Origin, player.Pose, out Head))
                    {
                        float HeadToFoot = Foot.Y - Head.Y;
                        float BoxWidth   = HeadToFoot / 2;
                        float X          = Head.X - (BoxWidth) / 2;

                        #region ESP Color
                        Color color;
                        if (player.Team == localPlayer.Team)
                        {
                            color = friendlyColor;
                        }
                        else
                        {
                            color = player.IsVisible() ? enemyColorVisible : enemyColor;
                        }
                        #endregion

                        #region Draw ESP
                        // ESP Box
                        if (ESP_Box)
                        {
                            DrawAABB(player.GetAABB(), player.Origin, player.Yaw, color);
                            //DrawRect((int)X, (int)Head.Y, (int)BoxWidth, (int)HeadToFoot, color);
                        }

                        // ESP Distance
                        if (ESP_Distance)
                        {
                            DrawText((int)X, (int)Foot.Y, (int)player.Distance + "m", Color.White, true);
                        }

                        // ESP Name
                        if (ESP_Name)
                        {
                            if (player.InVehicle && player.IsDriver)
                            {
                                DrawTextCenter((int)X + ((int)BoxWidth / 2) - 100, (int)Head.Y - 20, 200, 20, "[" + player.VehicleName + "]", Color.White, true);
                            }
                            else if (!player.InVehicle)
                            {
                                DrawTextCenter((int)X + ((int)BoxWidth / 2) - 100, (int)Head.Y - 20, 200, 20, player.Name, Color.White, true);
                            }
                        }

                        // ESP Health
                        if (ESP_Health)
                        {
                            DrawHealth((int)X, (int)Head.Y - 6, (int)BoxWidth, 3, (int)player.Health, (int)player.MaxHealth);
                        }
                        #endregion
                    }
                }

                // ADD IN ARRAY
                players.Add(player);
            }
            #endregion

            // Check Spectator Count
            if (spectatorCount > 0)
            {
                DrawWarn(rect.Center.X - 125, 25, 250, 55);
            }
        }