搜索
楼主: xlove

[控制开枪(子弹)速度插件]

[复制链接]
发表于 2009-1-7 15:39:17 | 显示全部楼层 来自 中国–湖北–黄冈
我晕
我初一看 还以为你是自己写的

原来也是转的别人的插件
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>

  4. new P_Cvars[31]
  5. new Weapons[33][2]

  6. public plugin_init()
  7. {
  8.         register_plugin("Fire Rate Control", "1.01", "Fxfighter")
  9.         register_event("CurWeapon","Event_CurWeapon", "b")
  10.        
  11.         P_Cvars[0] = register_cvar("amx_fr","1")
  12.         P_Cvars[1] = register_cvar("amx_fr_p228","1.0")
  13.         P_Cvars[3] = register_cvar("amx_fr_scout","1.0")
  14.         P_Cvars[4] = register_cvar("amx_fr_hegrenade","1.0")
  15.         P_Cvars[5] = register_cvar("amx_fr_xm1014","1.0")
  16.         P_Cvars[6] = register_cvar("amx_fr_all","1.0")
  17.         P_Cvars[7] = register_cvar("amx_fr_mac10","1.0")
  18.         P_Cvars[8] = register_cvar("amx_fr_aug","1.0")
  19.         P_Cvars[9] = register_cvar("amx_fr_smokegrenade","1.0")
  20.         P_Cvars[10] = register_cvar("amx_fr_elite","1.0")
  21.         P_Cvars[11] = register_cvar("amx_fr_fiveseven","1.0")
  22.         P_Cvars[12] = register_cvar("amx_fr_ump45","1.0")
  23.         P_Cvars[13] = register_cvar("amx_fr_sg550","1.0")
  24.         P_Cvars[14] = register_cvar("amx_fr_galil","1.0")
  25.         P_Cvars[15] = register_cvar("amx_fr_famas","1.0")
  26.         P_Cvars[16] = register_cvar("amx_fr_usp","1.0")
  27.         P_Cvars[17] = register_cvar("amx_fr_glock18","1.0")
  28.         P_Cvars[18] = register_cvar("amx_fr_awp","1.0")
  29.         P_Cvars[19] = register_cvar("amx_fr_mp5navy","1.0")
  30.         P_Cvars[20] = register_cvar("amx_fr_m249","1.0")
  31.         P_Cvars[21] = register_cvar("amx_fr_m3","1.0")
  32.         P_Cvars[22] = register_cvar("amx_fr_m4a1","1.0")
  33.         P_Cvars[23] = register_cvar("amx_fr_tmp","1.0")
  34.         P_Cvars[24] = register_cvar("amx_fr_g3sg1","1.0")
  35.         P_Cvars[25] = register_cvar("amx_fr_flashbang","1.0")
  36.         P_Cvars[26] = register_cvar("amx_fr_deagle","1.0")
  37.         P_Cvars[27] = register_cvar("amx_fr_sg552","1.0")
  38.         P_Cvars[28] = register_cvar("amx_fr_ak47","1.0")
  39.         P_Cvars[30] = register_cvar("amx_fr_p90","1.0")
  40. }

  41. public Event_CurWeapon(id)
  42. {
  43.         new Gun = read_data(2)
  44.         new On = get_pcvar_num(P_Cvars[0])
  45.        
  46.         if( On == 0 || Gun==0 || Gun==6 || Gun==29 || Gun>30)
  47.                 return PLUGIN_CONTINUE               
  48.        
  49.         new Ammo = read_data(3)        
  50.         if(Weapons[id][0] == Gun && Weapons[id][1] <= Ammo)
  51.         {
  52.                 Weapons[id][1] = Ammo
  53.                 return PLUGIN_CONTINUE
  54.         }
  55.         Weapons[id][0] = Gun
  56.         Weapons[id][1] = Ammo
  57.        
  58.         new Float:N_Speed
  59.         if(On == 1)
  60.                 N_Speed = get_pcvar_float(P_Cvars[6])
  61.         else
  62.                 N_Speed = get_pcvar_float(P_Cvars[Gun])
  63.                
  64.         if(N_Speed != 1.0)
  65.         {
  66.                 new weapon[32]
  67.                 get_weaponname(Gun,weapon,31)
  68.                 new Ent = fm_find_ent_by_owner(-1,weapon,id)
  69.                 if(Ent)
  70.                 {
  71.                         new Float:Delay = get_pdata_float( Ent, 46, 4) * N_Speed
  72.                         if (Delay > 0.0)
  73.                                 set_pdata_float( Ent, 46, Delay, 4)       
  74.                 }
  75.         }
  76.         return PLUGIN_CONTINUE
  77. }
  78. //Frome Fakemeta utility
  79. stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
  80. {
  81.         new strtype[11] = "classname", ent = index
  82.         switch (jghgtype)
  83.         {
  84.                 case 1: strtype = "target"
  85.                 case 2: strtype = "targetname"
  86.         }
  87.        
  88.         while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
  89.        
  90.         return ent
  91. }
复制代码
回复

使用道具 举报

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

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