Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < engine >
  4. #include < hamsandwich >
  5. #include < fakemeta_util >
  6.  
  7. #pragma semicolon 1
  8.  
  9. new round[ 33 ] = 0;
  10.  
  11. #define Plugin "Xarea VIP"
  12. #define Version "1.0.1"
  13. #define Author "Sorinel"
  14.  
  15. #define VIP_FLAG ADMIN_LEVEL_H
  16.  
  17. #define VIP_PARACHUTE read_flags( "r" )
  18. #define VIP_SPEED_KNIFE read_flags( "s" )
  19.  
  20. #define KILL_HP 10 // cat hp primeste pe kill
  21. #define HS_HP 15 // cat hp primeste cand da hs
  22. #define FRAG_HP_LIMIT 100 // limita hp la kill
  23.  
  24. new const restricted_maps[ ][ ] =
  25. {
  26. "35hp",
  27. "31hp", // Poti adauga tu mai multe mape dupa model
  28. "1hp",
  29. "awp_garden",
  30. "awp_bycastor32",
  31. "awp_zigzag",
  32. "awp_bycastor",
  33. "css_bycastor",
  34. "css_india2",
  35. "css_india_go",
  36. "css_deagle",
  37. "fy_snow",
  38. "fy_cluj",
  39. "fy_buzzkill"
  40. };
  41.  
  42. enum {
  43. SCOREATTRIB_ARG_PLAYERID = 1,
  44. SCOREATTRIB_ARG_FLAGS
  45. }
  46.  
  47. enum ( <<= 1 ) {
  48. SCOREATTRIB_FLAG_NONE = 0,
  49. SCOREATTRIB_FLAG_DEAD = 1,
  50. SCOREATTRIB_FLAG_BOMB,
  51. SCOREATTRIB_FLAG_VIP
  52. }
  53.  
  54. const WEAPON_BITSUM = (1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_P90) |
  55. (1<<CSW_FAMAS) | (1<<CSW_AWP) | (1<<CSW_MP5NAVY) | (1<<CSW_M249) | (1<<CSW_M3) | (1<<CSW_M4A1) | (1<<CSW_TMP) | (1<<CSW_G3SG1) | (1<<CSW_SG552) |
  56. (1<<CSW_AK47) | (1<<CSW_GALIL) | (1<<CSW_GLOCK18) | (1<<CSW_USP);
  57.  
  58.  
  59. public plugin_init( ) {
  60.  
  61. register_plugin( Plugin, Version, Author );
  62. register_event("DeathMsg", "death_msg", "a", "1>0");
  63. RegisterHam( Ham_Spawn, "player", "PlayerSpawn", 1 );
  64. register_event( "CurWeapon","CheckWeapon","be","1=1" );
  65. }
  66.  
  67. public client_putinserver( id ) {
  68.  
  69. new map_name[32], i;
  70. get_mapname(map_name, charsmax(map_name));
  71.  
  72. for(i = 0; i < sizeof(restricted_maps); i++)
  73. {
  74. if(equali(map_name, restricted_maps[i]))
  75. {
  76. remove_user_flags(id, VIP_FLAG);
  77. }
  78. }
  79. }
  80.  
  81. public DisplayMenu( id ) {
  82.  
  83. new menu = menu_create( "Equipment", "menu_handler" );
  84.  
  85. menu_additem( menu, "M4A1", "", 0, ADMIN_LEVEL_H );
  86. menu_additem( menu, "AK47", "", 0, ADMIN_LEVEL_H );
  87. menu_additem( menu, "AWP \r(Only in round 3)", "", 0, ADMIN_LEVEL_H );
  88.  
  89. menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  90. menu_display( id, menu, 0 );
  91. }
  92.  
  93. public menu_handler( id, menu, item )
  94. {
  95. switch( item )
  96. {
  97. case 0:
  98. {
  99. drop_wpn( id );
  100.  
  101. fm_give_item(id, "weapon_m4a1" );
  102. cs_set_user_bpammo(id, CSW_M4A1, 90 );
  103.  
  104. fm_give_item(id, "weapon_deagle" );
  105. cs_set_user_bpammo(id, CSW_DEAGLE, 35 );
  106.  
  107. }
  108. case 1:
  109. {
  110. drop_wpn( id );
  111.  
  112. fm_give_item(id, "weapon_ak47" );
  113. cs_set_user_bpammo(id, CSW_AK47, 90 );
  114.  
  115. fm_give_item(id, "weapon_deagle" );
  116. cs_set_user_bpammo(id, CSW_DEAGLE, 35 );
  117.  
  118. }
  119. case 2:
  120.  
  121. if( round[id] >= 3 )
  122. {
  123. drop_wpn( id );
  124.  
  125. fm_give_item(id, "weapon_awp" );
  126. cs_set_user_bpammo(id, CSW_AWP, 90 );
  127.  
  128. fm_give_item(id, "weapon_deagle" );
  129. cs_set_user_bpammo(id, CSW_DEAGLE, 35 );
  130. }
  131. else
  132. {
  133. round[id]++;
  134. }
  135. }
  136.  
  137. menu_destroy( menu );
  138. }
  139.  
  140. bonus_health(id, health)
  141. {
  142. if(!is_user_alive(id))
  143. return PLUGIN_HANDLED;
  144.  
  145. static limit;
  146. limit = FRAG_HP_LIMIT;
  147.  
  148. if(is_user_alive( id ) && get_user_flags( id ) & VIP_FLAG )
  149. {
  150. health += KILL_HP;
  151. health += HS_HP;
  152. limit = FRAG_HP_LIMIT;
  153. }
  154.  
  155. fm_set_user_health(id, clamp((get_user_health(id) + health), 1, limit) );
  156. return PLUGIN_HANDLED;
  157. }
  158.  
  159. public PlayerSpawn( id ) {
  160.  
  161. if( is_user_alive( id ) && get_user_flags( id ) & VIP_FLAG) {
  162.  
  163. if( round[id] >= 1 )
  164. {
  165. DisplayMenu( id );
  166.  
  167. fm_give_item(id, "weapon_hegrenade" );
  168. fm_give_item(id, "weapon_flashbang" );
  169. cs_set_user_bpammo(id, CSW_FLASHBANG, 2 );
  170. }
  171. else
  172. {
  173. round[id]++;
  174. }
  175. }
  176. }
  177.  
  178. public MessageScoreAttrib(iMsgId, iDest, iReceiver)
  179. {
  180. new iPlayer = get_msg_arg_int(SCOREATTRIB_ARG_PLAYERID)
  181.  
  182. if(get_user_flags(iPlayer) & VIP_FLAG )
  183. set_msg_arg_int(SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP)
  184. }
  185.  
  186. public death_msg( )
  187. {
  188. new killer = read_data(1);
  189. new victim = read_data(2);
  190.  
  191. if( is_user_alive( killer ) && get_user_flags( killer ) & VIP_FLAG ) {
  192.  
  193. if(killer == victim || !is_user_connected(victim) || !is_user_alive(killer))
  194. return PLUGIN_HANDLED;
  195.  
  196. if(killer)
  197. {
  198. bonus_health(killer, get_user_health( killer ) + KILL_HP );
  199. }
  200.  
  201. new headshot = read_data(3);
  202.  
  203. if(headshot)
  204. {
  205. bonus_health(killer, get_user_health( killer ) + HS_HP );
  206. }
  207. }
  208. return PLUGIN_CONTINUE;
  209. }
  210.  
  211. public CheckWeapon( id ) {
  212.  
  213. new Weapon;
  214.  
  215. Weapon = get_user_weapon(id);
  216.  
  217. if( Weapon == CSW_KNIFE ) {
  218.  
  219. if( is_user_alive( id ) && get_user_flags( id ) & VIP_SPEED_KNIFE ) {
  220.  
  221. fm_set_user_maxspeed(id, 350.0 );
  222. }
  223. }
  224. }
  225.  
  226. public client_PreThink(id)
  227. {
  228. if(!is_user_alive(id) && get_user_flags( id ) & VIP_PARACHUTE ) {
  229.  
  230. new Float:fallspeed = 100.0 * -1.0;
  231.  
  232. new button = get_user_button(id);
  233. if(button & IN_USE)
  234. {
  235. new Float:velocity[3];
  236. entity_get_vector(id, EV_VEC_velocity, velocity);
  237. if (velocity[2] < 0.0)
  238. {
  239. entity_set_int(id, EV_INT_sequence, 3);
  240. entity_set_int(id, EV_INT_gaitsequence, 1);
  241. entity_set_float(id, EV_FL_frame, 1.0);
  242. entity_set_float(id, EV_FL_framerate, 1.0);
  243.  
  244. velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed;
  245. entity_set_vector(id, EV_VEC_velocity, velocity);
  246. }
  247. }
  248. }
  249. }
  250.  
  251. drop_wpn( id )
  252. {
  253. static weapons[32], num;
  254. get_user_weapons(id, weapons, num);
  255.  
  256. for (new i = 0; i < num; i++)
  257. {
  258. if (WEAPON_BITSUM & (1<<weapons[i]))
  259. {
  260. static wname[32];
  261. get_weaponname(weapons[i], wname, sizeof wname - 1);
  262.  
  263. engclient_cmd(id, "drop", wname);
  264. }
  265. }
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement