Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma METAINFO("AnTIRECOIL_NEW", 1, 0, "SHEERIFF")
- #define sn 6.32 // Мертвая зона
- #define ar 19.0 // Изменение отдачи по вертикали
- #define RecoilDelay 115 // Изменение в МС когда начинает рабоать ANTIRECOIL
- #define RY get_actual(22)
- #define RX get_actual(21)
- main {
- if (get_actual(4) && is_active(7) && time_active(4) >= RecoilDelay) AntiRecoil(ar);
- }
- void AntiRecoil (fix32 recoil) {
- fix32 modifiedRY;
- fix32 trueRY = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RY;
- fix32 trueRX = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RX;
- if (RY > 0.0) modifiedRY = (100.0-sn-recoil)/(100.0-sn)*trueRY + recoil;
- if (RY < 0.0) modifiedRY = (100.0-sn+recoil)/(100.0-sn)*trueRY + recoil;
- fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
- fix32 finalRX = trueRX * (altradius + sn)/altradius;
- fix32 finalRY = modifiedRY * (altradius + sn)/altradius;
- if (RX*RX+RY*RY <= sn*sn) set_val(22,(sn+recoil));
- if (RX*RX+RY*RY > sn*sn) {
- set_val(22,clamp(finalRY, -100f, 100f));
- set_val(21,clamp(finalRX, -100f, 100f));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement