hlmod.hu
https://hlmod.hu/

RE:Counter strike 1.6
https://hlmod.hu/viewtopic.php?f=9&t=29198
Oldal: 1 / 1

Szerző:  Lali2006 [2018.07.23. 10:57 ]
Hozzászólás témája:  RE:Counter strike 1.6

Sziasztok olyan plugin kellene nekem amikor megölöd az embert akkor le esik a gránát elöre is köszi
Valaki segit?

Szerző:  HuBaBuBa [2018.07.23. 11:12 ]
Hozzászólás témája:  Re: RE:Counter strike 1.6

Minden fegyver eldobása halálkor

Szerző:  Lali2006 [2018.07.23. 11:40 ]
Hozzászólás témája:  Re: RE:Counter strike 1.6

Nem lehet át alakitani amxx -re

Szerző:  HuBaBuBa [2018.07.23. 14:49 ]
Hozzászólás témája:  Re: RE:Counter strike 1.6

Ne az oldalon található compilert használd a fordításhoz.

Google: amxx compiler ( Első találat )

Az oldalon belül válaszd ki az 1.8.1 -es Compilert es utána értelem szerűen feltöltöd az SMA-t és lefordítod.


Vagy ezt fordítsd át:

  1. /*  Formatleft � 2012, ConnorMcLeod
  2.  
  3.     Drop All Weapons On Death is free software;
  4.     you can redistribute it and/or modify it under the terms of the
  5.     GNU General Public License as published by the Free Software Foundation.
  6.  
  7.     This program is distributed in the hope that it will be useful,
  8.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.     GNU General Public License for more details.
  11.  
  12.     You should have received a copy of the GNU General Public License
  13.     along with Drop All Weapons On Death; if not, write to the
  14.     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15.     Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. /*
  19.     a   p228
  20.     b   scout
  21.     c   hegrenade
  22.     d   xm1014 
  23.     e   mac10
  24.     f   aug
  25.     g   smokegrenade
  26.     h   elite
  27.     i   fiveseven
  28.     j   ump45
  29.     k   sg550
  30.     l   galil
  31.     m   famas
  32.     n   usp
  33.     o   glock18
  34.     p   awp
  35.     q   mp5navy
  36.     r   m249
  37.     s   m3
  38.     t   m4a1
  39.     u   tmp
  40.     v   g3sg1
  41.     w   flashbang
  42.     x   deagle
  43.     x   sg552
  44.     z   ak47
  45.     {   p90
  46.     |   defuser
  47. */
  48.  
  49. #include < amxmodx >
  50. #include < amxmisc >
  51. #include < fakemeta >
  52. #include < hamsandwich >
  53.  
  54. #pragma semicolon 1
  55.  
  56.  
  57. #define VERSION "0.4.0"
  58.  
  59. const MAX_ITEM_TYPES = 6;   // hud item selection slots
  60. const MAX_AMMO_SLOTS = 15// not really slots // MAX_AMMO_SLOTS // don't need to set a 32 array since max ammo index is 14
  61.  
  62.  
  63. // "weapon_..." offsets
  64. const XO_CBASEPLAYERITEM = 4;
  65. // CBasePlayerItem
  66. const m_pPlayer = 41;
  67. const m_pNext = 42;
  68. const m_iId = 43;
  69.  
  70. // "player" offsets
  71. // Store only slots 1,2 and 4 values cause we won't drop knife and let the game drop c4
  72. // new const m_rgpPlayerItems_plr[] = {368, 369, 371}
  73. new  const m_rgpPlayerItems_CBasePlayer[6] = { 367 , 368 , ... };
  74. const m_pActiveItem = 373;
  75. new const m_rgAmmo_CBasePlayer[MAX_AMMO_SLOTS] = {376,377,...};
  76.  
  77. const m_bHasDefuser = 774;
  78.  
  79. // "weaponbox" offsets
  80. const XO_CWEAPONBOX = 4;
  81. new const m_rgpPlayerItems_CWeaponBox[MAX_ITEM_TYPES] = { 34 , 35 , ... };
  82. new const m_rgiszAmmo[32] = { 40 , 41 , ... };
  83. new const m_rgAmmo_CWeaponBox[32] = { 72 , 73 , ... };
  84. const m_cAmmoTypes = 104;
  85.  
  86. new const g_iMaxAmmo[] = {
  87.     0, 30, 90, 200, 90,
  88.     32, 100, 100, 35, 52,
  89.     120, 2, 1, 1, 1
  90. };
  91.  
  92. new const g_szOnCBasePlayer_Killed[] = "OnCBasePlayer_Killed";
  93. new const weaponbox[] = "weaponbox";
  94. new iszWeaponBox;
  95.  
  96. const NADES_BS = (1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE);
  97.  
  98. new g_iszAmmoNames[sizeof(g_iMaxAmmo)];
  99.  
  100. new g_iNoSilPluginId, g_iNoSilSetModel;
  101.  
  102. new m_usResetDecals, g_iFhPlaybackEventPost;
  103.  
  104. new g_iFhSetClientKeyValueP;
  105.  
  106. new g_iFlags;
  107.  
  108. new gmsgStatusIcon;
  109.  
  110. public plugin_init()
  111. {
  112.     register_plugin("Drop All Weapons On Death", VERSION, "ConnorMcLeod");
  113.  
  114.     register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0");
  115.  
  116.     RegisterHam(Ham_Killed, "player", g_szOnCBasePlayer_Killed);
  117.     new modname[7];
  118.     get_modname(modname, charsmax(modname));
  119.     if( equal(modname, "czero") )
  120.     {
  121.         g_iFhSetClientKeyValueP = register_forward(FM_SetClientKeyValue, "OnSetClientKeyValue_P", true);
  122.     }
  123.  
  124.     new const szAmmoNames[][] = {
  125.         "", "338Magnum", "762Nato", "556NatoBox", "556Nato",
  126.         "buckshot", "45ACP", "57mm", "50AE", "357SIG",
  127.         "9mm", "Flashbang", "HEGrenade", "SmokeGrenade", "C4"
  128.     };
  129.  
  130.     for(new i=1; i<sizeof(szAmmoNames); i++)
  131.     {
  132.         g_iszAmmoNames[i] = engfunc(EngFunc_AllocString, szAmmoNames[i]);
  133.     }
  134.  
  135.     iszWeaponBox = engfunc(EngFunc_AllocString, weaponbox);
  136.  
  137.     m_usResetDecals = engfunc(EngFunc_PrecacheEvent, 1, "events/decal_reset.sc");
  138.  
  139.     gmsgStatusIcon = get_user_msgid("StatusIcon");
  140.  
  141.     register_concmd("death_drop_rules", "ConCmd_Rules", ADMIN_CFG, " - <flags>");
  142. }
  143.  
  144. public plugin_cfg()
  145. {
  146.     g_iNoSilPluginId = is_plugin_loaded("NoSil");
  147.     if( g_iNoSilPluginId > 0 )
  148.     {
  149.         g_iNoSilSetModel = get_func_id("fw_setmodel", g_iNoSilPluginId);
  150.     }
  151. }
  152.  
  153. public ConCmd_Rules(id, level, cid)
  154. {
  155.     if( cmd_access(id, level, cid, 2) )
  156.     {
  157.         static const iWeaponsIds[] = {CSW_P228, CSW_SCOUT, CSW_HEGRENADE, CSW_XM1014, CSW_MAC10, CSW_AUG, CSW_SMOKEGRENADE,
  158.                                 CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_SG550, CSW_GALIL, CSW_FAMAS, CSW_USP, CSW_GLOCK18, CSW_AWP,
  159.                                 CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1, CSW_TMP, CSW_G3SG1, CSW_FLASHBANG, CSW_DEAGLE, CSW_SG552,
  160.                                 CSW_AK47, CSW_P90, 0};
  161.  
  162.         new szFlags[sizeof(iWeaponsIds)+1];
  163.         read_argv(1, szFlags, charsmax(szFlags));
  164.  
  165.         new i, cLetter, iVal;
  166.         g_iFlags = 0;
  167.  
  168.         while( (cLetter = szFlags[i++]) )
  169.         {
  170.             iVal = cLetter - 'a';
  171.             if( 0 <= iVal < sizeof(iWeaponsIds) )
  172.             {
  173.                 g_iFlags |= 1 << iWeaponsIds[iVal];
  174.             }
  175.         }
  176.     }
  177.     return PLUGIN_HANDLED;
  178. }
  179.  
  180. public OnSetClientKeyValue_P(id, const key[])
  181. {
  182.     if( equal(key, "*bot") )
  183.     {
  184.         RegisterHamFromEntity(Ham_Killed, id, g_szOnCBasePlayer_Killed);
  185.         unregister_forward(FM_SetClientKeyValue, g_iFhSetClientKeyValueP, true);
  186.     }
  187. }
  188.  
  189. public Event_HLTV_New_Round()
  190. {
  191.     if( !g_iFhPlaybackEventPost )
  192.     {
  193.         g_iFhPlaybackEventPost = register_forward(FM_PlaybackEvent, "OnPlaybackEvent_Post", true);
  194.     }
  195. }
  196.  
  197. // proceed here at the end of CHalfLifeMultiplay::RestartRound so other weaponbox has already been removed
  198. public OnPlaybackEvent_Post(flags, pInvoker, eventindex)
  199. {
  200.     if( g_iFhPlaybackEventPost && eventindex == m_usResetDecals )
  201.     {
  202.         unregister_forward(FM_PlaybackEvent, g_iFhPlaybackEventPost, true);
  203.         g_iFhPlaybackEventPost = 0;
  204.  
  205.         new iWpnBx = FM_NULLENT;
  206.  
  207.         while( (iWpnBx = engfunc(EngFunc_FindEntityByString, iWpnBx, "classname", weaponbox)) > 0 )
  208.         {
  209.             WeaponBox_Killed(iWpnBx);
  210.         }
  211.     }
  212. }
  213.  
  214. public OnCBasePlayer_Killed( id )
  215. {
  216.     new iActiveItem = get_pdata_cbase(id, m_pActiveItem);
  217.     if( iActiveItem > 0 && pev_valid( iActiveItem ) )
  218.     {
  219.         if( ~NADES_BS & (1<<get_pdata_int(iActiveItem, m_iId, XO_CBASEPLAYERITEM))
  220.         ||  ~pev(id, pev_button) & IN_ATTACK    )
  221.         {
  222.             ExecuteHam(Ham_Item_Holster, iActiveItem, 1);
  223.             iActiveItem = 0;
  224.         }
  225.     }
  226.     else
  227.     {
  228.         iActiveItem = 0; // depending on windows/linux it can be -1
  229.     }
  230.  
  231.     if( g_iFlags & 1<<0 && get_pdata_bool(id, m_bHasDefuser) ) // defuser
  232.     {
  233.         set_pdata_bool(id, m_bHasDefuser, false);
  234.         set_pev(id, pev_body, 0);
  235.         message_begin(MSG_ONE, gmsgStatusIcon, _, id);
  236.         write_byte(0);
  237.         write_string("defuser");
  238.         message_end();
  239.     }
  240.  
  241.     new iWeapon, iWeaponBox, iAmmoId, iBpAmmo, iNextWeapon;
  242.     new szWeapon[20], szModel[26];
  243.     new Float:flOrigin[3], Float:flAngles[3], Float:flWpnBxVelocity[3];
  244.    
  245.     pev(id, pev_origin, flOrigin);
  246.     pev(id, pev_angles, flAngles);
  247.  
  248.     flAngles[0] = 0.0;
  249.     flAngles[2] = 0.0;
  250.  
  251.     new iId;
  252.     for(new i=1; i<sizeof(m_rgpPlayerItems_CBasePlayer); i++)
  253.     {
  254.         if( i != 1 && i != 2 && i!= 4 ) // primary, secondary, nades
  255.         {
  256.             continue;
  257.         }
  258.         iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[i]);
  259.         while( iWeapon > 0 && pev_valid( iWeapon ) == 2 )
  260.         {
  261.             iNextWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_CBASEPLAYERITEM);
  262.             if( i == 4
  263.             &&  iWeapon == iActiveItem // ready to launch nade
  264.             &&  get_pdata_int(id, m_rgAmmo_CBasePlayer[ ExecuteHam(Ham_Item_PrimaryAmmoIndex, iWeapon) ]) <= 1  )
  265.             {
  266.                 iActiveItem = 0;
  267.                 iWeapon = iNextWeapon;
  268.                 continue;
  269.             }
  270.  
  271.             iWeaponBox = engfunc(EngFunc_CreateNamedEntity, iszWeaponBox);
  272.            
  273.             if( pev_valid(iWeaponBox) )
  274.             {
  275.                 set_pev(iWeaponBox, pev_owner, id);
  276.  
  277.                 engfunc(EngFunc_SetOrigin, iWeaponBox, flOrigin);
  278.  
  279.                 set_pev(iWeaponBox, pev_angles, flAngles);
  280.                 ExecuteHamB(Ham_Spawn, iWeaponBox);
  281.  
  282.                 flWpnBxVelocity[0] = random_float(-250.0,250.0);
  283.                 flWpnBxVelocity[1] = random_float(-250.0,250.0);
  284.                 set_pev(iWeaponBox, pev_velocity, flWpnBxVelocity);
  285.  
  286.                 iId = get_pdata_int(iWeapon, m_iId, XO_CBASEPLAYERITEM);
  287.                 if( !WeaponBox_PackWeapon(iWeaponBox, iWeapon, id, iId) )
  288.                 {
  289.                     set_pev(iWeaponBox, pev_flags, FL_KILLME);
  290.                 }
  291.                 else
  292.                 {
  293.                     if( !iActiveItem || iWeapon != iActiveItem )
  294.                     {
  295.                         iAmmoId = ExecuteHam(Ham_Item_PrimaryAmmoIndex, iWeapon);
  296.  
  297.                         iBpAmmo = get_pdata_int(id, m_rgAmmo_CBasePlayer[iAmmoId]);
  298.                     }
  299.  
  300.                     set_pdata_int(id, m_rgAmmo_CBasePlayer[iAmmoId], 0);           
  301.  
  302.                     WeaponBox_PackAmmo(iWeaponBox, iAmmoId, i == 4 ? iBpAmmo - 1 : iBpAmmo);
  303.  
  304.                     pev(iWeapon, pev_classname, szWeapon, charsmax(szWeapon));
  305.  
  306.                     if( szWeapon[10] == 'n' ) // weapon_mp5navy
  307.                     {
  308.                         // replace(szWeapon, charsmax(szWeapon), "navy", "")
  309.                         szWeapon[10] = EOS;
  310.                     }
  311.                     formatex(szModel, charsmax(szModel), "models/w_%s.mdl", szWeapon[7]);
  312.  
  313.                     engfunc(EngFunc_SetModel, iWeaponBox, szModel);
  314.  
  315.                     const SILENT_WPN_BS = (1<<CSW_USP)|(1<<CSW_M4A1);
  316.  
  317.                     if( g_iNoSilPluginId > 0
  318.                     &&  g_iNoSilSetModel > 0
  319.                     &&  (1<<iId) & SILENT_WPN_BS    )
  320.                     {
  321.                         callfunc_begin_i(g_iNoSilSetModel, g_iNoSilPluginId);
  322.                         callfunc_push_int(iWeaponBox);
  323.                         callfunc_push_str(szModel);
  324.                         callfunc_end();
  325.                     }
  326.  
  327.                 }
  328.             }
  329.  
  330.             iWeapon = iNextWeapon;
  331.         }
  332.     }
  333.     return HAM_HANDLED;
  334. }
  335.  
  336. WeaponBox_PackWeapon(iWeaponBox, iWeapon, id, iId)
  337. {
  338.     if( !ExecuteHam(Ham_RemovePlayerItem, id, iWeapon) )
  339.     {
  340.         return 0;
  341.     }
  342.  
  343.     if( g_iFlags & 1 << iId )
  344.     {
  345.         ExecuteHam(Ham_Item_Kill, iWeapon);
  346.         user_has_weapon(id, iId, 0);
  347.         return 0;
  348.     }
  349.  
  350.     new iWeaponSlot = ExecuteHam(Ham_Item_ItemSlot, iWeapon);
  351.  
  352.     set_pdata_cbase(iWeaponBox, m_rgpPlayerItems_CWeaponBox[ iWeaponSlot ], iWeapon, XO_CWEAPONBOX);
  353.     set_pdata_cbase(iWeapon, m_pNext, -1, XO_CBASEPLAYERITEM);
  354.  
  355.     set_pev(iWeapon, pev_spawnflags, pev(iWeapon, pev_spawnflags) | SF_NORESPAWN);
  356.     set_pev(iWeapon, pev_movetype, MOVETYPE_NONE);
  357.     set_pev(iWeapon, pev_solid, SOLID_NOT);
  358.     set_pev(iWeapon, pev_effects, EF_NODRAW);
  359.     set_pev(iWeapon, pev_modelindex, 0);
  360.     set_pev(iWeapon, pev_model, 0);
  361.     set_pev(iWeapon, pev_owner, iWeaponBox);
  362.     set_pdata_cbase(iWeapon, m_pPlayer, -1, XO_CBASEPLAYERITEM);
  363.  
  364.     return 1;
  365. }
  366.  
  367. WeaponBox_Killed(iWpnBx)
  368. {
  369.     new iWeapon;
  370.     for(new i=0; i<MAX_ITEM_TYPES; i++)
  371.     {
  372.         iWeapon = get_pdata_cbase(iWpnBx, m_rgpPlayerItems_CWeaponBox[ i ], XO_CWEAPONBOX);
  373.         if( pev_valid(iWeapon) )
  374.         {
  375.             set_pev(iWeapon, pev_flags, FL_KILLME);
  376.         }
  377.         // don't implement pNext system as it's a custom weaponbox that doesn't use it
  378.     }
  379.     set_pev(iWpnBx, pev_flags, FL_KILLME);
  380. }
  381.  
  382. WeaponBox_PackAmmo(iWeaponBox, iAmmoId, iCount)
  383. {
  384.     if( !iCount )
  385.     {
  386.         return;
  387.     }
  388.  
  389.     new iMaxCarry = g_iMaxAmmo[iAmmoId];
  390.  
  391.     if( iCount > iMaxCarry )
  392.     {
  393.         iCount = iMaxCarry;
  394.     }
  395.  
  396.     set_pdata_int(iWeaponBox, m_rgiszAmmo[0], g_iszAmmoNames[iAmmoId], XO_CWEAPONBOX);
  397.     set_pdata_int(iWeaponBox, m_rgAmmo_CWeaponBox[0], iCount, XO_CWEAPONBOX);
  398. }

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/