Advertisement
Chronos_Ouroboros

why. (Sprint code)

Oct 20th, 2017
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. global int 0:S7_SS_OldSpeed [];
  2. global int 1:S7_SS_Sprinting [];
  3.  
  4. script "S7_SprintSystem" ENTER {
  5. if (gameType () == game_Title_Map)
  6. terminate;
  7.  
  8. int tics = 0;
  9. while (TRUE) {
  10. if (checkWeapon ("S7_SprintWeapon") && S7_SS_Sprinting [PLN] == 0) {
  11. setActorProperty (0, APROP_SPEED, S7_SS_OldSpeed [PLN]);
  12. S7_SS_Sprinting [PLN] = 0;
  13. tics = 0;
  14. disableWeapon ("S7_SprintWeapon", "S7_Sprinting");
  15. }
  16. if (keyDown (BT_USER1) &&
  17. S7_SS_Sprinting [PLN] == 0 &&
  18. checkInventory ("S7_Stamina") >= 5 && !CheckInventory ("S7_Dying") &&
  19. !S7_SR_StaminaEmpty [PLN]
  20. ) {
  21. S7_SS_Sprinting [PLN] = 1;
  22. S7_SS_OldSpeed [PLN] = getActorProperty (0, APROP_SPEED);
  23. disableWeapon ("S7_SprintWeapon", "S7_Sprinting");
  24. }
  25. if (keyUp (BT_USER1) && S7_SS_Sprinting [PLN] && !S7_SR_StaminaEmpty [PLN]) {
  26. setActorProperty (0, APROP_SPEED, S7_SS_OldSpeed [PLN]);
  27. S7_SS_Sprinting [PLN] = 0;
  28. tics = 0;
  29. disableWeapon ("S7_SprintWeapon", "S7_Sprinting");
  30. }
  31. if (checkInventory ("S7_Sprinting") && S7_SS_Sprinting [PLN]) {
  32. if (checkInventory ("S7_Stamina") >= 5) {
  33. if (checkInventory ("S7_Sprinting") && tics >= 5) {
  34. tics = 0;
  35. if (getVelocity () > 0)
  36. takeInventory ("S7_Stamina", 5);
  37. }
  38. if (checkInventory ("S7_Stamina") < 5 || CheckInventory ("S7_Dying")) {
  39. setActorProperty (0, APROP_SPEED, S7_SS_OldSpeed [PLN]);
  40. S7_SS_Sprinting [PLN] = 0;
  41. S7_SR_StaminaEmpty [PLN] = 1;
  42. disableWeapon ("S7_SprintWeapon", "S7_Sprinting");
  43. restart;
  44. }
  45. if (checkInventory ("S7_Sprinting") && ((abs (getPlayerInput (-1, INPUT_FORWARDMOVE)) > 6400) || (abs (getPlayerInput (-1, INPUT_SIDEMOVE)) > 6400)))
  46. setActorProperty (0, APROP_SPEED, 3.0);
  47. else if (checkInventory ("S7_Sprinting") && !((abs (getPlayerInput (-1, INPUT_FORWARDMOVE)) > 6400) || (abs (getPlayerInput (-1, INPUT_SIDEMOVE)) > 6400)))
  48. setActorProperty (0, APROP_SPEED, 6.0);
  49. else if (!checkInventory ("S7_Sprinting"))
  50. setActorProperty (0, APROP_SPEED, S7_SS_OldSpeed [PLN]);
  51. }
  52. }
  53.  
  54. delay (1);
  55.  
  56. if (S7_SS_Sprinting [PLN])
  57. tics++;
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement