Jump to content

Recommended Posts

Posted (edited)

i have been working on a plugin to effect cheaters on my servers all of the effects of the plugin works except for the forced recoil spread and movement of their weapon.  it compiles the plugin with no errors and most of it works forcing the player inputs results in the plugin not compiling ...so any tips would be amazing ❤️ 

First attempt

        private void OnPlayerAttack(BasePlayer player, HitInfo info)
        {
            if (player == null || info == null || !forcedPlayers.ContainsKey(player))
                return;

            if (info.Weapon != null && info.Weapon is BaseProjectile)
            {
                // Force player's aim downward extremely aggressively
                Vector3 currentAngles = player.viewAngles;
                currentAngles.x += 120f; // Even more extreme downward force
                if (currentAngles.x > 150f) currentAngles.x = 150f; // Prevent excessive lock
                
                // Extreme left-right swinging for every shot
                swingDirection = !swingDirection;
                currentAngles.y += swingDirection ? 90f : -90f; // Massive swinging effect
                
                player.viewAngles = currentAngles;
                player.SendNetworkUpdateImmediate();
                
                // Induce extreme lag effect by randomly teleporting player erratically multiple times
                for (int i = 0; i < 3; i++) // More intense lag effect
                {
                    Vector3 lagPosition = player.transform.position;
                    lagPosition.x += UnityEngine.Random.Range(-1.0f, 1.0f); // Extreme jitter
                    lagPosition.z += UnityEngine.Random.Range(-1.0f, 1.0f);
                    player.Teleport(lagPosition);

Second attempt

        private void OnPlayerAttack(BasePlayer player, HitInfo info)
        {
            if (player == null || info == null || !forcedPlayers.ContainsKey(player))
                return;

            if (info.Weapon != null && info.Weapon is BaseProjectile projectile)
            {
                // Force player's aim downward aggressively when shooting
                Quaternion currentRotation = player.eyes.rotation;
                Vector3 newAngles = currentRotation.eulerAngles;
                newAngles.x += UnityEngine.Random.Range(15f, 30f); // Extreme downward force
                newAngles.y += swingDirection ? 90f : -90f; // Swinging left-right
                swingDirection = !swingDirection;
                player.eyes.rotation = Quaternion.Euler(newAngles);
                
                // Apply the forced aim change immediately
                player.SendNetworkUpdateImmediate();
                
                // Extreme bullet spread effect
                if (info.ProjectilePrefab != null)
                {
                    Vector3 spread = new Vector3(
                        UnityEngine.Random.Range(-5f, 5f),  // Extreme horizontal spread
                        UnityEngine.Random.Range(-5f, 5f),  // Extreme vertical spread
                        UnityEngine.Random.Range(-5f, 5f)); // Forward distortion
                    
                    info.ProjectilePrefab.initialVelocity = Quaternion.Euler(spread) * info.ProjectilePrefab.initialVelocity;
                }
            }
        }

Edited by CmonkieC

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1.6m

Downloads

Total number of downloads.

7.5k

Customers

Total customers served.

112.8k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.