Page 1 of 1

mod problem

Posted: 08 Feb 2019, 15:56
by sPe3doN
hi can someone help on my server zombies can pick up weapons and shot on humans

Re: mod problem

Posted: 08 Feb 2019, 17:45
by th3_king
Try this code:
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <fakemeta>
  4. #include <reapi>
  5.  
  6. #define ALLOWED_KEY 55110
  7.  
  8. new bool:g_bTKilledCT[33]
  9.  
  10. public plugin_init()
  11. {
  12.     register_plugin("No pickup Weapons", "1.0", "Raheem")
  13.    
  14.     // Hams
  15.     RegisterHam(Ham_Touch, "weaponbox", "Fw_TouchWeaponBox_Pre", 0)
  16.     RegisterHam(Ham_Touch, "armoury_entity", "Fw_TouchWeaponBox_Pre", 0)
  17.    
  18.     // Forwards
  19.     register_forward(FM_SetModel, "Fw_SetModel")
  20.    
  21.     // Events
  22.     register_event("DeathMsg", "DeathMsgEvent", "a");
  23. }
  24.  
  25. public Fw_TouchWeaponBox_Pre(iEnt, iIndex)
  26. {
  27.     if(!is_user_alive(iIndex))
  28.         return HAM_IGNORED
  29.    
  30.     // Block T From Pick UP Weapons
  31.     if(get_member(iIndex, m_iTeam) == TEAM_TERRORIST && !(pev(iEnt, pev_impulse) == ALLOWED_KEY))
  32.     {
  33.         client_print(iIndex, print_center, "You can't pickup guns!")
  34.         return HAM_SUPERCEDE
  35.     }
  36.    
  37.     return HAM_IGNORED
  38. }
  39.  
  40. public Fw_SetModel(iEnt, szModel[])
  41. {
  42.     if(!pev_valid(iEnt))
  43.         return FMRES_IGNORED
  44.    
  45.     new iOwner = pev(iEnt, pev_owner)
  46.    
  47.     if (g_bTKilledCT[iOwner])
  48.     {
  49.         set_pev(iEnt, pev_impulse, ALLOWED_KEY)
  50.     }
  51.  
  52.     return FMRES_IGNORED
  53. }
  54.  
  55. public DeathMsgEvent()
  56. {
  57.     new iAttacker = read_data(1);
  58.     new iVictim = read_data(2);
  59.    
  60.     if (get_member(iAttacker, m_iTeam) == TEAM_TERRORIST && get_user_weapon(iAttacker) == CSW_KNIFE)
  61.     {
  62.         g_bTKilledCT[iVictim] = true;
  63.     }
  64. }

Re: mod problem

Posted: 11 Feb 2019, 22:01
by Spir0x
Th3 king should we use this plugin ? or only him cuz he uses outdated version of our mod ? becuz i don't have this bug on my server.