Sorinel

Seizure Of Weapons 1.1

Aug 5th, 2020
1,457
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include < amxmodx >
  2. #include < fakemeta >
  3. #include < hamsandwich >
  4.  
  5. const WEAPON_BITSUM = ((1<<CSW_AWP))
  6.  
  7. #define VIP_FLAG ADMIN_LEVEL_H
  8.  
  9. #define PLUGIN    "Seizure Of Weapons"
  10. #define VERSION   "1.1"
  11. #define AUTHOR    "Sorinel"
  12.  
  13. public plugin_init() {
  14.      
  15.        register_plugin( PLUGIN, VERSION, AUTHOR )
  16.        register_event( "CurWeapon","CheckWeapon","be","1=1" )
  17. }
  18.  
  19. public CheckWeapon(id) {
  20.  
  21.        if(!is_user_alive(id) || get_user_flags(id) & VIP_FLAG )
  22.               return
  23.  
  24.        new szWeapons[32], iNum, i
  25.        get_user_weapons(id, szWeapons, iNum)
  26.  
  27.        for(i = 0; i < iNum; i++)
  28.        {
  29.           if(WEAPON_BITSUM & (1<<szWeapons[i]))
  30.           {
  31.                     new weaponname[32]
  32.             get_weaponname(szWeapons[i], weaponname, charsmax(weaponname))
  33.             bacon_strip_weapon(id, weaponname)
  34.           }
  35.     }
  36. }
  37.            
  38. stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
  39.     new strtype[11] = "classname", ent = index
  40.     switch (jghgtype) {
  41.         case 1: strtype = "target"
  42.         case 2: strtype = "targetname"
  43.     }
  44.  
  45.     while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
  46.  
  47.     return ent
  48. }
  49.  
  50. stock bacon_strip_weapon(index, weapon[])
  51. {
  52.     if(!equal(weapon, "weapon_", 7))
  53.         return PLUGIN_CONTINUE;
  54.  
  55.     static weaponid;
  56.     weaponid = get_weaponid(weapon)
  57.    
  58.     if(!weaponid)
  59.         return PLUGIN_CONTINUE;
  60.  
  61.     static weaponent;
  62.     weaponent = fm_find_ent_by_owner(-1, weapon, index);
  63.    
  64.     if(!weaponent)
  65.         return PLUGIN_CONTINUE;
  66.  
  67.     if(get_user_weapon(index) == weaponid)
  68.         ExecuteHamB(Ham_Weapon_RetireWeapon, weaponent);
  69.  
  70.     if(!ExecuteHamB(Ham_RemovePlayerItem, index, weaponent))
  71.         return PLUGIN_CONTINUE;
  72.    
  73.     ExecuteHamB(Ham_Item_Kill, weaponent);
  74.     set_pev(index, pev_weapons, pev(index, pev_weapons) & ~(1<<weaponid));
  75.  
  76.     return PLUGIN_HANDLED;
  77. }
RAW Paste Data