Advertisement
Guest User

Untitled

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