Advertisement
Guest User

Untitled

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