Advertisement
Johurt

[FS] jRUN

Jan 5th, 2016
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.82 KB | None | 0 0
  1. /*
  2.     jRUN by ES.^ a.k.a Johurt, 2016/01/06
  3.     Special for Semikola
  4. */
  5. #include <a_samp>
  6.  
  7. #define HOLDING(%0,%1) ((%0 & (%1)) == (%1))
  8.  
  9. #define RUN_ANIM_STYLE  8
  10. #define RUN_SPEED       4.1
  11.  
  12. new bool:pRun[MAX_PLAYERS];
  13.  
  14. enum a
  15. {
  16.     run_animlib[9],
  17.     run_animname[16]
  18. };
  19. new run_i[][a] =
  20. {
  21.     {"FAT", "FatRun"},
  22.     {"MUSCULAR", "MuscleRun"},
  23.     {"PED", "run_civi"},
  24.     {"PED", "run_fat"},
  25.     {"PED", "run_fatold"},
  26.     {"PED", "run_gang1"},
  27.     {"PED", "run_old"},
  28.     {"PED", "run_player"},
  29.     {"PED", "swat_run"},
  30.     {"PED", "woman_run"},
  31.     {"PED", "WOMAN_runbusy"},
  32.     {"PED", "WOMAN_runfatold"},
  33.     {"PED", "woman_runpanic"},
  34.     {"PED", "WOMAN_runsexy"},
  35.     {"SKATE", "skate_run"}
  36. };
  37.  
  38. public OnPlayerConnect(playerid)
  39. {
  40.     pRun[playerid] = false;
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerSpawn(playerid)
  45. {
  46.     ApplyAnimation(playerid, run_i[RUN_ANIM_STYLE][run_animlib], "null", 0.0, 0, 0, 0, 0, 0);
  47.     return 1;
  48. }
  49.  
  50. public OnPlayerUpdate(playerid)
  51. {
  52.     new k[3], Float:cPos[6];
  53.     GetPlayerKeys(playerid, k[0], k[1], k[2]);
  54.     GetPlayerVelocity(playerid, cPos[0], cPos[1], cPos[2]);
  55.     if(HOLDING(k[0], KEY_SPRINT) && k[1] == KEY_UP && cPos[2] == 0)
  56.     {
  57.         if(!pRun[playerid])
  58.         {
  59.             pRun[playerid] = true;
  60.             ApplyAnimation(playerid, run_i[RUN_ANIM_STYLE][run_animlib], run_i[RUN_ANIM_STYLE][run_animname], RUN_SPEED, 1, 1, 1, 0, 0, 1);
  61.         }
  62.         GetPlayerCameraPos(playerid, cPos[0], cPos[1], cPos[2]);
  63.         GetPlayerCameraFrontVector(playerid, cPos[3], cPos[4], cPos[5]);
  64.        
  65.         /* Turn by frog163 */
  66.         cPos[0] += floatmul(cPos[3], 15.0);
  67.         cPos[1] += floatmul(cPos[4], 15.0);
  68.         GetPlayerPos(playerid, cPos[3], cPos[4], cPos[5]);
  69.         SetPlayerFacingAngle(playerid, 180.0-atan2(cPos[3] - cPos[0], cPos[4] - cPos[1]));
  70.     }
  71.     else
  72.     {
  73.         if(pRun[playerid])
  74.         {
  75.             ClearAnimations(playerid);
  76.             pRun[playerid] = false;
  77.         }
  78.     }
  79.     return 1;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement