Advertisement
Gendrome

[Assault Cube Script] Sniper zoom with mouse wheel

Dec 30th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. Put it into autoexec.cfg (located in the main folder > config > autoexec.cfg <- open with Notepad or something)
  2.  
  3. // Smooth sniper scope zoom with mouse wheel
  4.  
  5. autoscopesens 1
  6. persistidents 0
  7.  
  8. const ZOOM_SMOOTH 1 // set to 0 to disable smooth zooming
  9. const ZOOM_SMOOTH_MILLIS_BETWEEN_CHANGES 15 // milliseconds between scopefov changes for smooth zooming
  10. const ZOOM_DEFAULT_SCOPEFOV 50 // default scopefov for when you first scope in
  11. const ZOOM_SCOPEFOV_INCREMENT 10 // change scopefov by this much on every tick of the mouse wheel
  12.  
  13. const isany [ bool = 0; looplist $arg2 ia [ if (strcmp $ia $arg1) [ bool = 1; break ] ]; return $bool ]
  14. const validscopefov [ return (checkrange $arg1 5 60) ]
  15.  
  16. const doscope [
  17. if (! $numargs) [
  18. scopefov $ZOOM_DEFAULT_SCOPEFOV
  19. setscope 1
  20. onrelease [ setscope 0 ]
  21. ] [
  22. newfov = -1
  23. if (isany $arg1 [in 1 +]) [
  24. oper = -
  25. newfov = (- $scopefov $ZOOM_SCOPEFOV_INCREMENT)
  26. dif = (- $scopefov $newfov)
  27. ] [
  28. if (isany $arg1 [out 0 -]) [
  29. oper = +
  30. newfov = (+ $scopefov $ZOOM_SCOPEFOV_INCREMENT)
  31. dif = (- $newfov $scopefov)
  32. ]
  33. ]
  34. if (validscopefov $newfov) [
  35. if $ZOOM_SMOOTH [
  36. loop sf $dif [
  37. sleep (* $ZOOM_SMOOTH_MILLIS_BETWEEN_CHANGES $sf) [
  38. newfov = ($oper $scopefov 1)
  39. if (validscopefov $newfov) [ scopefov $newfov ]
  40. ]
  41. ]
  42. ] [ scopefov $newfov ]
  43. ]
  44. ]
  45. ]
  46. altaction_5 = doscope
  47. delta_game_0 = [
  48. if (&& (= (curweapon) $SNIPER) (player1 scoping)) [
  49. if (= $arg1 1) [ doscope + ] [ doscope - ]
  50. ] [
  51. if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ]
  52. ]
  53. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement