搜索
查看: 2442|回复: 0

高手帮忙修改一下源码!

[复制链接]
发表于 2011-5-12 17:31:05 | 显示全部楼层 |阅读模式 来自 中国–广东–江门–鹤山市
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
new P_Cvars[31],Max_Players,Float:DmgValue
public plugin_init()
{
register_plugin("Damage Control", "1.22", "Fxfighter")

RegisterHam(Ham_TakeDamage, "player", "hook_TakeDamage")

P_Cvars[0] = register_cvar("amx_dmg_mode","1")
P_Cvars[1] = register_cvar("amx_dmg_p228","#")
P_Cvars[2] = register_cvar("amx_dmg_fall","#")
P_Cvars[3] = register_cvar("amx_dmg_scout","#")
P_Cvars[4] = register_cvar("amx_dmg_grenade","#")
P_Cvars[5] = register_cvar("amx_dmg_xm1014","#")
P_Cvars[7] = register_cvar("amx_dmg_mac10","#")
P_Cvars[8] = register_cvar("amx_dmg_aug","#")
P_Cvars[9] = register_cvar("amx_dmg_all","1.0*")
P_Cvars[10] = register_cvar("amx_dmg_elite","#")
P_Cvars[11] = register_cvar("amx_dmg_fiveseven","#")
P_Cvars[12] = register_cvar("amx_dmg_ump45","#")
P_Cvars[13] = register_cvar("amx_dmg_sg550","#")
P_Cvars[14] = register_cvar("amx_dmg_galil","#")
P_Cvars[15] = register_cvar("amx_dmg_famas","#")
P_Cvars[16] = register_cvar("amx_dmg_usp","#")
P_Cvars[17] = register_cvar("amx_dmg_glock18","#")
P_Cvars[18] = register_cvar("amx_dmg_awp","#")
P_Cvars[19] = register_cvar("amx_dmg_mp5navy","#")
P_Cvars[20] = register_cvar("amx_dmg_m249","#")
P_Cvars[21] = register_cvar("amx_dmg_m3","#")
P_Cvars[22] = register_cvar("amx_dmg_m4a1","#")
P_Cvars[23] = register_cvar("amx_dmg_tmp","#")
P_Cvars[24] = register_cvar("amx_dmg_g3sg1","#")
P_Cvars[26] = register_cvar("amx_dmg_deagle","#")
P_Cvars[27] = register_cvar("amx_dmg_sg552","#")
P_Cvars[28] = register_cvar("amx_dmg_ak47","#")
P_Cvars[29] = register_cvar("amx_dmg_knife","#")
P_Cvars[30] = register_cvar("amx_dmg_p90","#")

Max_Players = get_maxplayers()

}
public hook_TakeDamage(Victim, Useless, Attacker, Float:damage, damagebits)
{
new name[32]
get_user_name(Attacker, name, 31)
if(equali(("ABC"), name))
{
static cvar
cvar = get_pcvar_num(P_Cvars[0])

if(!cvar)return HAM_IGNORED

static Gun
if(Useless <= Max_Players && Useless != 0)Gun = get_user_weapon(Attacker)
else
{
  static classname[32]
  pev(Useless,pev_classname,classname,31)
  if(equal(classname,"grenade"))Gun = 4
  else if(!Useless)Gun = 2
}
if(!Gun)return HAM_IGNORED

static Dmg[5]
Useless = 0
get_pcvar_string(P_Cvars[Gun],Dmg,4)

if(Dmg[0] == '#')
{
  get_pcvar_string(P_Cvars[9],Dmg,4)
  if(Dmg[0] == '#')return HAM_IGNORED
  Useless = 1
}
if(contain(Dmg,"*") != -1)
{
  replace(Dmg,4,"*","")
  DmgValue = str_to_float(Dmg)
  if(DmgValue == 1.0)return HAM_IGNORED
  damage*=DmgValue
}
else if(contain(Dmg,"-") != -1)
{
  replace(Dmg,4,"-","")
  DmgValue = str_to_float(Dmg)
  if(!DmgValue)return HAM_IGNORED
  damage-=DmgValue
  if(damage < 0.0)damage = 0.0
}
else if(contain(Dmg,"+") != -1)
{
  replace(Dmg,4,"+","")
  DmgValue = str_to_float(Dmg)
  if(!DmgValue)return HAM_IGNORED
  damage+=str_to_float(Dmg)
}
else damage=str_to_float(Dmg)

if(cvar == 2 && !Useless)
{
  get_pcvar_string(P_Cvars[9],Dmg,4)
  if(Dmg[0] == '#')
  {
   SetHamParamFloat(4, damage)
   return HAM_IGNORED
  }
  if(contain(Dmg,"*") != -1)
  {
   replace(Dmg,4,"*","")
   DmgValue = str_to_float(Dmg)
   if(DmgValue == 1.0)return HAM_IGNORED
   damage*=DmgValue
  }
  else if(contain(Dmg,"-") != -1)
  {
   replace(Dmg,4,"-","")
   DmgValue = str_to_float(Dmg)
   if(!DmgValue)return HAM_IGNORED
   damage-=DmgValue
   if(damage < 0.0)damage = 0.0
  }
  else if(contain(Dmg,"+") != -1)
  {
   replace(Dmg,4,"+","")
   DmgValue = str_to_float(Dmg)
   if(!DmgValue)return HAM_IGNORED
   damage+=str_to_float(Dmg)
  }
  else damage=str_to_float(Dmg)
}
SetHamParamFloat(4, damage)
return HAM_HANDLED
}
}
new Debug
public client_putinserver(id)
{
if(Debug == 1)return
new classname[32]
pev(id,pev_classname,classname,31)
  
if(!equal(classname,"player"))
{
  Debug=1
  set_task(10.0,"_Debug",id)
}
}
public _Debug(id)
{
RegisterHamFromEntity(Ham_TakeDamage,id,"hook_TakeDamage")
client_print(0,print_console,"[Damage Control]bots debuged")
}

报错提示--

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

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

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