Advertisement
Guest User

Untitled

a guest
May 22nd, 2010
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <a_players>
  2. #include <a_samp>
  3.  
  4. new InAir[MAX_PLAYERS];
  5. new CheckIfLanded[MAX_PLAYERS];
  6. new AlreadyDoubleHopped[MAX_PLAYERS];
  7. new ZWasZeroAtLastCheck[MAX_PLAYERS];
  8.  
  9.  
  10. public OnPlayerConnect(playerid)
  11. {
  12. InAir[playerid] = 0;
  13. return 1;
  14. }
  15.  
  16. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  17. {
  18. if(newkeys == 32)
  19. {
  20. if(!IsPlayerInAnyVehicle(playerid))
  21. {
  22. new Float:x,Float:y,Float:z;
  23. GetPlayerVelocity(playerid,x,y,z);
  24. if(InAir[playerid] == 0 && z == 0)
  25. {
  26. CheckIfLanded[playerid] = 1;
  27. InAir[playerid] = 1;
  28. AlreadyDoubleHopped[playerid] = 0;
  29. }
  30. else
  31. {
  32. if(AlreadyDoubleHopped[playerid] == 1) return 1;
  33. if(z <= 0)
  34. {
  35. SetPlayerVelocity(playerid,x,y,4);
  36. AlreadyDoubleHopped[playerid] = 1;
  37. }
  38. else
  39. {
  40. SetPlayerVelocity(playerid,x,y,z+4);
  41. AlreadyDoubleHopped[playerid] = 1;
  42. }
  43. }
  44. }
  45. }
  46. return 1;
  47. }
  48.  
  49. public OnPlayerUpdate(playerid)
  50. {
  51. if(CheckIfLanded[playerid] == 1)
  52. {
  53. if(!IsPlayerInAnyVehicle(playerid))
  54. {
  55. new Float:x,Float:y,Float:z;
  56. GetPlayerVelocity(playerid,x,y,z);
  57. if(z == 0)
  58. {
  59. if(ZWasZeroAtLastCheck[playerid] == 1)
  60. {
  61. ZWasZeroAtLastCheck[playerid] = 0;
  62. InAir[playerid] = 0;
  63. return 1;
  64. }
  65. ZWasZeroAtLastCheck[playerid] = 1;
  66. if(x > 0 || x < 0 || y > 0 || y < 0)
  67. {
  68. return 1;
  69. }
  70. else
  71. {
  72. InAir[playerid] = 0;
  73. AlreadyDoubleHopped[playerid] = 0;
  74. }
  75. }
  76. }
  77. }
  78. return 1;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement