Advertisement
Guest User

Mega Jump

a guest
Aug 28th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4. forward JumpTimer(playerid);
  5. new MegaJump[MAX_PLAYERS],
  6. Jumping[MAX_PLAYERS];
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     return 1;
  11. }
  12.  
  13. public OnFilterScriptExit()
  14. {
  15.     return 1;
  16. }
  17.  
  18. public OnPlayerConnect(playerid)
  19. {
  20.     Jumping[playerid] = 1;
  21. }
  22.  
  23. public OnPlayerCommandText(playerid, cmdtext[])
  24. {
  25.     if (strcmp("/megajump", cmdtext, true, 10) == 0)
  26.     {
  27.         if (MegaJump[playerid] == 1)
  28.         {
  29.             MegaJump[playerid] = 0;
  30.             GameTextForPlayer(playerid,"~g~MegaJump ~w~Off",4500,3);
  31.             return 1;
  32.         }
  33.         else if (MegaJump[playerid] == 0)
  34.         {
  35.             MegaJump[playerid] = 1;
  36.             GameTextForPlayer(playerid,"~g~MegaJump ~w~On",4500,3);
  37.             return 1;
  38.         }
  39.         return 1;
  40.     }
  41.     return 0;
  42. }
  43.  
  44. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  45. {
  46.     if(newkeys & KEY_JUMP)
  47.     {
  48.         if(MegaJump[playerid] == 1)
  49.         {
  50.                 if(Jumping[playerid] == 0)
  51.                 {
  52.                     new Float:Jump[3];
  53.                     GetPlayerVelocity(playerid, Jump[0], Jump[1], Jump[2]);
  54.                     SetPlayerVelocity(playerid, Jump[0], Jump[1], Jump[2]+5);
  55.                     SetTimerEx("JumpTimer", 2500, false, "i", playerid);
  56.                     Jumping[playerid] = 1;
  57.                 }
  58.         }
  59.     }
  60.     return 1;
  61. }
  62.  
  63. public JumpTimer(playerid)
  64. {
  65.     Jumping[playerid] = 0;
  66.     return 1;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement