hlmod.hu
https://hlmod.hu/

Háton fegyver csak CT-nek
https://hlmod.hu/viewtopic.php?f=10&t=4846
Oldal: 1 / 1

Szerző:  tson_ [2012.06.22. 19:52 ]
Hozzászólás témája:  Háton fegyver csak CT-nek

Valaki átírná ezt hogy csak a CT hátán jelenjen meg ?
Kód:
  1. #include <amxmodx>

  2. #include <fakemeta>

  3. #include <hamsandwich>

  4.  

  5. #define PLUGIN  "Back Weapons"

  6. #define AUTHOR  "hoboman313/cheap_suit"

  7. #define VERSION "1.87"

  8.  

  9. #define MAX_PLAYERS             32

  10. #define OFFSET_PRIMARYWEAPON    116

  11. #define OFFSET_WEAPONTYPE       43

  12. #define EXTRAOFFSET_WEAPONS     4

  13. #define OFFSET_AUTOSWITCH       509

  14. #define OFFSET_SHIELD           510

  15. #define HAS_SHIELD              (1<<24)

  16.  

  17. #define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 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 | 1<<CSW_AK47 | 1<<CSW_P90)

  18.  

  19. #define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))

  20. #define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)

  21. #define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)

  22. #define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)

  23. #define cs_get_user_shield(%1)     (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

  24.  

  25. enum

  26. {

  27.         MODEL_NULL    = 0,

  28.         MODEL_AUG     = 1,

  29.         MODEL_AK47    = 2,

  30.         MODEL_AWP     = 3,

  31.         MODEL_MP5NAVY = 4,

  32.         MODEL_P90     = 5,

  33.         MODEL_GALIL   = 6,

  34.         MODEL_M4A1    = 7,

  35.         MODEL_SG550   = 8,

  36.         MODEL_SG552   = 9,

  37.         MODEL_SCOUT   = 10,

  38.         MODEL_XM1014  = 11,

  39.         MODEL_M3      = 12,

  40.         MODEL_G3SG1   = 13,

  41.         MODEL_M249    = 14,

  42.         MODEL_FAMAS   = 15,

  43.         MODEL_UMP45   = 16

  44. }

  45.  

  46. new g_weapons[][] =

  47. {      

  48.         "weapon_p228",

  49.         "weapon_scout",

  50.         "weapon_hegrenade",

  51.         "weapon_xm1014",

  52.         "weapon_c4",

  53.         "weapon_mac10",

  54.         "weapon_aug",

  55.         "weapon_smokegrenade",

  56.         "weapon_elite",

  57.         "weapon_fiveseven",

  58.         "weapon_ump45",

  59.         "weapon_sg550",

  60.         "weapon_galil",

  61.         "weapon_famas",

  62.         "weapon_usp",

  63.         "weapon_glock18",

  64.         "weapon_awp",

  65.         "weapon_mp5navy",

  66.         "weapon_m249",

  67.         "weapon_m3",

  68.         "weapon_m4a1",

  69.         "weapon_tmp",

  70.         "weapon_g3sg1",

  71.         "weapon_flashbang",

  72.         "weapon_deagle",

  73.         "weapon_sg552",

  74.         "weapon_ak47",

  75.         "weapon_knife",

  76.         "weapon_p90"

  77. }

  78.  

  79. new g_weaponclass[] = "backweapon"

  80. new g_weaponmodel[] = "models/backweapons.mdl"

  81.  

  82. new g_weaponent[MAX_PLAYERS+1]

  83.  

  84. public plugin_init()

  85. {

  86.         register_plugin(PLUGIN, VERSION, AUTHOR)

  87.         register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)

  88.  

  89.         RegisterHam(Ham_Killed,           "player", "bacon_killed")

  90.         RegisterHam(Ham_Spawn,            "player", "bacon_spawn_post", 1)

  91.         RegisterHam(Ham_AddPlayerItem,    "player", "bacon_addplayeritem")

  92.         RegisterHam(Ham_RemovePlayerItem, "player", "bacon_removeplayeritem")

  93.  

  94.         for(new i = 0; i < sizeof g_weapons; i++)

  95.         {

  96.                 RegisterHam(Ham_Item_AttachToPlayer, g_weapons[i], "bacon_item_attachtoplayer_post", 1)

  97.                 RegisterHam(Ham_Item_Deploy,         g_weapons[i], "bacon_item_deploy_post",         1)

  98.         }

  99. }

  100.  

  101. public plugin_precache()

  102.         precache_model(g_weaponmodel)

  103.  

  104. public client_putinserver(id)

  105. {

  106.         static infotarget

  107.         if(!infotarget) infotarget = engfunc(EngFunc_AllocString, "info_target")

  108.  

  109.         g_weaponent[id] = engfunc(EngFunc_CreateNamedEntity, infotarget)

  110.         if(pev_valid(g_weaponent[id]))

  111.         {

  112.                 engfunc(EngFunc_SetModel, g_weaponent[id], g_weaponmodel)

  113.                 set_pev(g_weaponent[id], pev_classname, g_weaponclass)

  114.                 set_pev(g_weaponent[id], pev_movetype, MOVETYPE_FOLLOW)

  115.                 set_pev(g_weaponent[id], pev_effects, EF_NODRAW)

  116.                 set_pev(g_weaponent[id], pev_aiment, id)

  117.         }

  118. }

  119.  

  120. public client_disconnect(id)

  121. {

  122.         if(g_weaponent[id] > 0 && pev_valid(g_weaponent[id]))

  123.                 engfunc(EngFunc_RemoveEntity, g_weaponent[id])

  124.  

  125.         g_weaponent[id] = 0

  126. }

  127.  

  128. public bacon_killed(id, idattacker, shouldgib)

  129.         fm_set_entity_visibility(g_weaponent[id], 0)

  130.  

  131. public bacon_addplayeritem(id, ent)

  132. {

  133.         static weaponid; weaponid = cs_get_weapon_type(ent)

  134.         if(is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))

  135.         {

  136.                 fm_set_entity_visibility(g_weaponent[id], 0)

  137.                 set_pev(g_weaponent[id], pev_body, get_weapon_model(weaponid))

  138.         }

  139. }

  140.  

  141. public bacon_removeplayeritem(id, ent)

  142. {

  143.         if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  144.                 fm_set_entity_visibility(g_weaponent[id], 0)

  145. }

  146.  

  147. public bacon_spawn_post(id) if(is_user_alive(id))

  148. {

  149.         if(!cs_get_user_hasprim(id))

  150.                 fm_set_entity_visibility(g_weaponent[id], 0)

  151. }

  152.  

  153. public bacon_item_attachtoplayer_post(ent, id) if(is_user_alive(id) && !cs_get_user_autoswitch(id))

  154. {

  155.         if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  156.                 fm_set_entity_visibility(g_weaponent[id], 1)

  157. }

  158.  

  159. public bacon_item_deploy_post(ent)

  160. {

  161.         static id; id = pev(ent, pev_owner)

  162.         if(is_user_alive(id))

  163.         {

  164.                 static weapon; weapon = cs_get_weapon_type(ent)

  165.                 if(is_weapon_primary(weapon) || cs_get_user_shield(id))

  166.                         fm_set_entity_visibility(g_weaponent[id], 0)

  167.  

  168.                 else if(cs_get_user_hasprim(id))

  169.                         fm_set_entity_visibility(g_weaponent[id], 1)

  170.         }

  171. }

  172.  

  173. stock get_weapon_model(weapon)

  174. {

  175.         switch(weapon)

  176.         {

  177.                 case CSW_SCOUT:   return MODEL_SCOUT

  178.                 case CSW_XM1014:  return MODEL_XM1014

  179.                 case CSW_AUG:     return MODEL_AUG

  180.                 case CSW_UMP45:   return MODEL_UMP45

  181.                 case CSW_SG550:   return MODEL_SG550

  182.                 case CSW_GALIL:   return MODEL_GALIL

  183.                 case CSW_FAMAS:   return MODEL_FAMAS

  184.                 case CSW_AWP:     return MODEL_AWP

  185.                 case CSW_MP5NAVY: return MODEL_MP5NAVY

  186.                 case CSW_M249:    return MODEL_M249

  187.                 case CSW_M3:      return MODEL_M3

  188.                 case CSW_M4A1:    return MODEL_M4A1

  189.                 case CSW_G3SG1:   return MODEL_G3SG1

  190.                 case CSW_SG552:   return MODEL_SG552

  191.                 case CSW_AK47:    return MODEL_AK47

  192.                 case CSW_P90:     return MODEL_P90

  193.         }

  194.         return 0

  195. }

  196.  

  197. stock fm_set_entity_visibility(index, visible = 1)

  198.         set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

Szerző:  CocaIne.^ [2012.06.23. 13:17 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

Teszt nemvolt
Kód:
  1.     #include <amxmodx>

  2.     #include <fakemeta>

  3.     #include <hamsandwich>

  4.     #include <cstrike>

  5.      

  6.     #define PLUGIN  "Back Weapons"

  7.     #define AUTHOR  "hoboman313/cheap_suit"

  8.     #define VERSION "1.87"

  9.      

  10.     #define MAX_PLAYERS             32

  11.     #define OFFSET_PRIMARYWEAPON    116

  12.     #define OFFSET_WEAPONTYPE       43

  13.     #define EXTRAOFFSET_WEAPONS     4

  14.     #define OFFSET_AUTOSWITCH       509

  15.     #define OFFSET_SHIELD           510

  16.     #define HAS_SHIELD              (1<<24)

  17.      

  18.     #define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 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 | 1<<CSW_AK47 | 1<<CSW_P90)

  19.      

  20.     #define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))

  21.     #define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)

  22.     #define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)

  23.     #define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)

  24.     #define cs_get_user_shield(%1)     (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

  25.      

  26.     enum

  27.     {

  28.             MODEL_NULL    = 0,

  29.             MODEL_AUG     = 1,

  30.             MODEL_AK47    = 2,

  31.             MODEL_AWP     = 3,

  32.             MODEL_MP5NAVY = 4,

  33.             MODEL_P90     = 5,

  34.             MODEL_GALIL   = 6,

  35.             MODEL_M4A1    = 7,

  36.             MODEL_SG550   = 8,

  37.             MODEL_SG552   = 9,

  38.             MODEL_SCOUT   = 10,

  39.             MODEL_XM1014  = 11,

  40.             MODEL_M3      = 12,

  41.             MODEL_G3SG1   = 13,

  42.             MODEL_M249    = 14,

  43.             MODEL_FAMAS   = 15,

  44.             MODEL_UMP45   = 16

  45.     }

  46.      

  47.     new g_weapons[][] =

  48.     {      

  49.             "weapon_p228",

  50.             "weapon_scout",

  51.             "weapon_hegrenade",

  52.             "weapon_xm1014",

  53.             "weapon_c4",

  54.             "weapon_mac10",

  55.             "weapon_aug",

  56.             "weapon_smokegrenade",

  57.             "weapon_elite",

  58.             "weapon_fiveseven",

  59.             "weapon_ump45",

  60.             "weapon_sg550",

  61.             "weapon_galil",

  62.             "weapon_famas",

  63.             "weapon_usp",

  64.             "weapon_glock18",

  65.             "weapon_awp",

  66.             "weapon_mp5navy",

  67.             "weapon_m249",

  68.             "weapon_m3",

  69.             "weapon_m4a1",

  70.             "weapon_tmp",

  71.             "weapon_g3sg1",

  72.             "weapon_flashbang",

  73.             "weapon_deagle",

  74.             "weapon_sg552",

  75.             "weapon_ak47",

  76.             "weapon_knife",

  77.             "weapon_p90"

  78.     }

  79.      

  80.     new g_weaponclass[] = "backweapon"

  81.     new g_weaponmodel[] = "models/backweapons.mdl"

  82.      

  83.     new g_weaponent[MAX_PLAYERS+1]

  84.      

  85.     public plugin_init()

  86.     {

  87.             register_plugin(PLUGIN, VERSION, AUTHOR)

  88.             register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)

  89.      

  90.             RegisterHam(Ham_Killed,           "player", "bacon_killed")

  91.             RegisterHam(Ham_Spawn,            "player", "bacon_spawn_post", 1)

  92.             RegisterHam(Ham_AddPlayerItem,    "player", "bacon_addplayeritem")

  93.             RegisterHam(Ham_RemovePlayerItem, "player", "bacon_removeplayeritem")

  94.      

  95.             for(new i = 0; i < sizeof g_weapons; i++)

  96.             {

  97.                     RegisterHam(Ham_Item_AttachToPlayer, g_weapons[i], "bacon_item_attachtoplayer_post", 1)

  98.                     RegisterHam(Ham_Item_Deploy,         g_weapons[i], "bacon_item_deploy_post",         1)

  99.             }

  100.     }

  101.      

  102.     public plugin_precache()

  103.             precache_model(g_weaponmodel)

  104.      

  105.     public client_putinserver(id)

  106.     {

  107.         new CsTeams:userTeam = cs_get_user_team(id)

  108.         if (userTeam == CS_TEAM_CT) {

  109.             static infotarget

  110.             if(!infotarget) infotarget = engfunc(EngFunc_AllocString, "info_target")

  111.      

  112.             g_weaponent[id] = engfunc(EngFunc_CreateNamedEntity, infotarget)

  113.             if(pev_valid(g_weaponent[id]))

  114.             {

  115.                     engfunc(EngFunc_SetModel, g_weaponent[id], g_weaponmodel)

  116.                     set_pev(g_weaponent[id], pev_classname, g_weaponclass)

  117.                     set_pev(g_weaponent[id], pev_movetype, MOVETYPE_FOLLOW)

  118.                     set_pev(g_weaponent[id], pev_effects, EF_NODRAW)

  119.                     set_pev(g_weaponent[id], pev_aiment, id)

  120.             }

  121.          }

  122.     }

  123.     public client_disconnect(id)

  124.     {

  125.             if(g_weaponent[id] > 0 && pev_valid(g_weaponent[id]))

  126.                     engfunc(EngFunc_RemoveEntity, g_weaponent[id])

  127.      

  128.             g_weaponent[id] = 0

  129.     }

  130.      

  131.     public bacon_killed(id, idattacker, shouldgib)

  132.             fm_set_entity_visibility(g_weaponent[id], 0)

  133.      

  134.     public bacon_addplayeritem(id, ent)

  135.     {

  136.             static weaponid; weaponid = cs_get_weapon_type(ent)

  137.             if(is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))

  138.             {

  139.                     fm_set_entity_visibility(g_weaponent[id], 0)

  140.                     set_pev(g_weaponent[id], pev_body, get_weapon_model(weaponid))

  141.             }

  142.     }

  143.      

  144.     public bacon_removeplayeritem(id, ent)

  145.     {

  146.             if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  147.                     fm_set_entity_visibility(g_weaponent[id], 0)

  148.     }

  149.      

  150.     public bacon_spawn_post(id) if(is_user_alive(id))

  151.     {

  152.             if(!cs_get_user_hasprim(id))

  153.                     fm_set_entity_visibility(g_weaponent[id], 0)

  154.     }

  155.      

  156.     public bacon_item_attachtoplayer_post(ent, id) if(is_user_alive(id) && !cs_get_user_autoswitch(id))

  157.     {

  158.             if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  159.                     fm_set_entity_visibility(g_weaponent[id], 1)

  160.     }

  161.      

  162.     public bacon_item_deploy_post(ent)

  163.     {

  164.             static id; id = pev(ent, pev_owner)

  165.             if(is_user_alive(id))

  166.             {

  167.                     static weapon; weapon = cs_get_weapon_type(ent)

  168.                     if(is_weapon_primary(weapon) || cs_get_user_shield(id))

  169.                             fm_set_entity_visibility(g_weaponent[id], 0)

  170.      

  171.                     else if(cs_get_user_hasprim(id))

  172.                             fm_set_entity_visibility(g_weaponent[id], 1)

  173.             }

  174.     }

  175.      

  176.     stock get_weapon_model(weapon)

  177.     {

  178.             switch(weapon)

  179.             {

  180.                     case CSW_SCOUT:   return MODEL_SCOUT

  181.                     case CSW_XM1014:  return MODEL_XM1014

  182.                     case CSW_AUG:     return MODEL_AUG

  183.                     case CSW_UMP45:   return MODEL_UMP45

  184.                     case CSW_SG550:   return MODEL_SG550

  185.                     case CSW_GALIL:   return MODEL_GALIL

  186.                     case CSW_FAMAS:   return MODEL_FAMAS

  187.                     case CSW_AWP:     return MODEL_AWP

  188.                     case CSW_MP5NAVY: return MODEL_MP5NAVY

  189.                     case CSW_M249:    return MODEL_M249

  190.                     case CSW_M3:      return MODEL_M3

  191.                     case CSW_M4A1:    return MODEL_M4A1

  192.                     case CSW_G3SG1:   return MODEL_G3SG1

  193.                     case CSW_SG552:   return MODEL_SG552

  194.                     case CSW_AK47:    return MODEL_AK47

  195.                     case CSW_P90:     return MODEL_P90

  196.             }

  197.             return 0

  198.     }

  199.      

  200.     stock fm_set_entity_visibility(index, visible = 1)

  201.             set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

Szerző:  tson_ [2012.06.27. 16:56 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

Nem jó...

Szerző:  oroszrulett [2012.06.27. 18:53 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

Nagyon nehéz lenne bővebben kifejteni, hogy mi nem jó? Gondolok itt arra, hogy továbbra is mindenkinek a hátán van fegyver, vagy kifagy tőle a szerver, stb. Elsősorban logot kérnénk szerver leállás esetén.

Éledéskor lekérdezi, hogy a játékos csapata CT-e, ha nem, akkor megállítja az "eseményeket". :)
Kód:
  1.     #include <amxmodx>

  2.  

  3.     #include <fakemeta>

  4.  

  5.     #include <hamsandwich>

  6.  

  7.     #include <cstrike>

  8.  

  9.      

  10.  

  11.     #define PLUGIN  "Back Weapons"

  12.  

  13.     #define AUTHOR  "hoboman313/cheap_suit"

  14.  

  15.     #define VERSION "1.87"

  16.  

  17.      

  18.  

  19.     #define MAX_PLAYERS             32

  20.  

  21.     #define OFFSET_PRIMARYWEAPON    116

  22.  

  23.     #define OFFSET_WEAPONTYPE       43

  24.  

  25.     #define EXTRAOFFSET_WEAPONS     4

  26.  

  27.     #define OFFSET_AUTOSWITCH       509

  28.  

  29.     #define OFFSET_SHIELD           510

  30.  

  31.     #define HAS_SHIELD              (1<<24)

  32.  

  33.      

  34.  

  35.     #define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 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 | 1<<CSW_AK47 | 1<<CSW_P90)

  36.  

  37.      

  38.  

  39.     #define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))

  40.  

  41.     #define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)

  42.  

  43.     #define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)

  44.  

  45.     #define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)

  46.  

  47.     #define cs_get_user_shield(%1)     (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

  48.  

  49.      

  50.  

  51.     enum

  52.  

  53.     {

  54.  

  55.             MODEL_NULL    = 0,

  56.  

  57.             MODEL_AUG     = 1,

  58.  

  59.             MODEL_AK47    = 2,

  60.  

  61.             MODEL_AWP     = 3,

  62.  

  63.             MODEL_MP5NAVY = 4,

  64.  

  65.             MODEL_P90     = 5,

  66.  

  67.             MODEL_GALIL   = 6,

  68.  

  69.             MODEL_M4A1    = 7,

  70.  

  71.             MODEL_SG550   = 8,

  72.  

  73.             MODEL_SG552   = 9,

  74.  

  75.             MODEL_SCOUT   = 10,

  76.  

  77.             MODEL_XM1014  = 11,

  78.  

  79.             MODEL_M3      = 12,

  80.  

  81.             MODEL_G3SG1   = 13,

  82.  

  83.             MODEL_M249    = 14,

  84.  

  85.             MODEL_FAMAS   = 15,

  86.  

  87.             MODEL_UMP45   = 16

  88.  

  89.     }

  90.  

  91.      

  92.  

  93.     new g_weapons[][] =

  94.  

  95.     {      

  96.  

  97.             "weapon_p228",

  98.  

  99.             "weapon_scout",

  100.  

  101.             "weapon_hegrenade",

  102.  

  103.             "weapon_xm1014",

  104.  

  105.             "weapon_c4",

  106.  

  107.             "weapon_mac10",

  108.  

  109.             "weapon_aug",

  110.  

  111.             "weapon_smokegrenade",

  112.  

  113.             "weapon_elite",

  114.  

  115.             "weapon_fiveseven",

  116.  

  117.             "weapon_ump45",

  118.  

  119.             "weapon_sg550",

  120.  

  121.             "weapon_galil",

  122.  

  123.             "weapon_famas",

  124.  

  125.             "weapon_usp",

  126.  

  127.             "weapon_glock18",

  128.  

  129.             "weapon_awp",

  130.  

  131.             "weapon_mp5navy",

  132.  

  133.             "weapon_m249",

  134.  

  135.             "weapon_m3",

  136.  

  137.             "weapon_m4a1",

  138.  

  139.             "weapon_tmp",

  140.  

  141.             "weapon_g3sg1",

  142.  

  143.             "weapon_flashbang",

  144.  

  145.             "weapon_deagle",

  146.  

  147.             "weapon_sg552",

  148.  

  149.             "weapon_ak47",

  150.  

  151.             "weapon_knife",

  152.  

  153.             "weapon_p90"

  154.  

  155.     }

  156.  

  157.      

  158.  

  159.     new g_weaponclass[] = "backweapon"

  160.  

  161.     new g_weaponmodel[] = "models/backweapons.mdl"

  162.  

  163.      

  164.  

  165.     new g_weaponent[MAX_PLAYERS+1]

  166.  

  167.      

  168.  

  169.     public plugin_init()

  170.  

  171.     {

  172.  

  173.             register_plugin(PLUGIN, VERSION, AUTHOR)

  174.  

  175.             register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)

  176.  

  177.      

  178.  

  179.             RegisterHam(Ham_Killed,           "player", "bacon_killed")

  180.  

  181.             RegisterHam(Ham_Spawn,            "player", "bacon_spawn_post", 1)

  182.  

  183.             RegisterHam(Ham_AddPlayerItem,    "player", "bacon_addplayeritem")

  184.  

  185.             RegisterHam(Ham_RemovePlayerItem, "player", "bacon_removeplayeritem")

  186.  

  187.      

  188.  

  189.             for(new i = 0; i < sizeof g_weapons; i++)

  190.  

  191.             {

  192.  

  193.                     RegisterHam(Ham_Item_AttachToPlayer, g_weapons[i], "bacon_item_attachtoplayer_post", 1)

  194.  

  195.                     RegisterHam(Ham_Item_Deploy,         g_weapons[i], "bacon_item_deploy_post",         1)

  196.  

  197.             }

  198.  

  199.     }

  200.  

  201.      

  202.  

  203.     public plugin_precache()

  204.  

  205.             precache_model(g_weaponmodel)

  206.  

  207.      

  208.  

  209.     public client_putinserver(id)

  210.  

  211.     {

  212.  

  213.         new CsTeams:userTeam = cs_get_user_team(id)

  214.  

  215.         if (userTeam == CS_TEAM_CT) {

  216.  

  217.             static infotarget

  218.  

  219.             if(!infotarget) infotarget = engfunc(EngFunc_AllocString, "info_target")

  220.  

  221.      

  222.  

  223.             g_weaponent[id] = engfunc(EngFunc_CreateNamedEntity, infotarget)

  224.  

  225.             if(pev_valid(g_weaponent[id]))

  226.  

  227.             {

  228.  

  229.                     engfunc(EngFunc_SetModel, g_weaponent[id], g_weaponmodel)

  230.  

  231.                     set_pev(g_weaponent[id], pev_classname, g_weaponclass)

  232.  

  233.                     set_pev(g_weaponent[id], pev_movetype, MOVETYPE_FOLLOW)

  234.  

  235.                     set_pev(g_weaponent[id], pev_effects, EF_NODRAW)

  236.  

  237.                     set_pev(g_weaponent[id], pev_aiment, id)

  238.  

  239.             }

  240.  

  241.          }

  242.  

  243.     }

  244.  

  245.     public client_disconnect(id)

  246.  

  247.     {

  248.  

  249.             if(g_weaponent[id] > 0 && pev_valid(g_weaponent[id]))

  250.  

  251.                     engfunc(EngFunc_RemoveEntity, g_weaponent[id])

  252.  

  253.      

  254.  

  255.             g_weaponent[id] = 0

  256.  

  257.     }

  258.  

  259.      

  260.  

  261.     public bacon_killed(id, idattacker, shouldgib)

  262.  

  263.             fm_set_entity_visibility(g_weaponent[id], 0)

  264.  

  265.      

  266.  

  267.     public bacon_addplayeritem(id, ent)

  268.  

  269.     {

  270.  

  271.             static weaponid; weaponid = cs_get_weapon_type(ent)

  272.  

  273.             if(is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))

  274.  

  275.             {

  276.  

  277.                     fm_set_entity_visibility(g_weaponent[id], 0)

  278.  

  279.                     set_pev(g_weaponent[id], pev_body, get_weapon_model(weaponid))

  280.  

  281.             }

  282.  

  283.     }

  284.  

  285.      

  286.  

  287.     public bacon_removeplayeritem(id, ent)

  288.  

  289.     {

  290.  

  291.             if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  292.  

  293.                     fm_set_entity_visibility(g_weaponent[id], 0)

  294.  

  295.     }

  296.  

  297.      

  298.  

  299.     public bacon_spawn_post(id)

  300.     {

  301.         if((cs_get_user_team(id) != CS_TEAM_CT) && !is_user_alive(id))

  302.                 return PLUGIN_CONTINUE

  303.                 if(!cs_get_user_hasprim(id))

  304.                 {

  305.                         fm_set_entity_visibility(g_weaponent[id], 0)

  306.                 }          

  307.         return PLUGIN_CONTINUE

  308.  

  309.     }

  310.  

  311.     public bacon_item_attachtoplayer_post(ent, id) if(is_user_alive(id) && !cs_get_user_autoswitch(id))

  312.  

  313.     {

  314.  

  315.             if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))

  316.  

  317.                     fm_set_entity_visibility(g_weaponent[id], 1)

  318.  

  319.     }

  320.  

  321.      

  322.  

  323.     public bacon_item_deploy_post(ent)

  324.  

  325.     {

  326.  

  327.             static id; id = pev(ent, pev_owner)

  328.  

  329.             if(is_user_alive(id))

  330.  

  331.             {

  332.  

  333.                     static weapon; weapon = cs_get_weapon_type(ent)

  334.  

  335.                     if(is_weapon_primary(weapon) || cs_get_user_shield(id))

  336.  

  337.                             fm_set_entity_visibility(g_weaponent[id], 0)

  338.  

  339.      

  340.  

  341.                     else if(cs_get_user_hasprim(id))

  342.  

  343.                             fm_set_entity_visibility(g_weaponent[id], 1)

  344.  

  345.             }

  346.  

  347.     }

  348.  

  349.      

  350.  

  351.     stock get_weapon_model(weapon)

  352.  

  353.     {

  354.  

  355.             switch(weapon)

  356.  

  357.             {

  358.  

  359.                     case CSW_SCOUT:   return MODEL_SCOUT

  360.  

  361.                     case CSW_XM1014:  return MODEL_XM1014

  362.  

  363.                     case CSW_AUG:     return MODEL_AUG

  364.  

  365.                     case CSW_UMP45:   return MODEL_UMP45

  366.  

  367.                     case CSW_SG550:   return MODEL_SG550

  368.  

  369.                     case CSW_GALIL:   return MODEL_GALIL

  370.  

  371.                     case CSW_FAMAS:   return MODEL_FAMAS

  372.  

  373.                     case CSW_AWP:     return MODEL_AWP

  374.  

  375.                     case CSW_MP5NAVY: return MODEL_MP5NAVY

  376.  

  377.                     case CSW_M249:    return MODEL_M249

  378.  

  379.                     case CSW_M3:      return MODEL_M3

  380.  

  381.                     case CSW_M4A1:    return MODEL_M4A1

  382.  

  383.                     case CSW_G3SG1:   return MODEL_G3SG1

  384.  

  385.                     case CSW_SG552:   return MODEL_SG552

  386.  

  387.                     case CSW_AK47:    return MODEL_AK47

  388.  

  389.                     case CSW_P90:     return MODEL_P90

  390.  

  391.             }

  392.  

  393.             return 0

  394.  

  395.     }

  396.  

  397.      

  398.  

  399.     stock fm_set_entity_visibility(index, visible = 1)

  400.  

  401.             set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

Szerző:  tson_ [2012.06.27. 19:42 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

SEemmi nem történt, senkinek nem volt és nem fagyott ki
tesztelem ezt is

Szerző:  oroszrulett [2012.06.27. 20:25 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

Idézet:
tesztelem ezt is


ÉÉs?

Szerző:  tson_ [2012.06.27. 23:20 ]
Hozzászólás témája:  Re: Háton fegyver csak CT-nek

Nem igazán működik, nem fagy le, és nincs senkinek a hátán.

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