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
  • 3 months later...
Posted

Compiling is needed to throw Errors/Informations.

 

Did you may copy/paste plugin from one location to another and working in the wrong location with VS Code or whatever, so this would also clarify why its not compiling, i had something similar last time.

I always create plugins on the Desktop then i drag it into the plugins folder and last time i changed some stuff and it was not compiling till i found out i'm changing it out of my Desktop and not from the plugin folder, but i thought i edited it in the plugin folder.

 

Provide the full code, so i can check it.

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.7m

Downloads

Total number of downloads.

8.1k

Customers

Total customers served.

122.7k

Files Sold

Total number of files sold.

2.5m

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.