Advertisement
Froki

Untitled

Aug 24th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <hamsandwich>
  5. #include <engine>
  6.  
  7. #define PLUGIN "BHOP i multijump"
  8. #define VERSION "1.0"
  9. #define AUTHOR "AUTHOR"
  10.  
  11. #define FL_WATERJUMP (1<<11)
  12. #define FL_ONGROUND (1<<9)
  13.  
  14. #pragma semicolon 1
  15. #define ADMINACCESS ADMIN_CHAT
  16.  
  17.  
  18. new VIP[ 33 ];
  19. new jumpnum[33] = 0;
  20. new bool:dojump[33] = false;
  21.  
  22.  
  23.  
  24. public plugin_init() {
  25. register_plugin(PLUGIN, VERSION, AUTHOR);
  26.  
  27. RegisterHam(Ham_Spawn, "player", "Spawn", 1);
  28. register_cvar("amx_maxjumps","1");
  29. register_cvar("amx_mjadminonly","0");
  30. }
  31.  
  32.  
  33. public client_connect(id) {
  34. jumpnum[id] = 0;
  35. dojump[id] = false;
  36. VIP[id] = true;
  37. }
  38.  
  39. public client_disconnect(id) {
  40. jumpnum[id] = 0;
  41. dojump[id] = false;
  42. }
  43.  
  44.  
  45.  
  46. public Spawn(id)
  47. {
  48. if(get_user_flags(id) & (VIP[id]) & is_user_alive(id)) client_PreThink(id);
  49. if(get_user_flags(id) & (VIP[id]) & is_user_alive(id)) client_PreThink2(id);
  50. if(get_user_flags(id) & (VIP[id]) & is_user_alive(id)) client_PostThink(id);
  51. }
  52.  
  53.  
  54.  
  55. public client_PreThink(id) {
  56. if(VIP[id]) {
  57. entity_set_float(id, EV_FL_fuser2, 0.0);
  58. if(entity_get_int(id, EV_INT_button) & 2) {
  59. new flags = entity_get_int(id, EV_INT_flags);
  60. if(flags & FL_WATERJUMP) return PLUGIN_CONTINUE;
  61. if(entity_get_int(id, EV_INT_waterlevel) >= 2 ) return PLUGIN_CONTINUE;
  62. if(!(flags & FL_ONGROUND)) return PLUGIN_CONTINUE;
  63. new Float:velocity[3];
  64. entity_get_vector(id, EV_VEC_velocity, velocity);
  65. velocity[2] += 250.0;
  66. entity_set_vector(id, EV_VEC_velocity, velocity);
  67. entity_set_int(id, EV_INT_gaitsequence, 6);
  68. }
  69. }
  70. return PLUGIN_CONTINUE;
  71. }
  72.  
  73. public client_PreThink2(id)
  74. {
  75. if(VIP[id]) {
  76. if(!is_user_alive(id)) return PLUGIN_CONTINUE;
  77. if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE;
  78. new nbut = get_user_button(id);
  79. new obut = get_user_oldbutton(id);
  80. if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
  81. {
  82. if(jumpnum[id] < get_cvar_num("amx_maxjumps"))
  83. {
  84. dojump[id] = true;
  85. jumpnum[id]++;
  86. return PLUGIN_CONTINUE;
  87. }
  88. }
  89. if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  90. {
  91. jumpnum[id] = 0;
  92. return PLUGIN_CONTINUE;
  93. }
  94. return PLUGIN_CONTINUE;
  95. }
  96. return PLUGIN_CONTINUE;
  97. }
  98.  
  99.  
  100. public client_PostThink(id)
  101. {
  102. if(VIP[id]) {
  103. if(!is_user_alive(id)) return PLUGIN_CONTINUE;
  104. if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE;
  105. if(dojump[id] == true)
  106. {
  107. new Float:velocity[3];
  108. entity_get_vector(id,EV_VEC_velocity,velocity);
  109. velocity[2] = random_float(265.0,285.0);
  110. entity_set_vector(id,EV_VEC_velocity,velocity);
  111. dojump[id] = false;
  112. return PLUGIN_CONTINUE;
  113. }
  114. return PLUGIN_CONTINUE;
  115. }
  116. return PLUGIN_CONTINUE;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement