搜索
查看: 1994|回复: 1

问个问题..希望有人能解答一下.谢谢

[复制链接]
发表于 2009-1-19 07:02:18 | 显示全部楼层 |阅读模式 来自 广东广州
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <engine>

  4. new g_bwEnt[33]
  5. new cvar_enable

  6. static const PLUGIN_NAME[] = "Back Weapons"
  7. static const PLUGIN_AUTHOR[] = "Cheap_Suit"
  8. static const PLUGIN_VERSION[] = "1.2"

  9. public plugin_init()
  10. {
  11. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  12. register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
  13. register_event("Damage", "Event_DamageDeath", "bd", "2>0")
  14. register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  15. cvar_enable = register_cvar("amx_backweapons", "1")
  16. }

  17. public plugin_precache()
  18. {
  19. precache_model("models/p_ak47.mdl")
  20. precache_model("models/p_awp.mdl")
  21. precache_model("models/p_m4a1.mdl")
  22. precache_model("models/pshell.mdl")
  23. }

  24. public client_connect(id)
  25. {
  26. if(g_bwEnt[id] > 0)
  27. remove_entity(g_bwEnt[id])
  28. g_bwEnt[id] = 0
  29. }

  30. public client_disconnect(id)
  31. {
  32. if(g_bwEnt[id] > 0)
  33. remove_entity(g_bwEnt[id])
  34. g_bwEnt[id] = 0
  35. }

  36. public Event_DamageDeath(id)
  37. {
  38. if(g_bwEnt[id] > 0)
  39. remove_entity(g_bwEnt[id])
  40. g_bwEnt[id] = 0
  41. }

  42. public Event_CurWeapon(id)
  43. {
  44. if(!is_user_connected(id) || !is_user_alive(id))
  45. return PLUGIN_CONTINUE

  46. if(!cs_get_user_hasprim(id) && g_bwEnt[id] > 0)
  47. {
  48. remove_entity(g_bwEnt[id])
  49. g_bwEnt[id] = 0

  50. return PLUGIN_CONTINUE
  51. }

  52. if(!get_pcvar_num(cvar_enable) || !cs_get_user_hasprim(id))
  53. return PLUGIN_CONTINUE

  54. if(g_bwEnt[id] < 1)
  55. {
  56. g_bwEnt[id] = create_entity("info_target")
  57. if(g_bwEnt[id] > 0)
  58. {
  59. entity_set_int(g_bwEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  60. entity_set_edict(g_bwEnt[id], EV_ENT_aiment, id)
  61. }
  62. }

  63. if(g_bwEnt[id] < 1)
  64. return PLUGIN_CONTINUE

  65. switch(read_data(2))
  66. {
  67. case CSW_KNIFE, CSW_C4, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_FLASHBANG,
  68. CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_ELITE, CSW_FIVESEVEN:
  69. {
  70. new modelName[33], weaponID = get_weapon_id(id)
  71. get_model_name(weaponID, modelName, 32)

  72. if(equal(modelName, "models/pshell.mdl"))
  73. {
  74. set_entity_visibility(g_bwEnt[id], 0)
  75. return PLUGIN_CONTINUE
  76. }

  77. set_entity_visibility(g_bwEnt[id], 1)
  78. entity_set_model(g_bwEnt[id], modelName)
  79. }
  80. default: set_entity_visibility(g_bwEnt[id], 0)
  81. }
  82. return PLUGIN_CONTINUE
  83. }

  84. stock get_weapon_id(id)
  85. {
  86. new weapStr[32], iNum, weaponID
  87. get_user_weapons(id, weapStr, iNum)
  88. for(new i = 0; i < iNum; i++)
  89. {
  90. switch(weapStr[i])
  91. {
  92. case CSW_AK47, CSW_AUG, CSW_AWP, CSW_FAMAS, CSW_G3SG1, CSW_GALIL, CSW_M249,CSW_M3,
  93. CSW_M4A1, CSW_MP5NAVY, CSW_P90, CSW_SCOUT, CSW_SG550, CSW_SG552, CSW_UMP45, CSW_XM1014:
  94. {
  95. weaponID = weapStr[i]
  96. break
  97. }
  98. default: weaponID = 0
  99. }
  100. }
  101. return weaponID
  102. }

  103. stock get_model_name(weaponID, returnString[], returnLen)
  104. {
  105. new modelName
  106. switch(weaponID)
  107. {
  108. case CSW_AK47: modelName = format(returnString, returnLen, "models/p_ak47.mdl")
  109. case CSW_AWP: modelName = format(returnString, returnLen, "models/p_awp.mdl")
  110. case CSW_M4A1: modelName = format(returnString, returnLen, "models/p_m4a1.mdl")
  111. default: modelName = format(returnString, returnLen, "models/pshell.mdl")
  112. }
  113. return modelName
  114. }
复制代码
我将背枪插件改成这样.没问题

但为何.只有这三把枪可以.以其他枪就不可以呢.

背枪插件一共是十六把枪的

但是现在只能用三把到底为什么??????
 楼主| 发表于 2009-1-19 07:03:46 | 显示全部楼层 来自 广东广州
大家不防试试效果还几好看的..1.5  1.6都可以的
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表