Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Posted by , a member of the community in the CronusMAX Forums - https://cronusmax.com/forums
- //Posted : Friday 2nd of August, 2019 16:50 UTC
- int sn = 13; // Change deadzone value
- int ar = 12; // Change anti-recoil value
- int RecoilDelay = 20; // delay in ms
- int RY = 22;
- int RX = 21;
- int modifiedRY;
- int trueRY;
- int trueRX;
- int altradius;
- int finalRX;
- int finalRY;
- main {
- if (get_val(4) && get_val(7) && get_ptime(4) >= RecoilDelay) {
- AntiRecoil(ar);
- }
- }
- function AntiRecoil (recoil) {
- trueRY = isqrt(pow(RY, 2) + pow(RX, 2) - sn) / isqrt(pow(RY, 2) + pow(RX, 2) * RY);
- trueRX = isqrt(pow(RY, 2) + pow(RX, 2) - sn) / isqrt(pow(RY, 2) + pow(RX, 2) * RX);
- if (RY > 0) {
- modifiedRY = (100 - sn - recoil) / (100 - sn) * trueRY + recoil;
- }
- if (RY < 0) {
- modifiedRY = (100 - sn + recoil) / (100 - sn) * trueRY + recoil;
- }
- altradius = isqrt(pow(trueRX, 2) + pow(modifiedRY, 2));
- finalRX = trueRX * (altradius + sn) / altradius;
- finalRY = modifiedRY * (altradius + sn) / altradius;
- if (pow(RX, 2) + pow(RY, 2) <= pow(sn, 2)) {
- set_val(RY, (sn + recoil));
- }
- if (pow(RX, 2) + pow(RY, 2) > pow(sn, 2)) {
- if (finalRY > 100) {
- set_val(RY, 100);
- }
- if (finalRY < -100) {
- set_val(RY, -100);
- }
- if (finalRX > 100) {
- set_val(RX, 100);
- }
- if (finalRX < -100) {
- set_val(RX, -100);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement