搜索
查看: 1701|回复: 0

防弹衣掉落插件无效果,请有经验的帮忙帮忙,谢谢。

[复制链接]
发表于 2007-8-7 23:24:20 | 显示全部楼层 |阅读模式 来自 中国–广西–柳州–柳北区
版本是AMXX1.76C,加载防弹衣掉落插件之后还是没有任何效果,请问是不是缺少什么MDL或SPR才这样,可这段代码里面好像没有特别的MDL和SPR之处啊,谢谢了。源码:
/*************************************************************************************************************
                             AMX Pick Ammo
         
  Version: 0.1
  Author: KRoTaL
   
  0.1     Release
  
If you are out of ammo, instead of having to pick up another gun off the ground, pick up its ammo
just by walking over it.

  Cvar:
pickammo_limit 1    -     0: each time you walk over a weapon you'll get ammo
         1: only the first player who walks over the weapon gets ammo
      
  Setup (AMXX 1.1):
Install the amxx file.
Enable engine (in amxx's modules.ini)
Enable fun (in amxx's modules.ini
  Credits:
Idea by aak2002_2k2

*************************************************************************************************************/

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>

public plugin_init(){
register_plugin("Pick Ammo","0.1","KRoTaL")
register_cvar("pickammo_limit", "1")
}
public entity_touch(entity1, entity2){
if(entity1 > 0 && entity2 > 0){
  new classname1[32], classname2[32]
  entity_get_string(entity1, EV_SZ_classname, classname1, 31)
  entity_get_string(entity2, EV_SZ_classname, classname2, 31)
  new limit = get_cvar_num("pickammo_limit")
  if((equal(classname1, "weaponbox") || equal(classname1, "armoury_entity")) && equal(classname2, "player") &&
  (limit == 0 || (limit == 1 && entity_get_int(entity1, EV_INT_iuser4) != 1))){
   new model[64]
   entity_get_string(entity1, EV_SZ_model, model, 63)
   giveAmmo(entity2, entity1, model)
  }
}
}
giveAmmo(id, weapon, model[]){
if(equal(model, "models/w_p228.mdl")){
  if(hasWeapon(id, CSW_P228)){
   ammo(id, CSW_P228)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_scout.mdl")){
  if(hasWeapon(id, CSW_SCOUT)){
   ammo(id, CSW_SCOUT)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_xm1014.mdl")){
  if(hasWeapon(id, CSW_XM1014)){
   ammo(id, CSW_XM1014)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_mac10.mdl")){
  if(hasWeapon(id, CSW_MAC10)){
   ammo(id, CSW_MAC10)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_aug.mdl")){
  if(hasWeapon(id, CSW_AUG)){
   ammo(id, CSW_AUG)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_elite.mdl")){
  if(hasWeapon(id, CSW_ELITE)){
   ammo(id, CSW_ELITE)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_fiveseven.mdl")){
  if(hasWeapon(id, CSW_FIVESEVEN)){
   ammo(id, CSW_FIVESEVEN)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_ump45.mdl")){
  if(hasWeapon(id, CSW_UMP45)){
   ammo(id, CSW_UMP45)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_sg550.mdl")){
  if(hasWeapon(id, CSW_SG550)){
   ammo(id, CSW_SG550)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_galil.mdl")){
  if(hasWeapon(id, CSW_GALI)){
   ammo(id, CSW_GALI)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_famas.mdl")){
  if(hasWeapon(id, CSW_FAMAS)){
   ammo(id, CSW_FAMAS)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_usp.mdl")){
  if(hasWeapon(id, CSW_USP)){
   ammo(id, CSW_USP)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_glock18.mdl")){
  if(hasWeapon(id, CSW_GLOCK18)){
   ammo(id, CSW_GLOCK18)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_awp.mdl")){
  if(hasWeapon(id, CSW_AWP)){
   ammo(id, CSW_AWP)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_mp5.mdl")){
  if(hasWeapon(id, CSW_MP5NAVY)){
   ammo(id, CSW_MP5NAVY)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_m249.mdl")){
  if(hasWeapon(id, CSW_M249)){
   ammo(id, CSW_M249)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_m3.mdl")){
  if(hasWeapon(id, CSW_M3)){
   ammo(id, CSW_M3)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_m4a1.mdl")){
  if(hasWeapon(id, CSW_M4A1)){
   ammo(id, CSW_M4A1)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_tmp.mdl")){
  if(hasWeapon(id, CSW_TMP)){
   ammo(id, CSW_TMP)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_g3sg1.mdl")){
  if(hasWeapon(id, CSW_G3SG1)){
   ammo(id, CSW_G3SG1)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_deagle.mdl")){
  if(hasWeapon(id, CSW_DEAGLE)){
   ammo(id, CSW_DEAGLE)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_sg552.mdl")){
  if(hasWeapon(id, CSW_SG552)){
   ammo(id, CSW_SG552)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_ak47.mdl")){
  if(hasWeapon(id, CSW_AK47)){
   ammo(id, CSW_AK47)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
if(equal(model, "models/w_p90.mdl")){
  if(hasWeapon(id, CSW_P90)){
   ammo(id, CSW_P90)
   entity_set_int(weapon, EV_INT_iuser4, 1)
   return
  }
}
return
}
hasWeapon(id, weapid){
new weapons[32], wnum
get_user_weapons(id, weapons, wnum)
for(new i = 0; i < wnum; i++){
  if(weapons == weapid) return 1
}
return 0
}
ammo(id, weapid){
if (!is_user_connected(id) || !is_user_alive(id)) return
new clips = 0
new ammoString[32]
switch(weapid){
  case CSW_P228 : {
   clips = 4
   copy(ammoString, 31, "ammo_357sig")
  }
  case CSW_SCOUT : {
   clips = 3
   copy(ammoString, 31, "ammo_762nato")
  }
  case CSW_XM1014 : {
   clips = 4
   copy(ammoString, 31, "ammo_buckshot")
  }
  case CSW_MAC10 : {
   clips = 9
   copy(ammoString, 31, "ammo_45acp")
  }
  case CSW_AUG : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
  case CSW_ELITE : {
   clips = 4
   copy(ammoString, 31, "ammo_9mm")
  }
   case CSW_FIVESEVEN : {
   clips = 2
   copy(ammoString, 31, "ammo_57mm")
  }
  case CSW_UMP45 : {
   clips = 9
   copy(ammoString, 31, "ammo_45acp")
  }
  case CSW_SG550 : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
   case CSW_GALIL : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
  case CSW_FAMAS : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
  case CSW_USP : {
   clips = 9
   copy(ammoString, 31, "ammo_45acp")
  }
  case CSW_GLOCK18 : {
   clips = 4  
   copy(ammoString, 31, "ammo_9mm")
  }
  case CSW_AWP : {
   clips = 3
   copy(ammoString, 31, "ammo_338magnum")
  }
  case CSW_MP5NAVY : {
   clips = 4
   copy(ammoString, 31, "ammo_9mm")
  }
  case CSW_M249 : {
   clips = 7
   copy(ammoString, 31, "ammo_556natobox")
  }
  case CSW_M3 : {
   clips = 4
   copy(ammoString, 31, "ammo_buckshot")
  }
  case CSW_M4A1 : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
  case CSW_TMP : {
   clips = 4
   copy(ammoString, 31, "ammo_9mm")
  }
  case CSW_G3SG1 : {
   clips = 3
   copy(ammoString, 31, "ammo_762nato")
  }
  case CSW_DEAGLE : {
   clips = 5
   copy(ammoString, 31, "ammo_50ae")
  }
  case CSW_SG552 : {
   clips = 3
   copy(ammoString, 31, "ammo_556nato")
  }
  case CSW_AK47 : {
   clips = 3
   copy(ammoString, 31, "ammo_762nato")
  }
  case CSW_P90 : {
   clips = 2
   copy(ammoString, 31, "ammo_57mm")
  }
   default: return
}
for (new i = 0; i < clips; i++){
  give_item(id,ammoString)
}
}
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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