Advertisement
Guest User

highjump

a guest
Sep 21st, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #include <engine>
  5. #include <rpgx>
  6. #include <rpgx_multijump>
  7.  
  8.  
  9. #define PLUGIN "Jump height modifier"
  10. #define VERSION "0.0.1"
  11. #define AUTHOR "striker07"
  12.  
  13. new upgrade_id;
  14.  
  15. new jumpnum[33];
  16. new dojump[33];
  17. //new level;
  18. //ew mjlevel;
  19.  
  20. public plugin_init()
  21. {
  22.      register_plugin(PLUGIN, VERSION, AUTHOR);
  23.  
  24.      RegisterHam(Ham_Player_Jump, "player", "fwdPlayerJump");
  25. }
  26.  
  27. public RPGx_OnPluginReady()
  28.     upgrade_id = RPGx_MakeUpgrade("High Jump", 5, 10, 20);
  29.  
  30. public client_PreThink(id)
  31. {
  32.     if(is_user_alive(id))
  33.     {
  34.         new buttons = get_user_button(id);
  35.         new obut = get_user_oldbutton(id);
  36.        
  37.         new mjlevel = RPGx_GetUpgradeLevel_MJ(id);
  38.        
  39.         if( mjlevel > 0)
  40.         {
  41.             if((buttons & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
  42.             {
  43.                 if(jumpnum[id] < mjlevel)
  44.                 {
  45.                     dojump[id] = true;
  46.                     jumpnum[id]++;
  47.                     client_print(id, print_chat, "+1 jump");
  48.                     return PLUGIN_CONTINUE;
  49.                 }
  50.             }
  51.             if((buttons & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  52.             {
  53.                 jumpnum[id] = 0;
  54.                 client_print(id, print_chat, "landed= jumps reset");
  55.             }
  56.         }
  57.     }
  58.     return PLUGIN_CONTINUE;
  59. }
  60.  
  61. public client_PostThink(id)
  62. {
  63.     if(is_user_alive(id))
  64.     {
  65.         new level = RPGx_GetUpgradeLevel(id, upgrade_id);
  66.         if( level > 0 && dojump[id] )
  67.         {  
  68.            
  69.             /*static Float:velocity[3];
  70.             pev(id, pev_velocity, velocity);*/
  71.            
  72.             new Float:velocity[3];
  73.             entity_get_vector(id,EV_VEC_velocity,velocity);
  74.            
  75.             velocity[2] = velocity[2] * ( 1.0+ (0.5*level) )
  76.            
  77.             //set_pev(id, pev_velocity, velocity)
  78.            
  79.             entity_set_vector(id,EV_VEC_velocity,velocity);
  80.            
  81.             client_print(id, print_chat, "Debug: Jumped higher then usual");
  82.            
  83.             dojump[id] = false;
  84.             return PLUGIN_CONTINUE;
  85.         }
  86.     }
  87.     return PLUGIN_CONTINUE;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement