HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include < amxmodx >
  2. #include < fakemeta >
  3. #include < zp50_items >
  4. #include < zp50_class_nemesis >
  5. #include < zp50_class_survivor >
  6.  
  7. new const g_item_name [ ] = { "Vegtelen loszer [1korig]" }
  8. const g_item_cost = 67
  9.  
  10. #if cellbits == 32
  11. const OFFSET_CLIPAMMO = 51
  12. #else
  13. const OFFSET_CLIPAMMO = 65
  14. #endif
  15. const OFFSET_LINUX_WEAPONS = 4
  16.  
  17. new cvar_enable_uc , cvar_allow_survivor_uc , cvar_enable_human_uc , cvar_limit_unlimited
  18. new g_number
  19.  
  20. new const MAXCLIP [ ] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
  21. 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }
  22.  
  23. new g_itemid_infammo, g_has_unlimited_clip[33]
  24.  
  25. public plugin_init ( ) {
  26. register_plugin("[ZP50] Extra: Unlimited Clip","1.1","H.RED.ZONE");
  27. g_itemid_infammo = zp_items_register ( g_item_name , g_item_cost );
  28.  
  29. cvar_enable_uc = register_cvar ( "zp_enable_plugin_uc" , "1" )
  30. cvar_allow_survivor_uc = register_cvar ( "zp_enable_survivor_uc" , "1" )
  31. cvar_enable_human_uc = register_cvar ( "zp_enable_human_uc" , "1" )
  32. cvar_limit_unlimited = register_cvar ( "zp_round_limit_uc" , "1" )
  33.  
  34. register_event (" HLTV" , "event_round_start" , "a" , "1=0" , "2=0" );
  35. register_message ( get_user_msgid ( "CurWeapon" ) , "message_cur_weapon" ); }
  36.  
  37. public zp_fw_items_select_pre ( id , itemid ) {
  38. if ( itemid == g_itemid_infammo ) {
  39. if ( get_pcvar_num ( cvar_enable_uc ) == 0 ) {
  40. return ZP_ITEM_DONT_SHOW; }
  41.  
  42. if ( get_pcvar_num ( cvar_enable_human_uc ) == 0 && !zp_core_is_zombie ( id ) ) {
  43. return ZP_ITEM_DONT_SHOW; }
  44.  
  45. if ( zp_class_nemesis_get ( id ) && zp_core_is_zombie ( id ) ) {
  46. return ZP_ITEM_DONT_SHOW; }
  47.  
  48. if ( get_pcvar_num ( cvar_allow_survivor_uc ) == 0 && zp_class_survivor_get ( id ) ) {
  49. return ZP_ITEM_DONT_SHOW; }
  50.  
  51. static text[32]
  52. formatex ( text , charsmax ( text ) , "[%d/%d]" , g_number , get_pcvar_num ( cvar_limit_unlimited ) )
  53. zp_items_menu_text_add ( text )
  54.  
  55. if ( g_number >= get_pcvar_num ( cvar_limit_unlimited ) )
  56. return ZP_ITEM_NOT_AVAILABLE; }
  57. return ZP_ITEM_AVAILABLE; }
  58.  
  59. public zp_fw_items_select_post ( player , itemid ) {
  60. if ( itemid == g_itemid_infammo ) {
  61. g_has_unlimited_clip [ player ] = true;
  62. g_number++; } }
  63.  
  64. public event_round_start ( ) {
  65. for ( new id; id <= 32; id++ ) g_has_unlimited_clip [ id ] = false; }
  66.  
  67.  
  68. public message_cur_weapon(msg_id, msg_dest, msg_entity) {
  69. if (!g_has_unlimited_clip[msg_entity])
  70. return;
  71.  
  72. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  73. return;
  74.  
  75. static weapon, clip
  76. weapon = get_msg_arg_int(2)
  77. clip = get_msg_arg_int(3)
  78.  
  79. if (MAXCLIP[weapon] > 2) {
  80. set_msg_arg_int (3 , get_msg_argtype ( 3 ) , MAXCLIP [ weapon ] )
  81.  
  82. if ( clip < 2 ) {
  83. static wname [ 32 ], weapon_ent
  84. get_weaponname ( weapon , wname , sizeof wname - 1 )
  85. weapon_ent = fm_find_ent_by_owner ( -1 , wname , msg_entity )
  86. fm_set_weapon_ammo ( weapon_ent , MAXCLIP [ weapon ] ); } } }
  87.  
  88. stock fm_find_ent_by_owner(entity, const classname[], owner) {
  89. while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {} return entity; }
  90.  
  91. stock fm_set_weapon_ammo(entity, amount) {
  92. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS); }
  93. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  94. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang10266\\ f0\\ fs16 \n\\ par }
  95. */
  96.