高手帮忙修改一下源码!
本帖最后由 8903320 于 2011-5-12 17:28 编辑这个是修改武器威力的插件,在僵尸服里,如何添加根据游戏名给予增加武器的威力。
红色部分是自己添加的语句,请教如何修改。
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
new P_Cvars,Max_Players,Float:DmgValue
public plugin_init()
{
register_plugin("Damage Control", "1.22", "Fxfighter")
RegisterHam(Ham_TakeDamage, "player", "hook_TakeDamage")
P_Cvars = register_cvar("amx_dmg_mode","1")
P_Cvars = register_cvar("amx_dmg_p228","#")
P_Cvars = register_cvar("amx_dmg_fall","#")
P_Cvars = register_cvar("amx_dmg_scout","#")
P_Cvars = register_cvar("amx_dmg_grenade","#")
P_Cvars = register_cvar("amx_dmg_xm1014","#")
P_Cvars = register_cvar("amx_dmg_mac10","#")
P_Cvars = register_cvar("amx_dmg_aug","#")
P_Cvars = register_cvar("amx_dmg_all","1.0*")
P_Cvars = register_cvar("amx_dmg_elite","#")
P_Cvars = register_cvar("amx_dmg_fiveseven","#")
P_Cvars = register_cvar("amx_dmg_ump45","#")
P_Cvars = register_cvar("amx_dmg_sg550","#")
P_Cvars = register_cvar("amx_dmg_galil","#")
P_Cvars = register_cvar("amx_dmg_famas","#")
P_Cvars = register_cvar("amx_dmg_usp","#")
P_Cvars = register_cvar("amx_dmg_glock18","#")
P_Cvars = register_cvar("amx_dmg_awp","#")
P_Cvars = register_cvar("amx_dmg_mp5navy","#")
P_Cvars = register_cvar("amx_dmg_m249","#")
P_Cvars = register_cvar("amx_dmg_m3","#")
P_Cvars = register_cvar("amx_dmg_m4a1","#")
P_Cvars = register_cvar("amx_dmg_tmp","#")
P_Cvars = register_cvar("amx_dmg_g3sg1","#")
P_Cvars = register_cvar("amx_dmg_deagle","#")
P_Cvars = register_cvar("amx_dmg_sg552","#")
P_Cvars = register_cvar("amx_dmg_ak47","#")
P_Cvars = register_cvar("amx_dmg_knife","#")
P_Cvars = register_cvar("amx_dmg_p90","#")
Max_Players = get_maxplayers()
}
public hook_TakeDamage(Victim, Useless, Attacker, Float:damage, damagebits)
{
//以下是自己添加了一个判断游戏名的语句,编译时就提示出错,请问如何修改?谢谢
new name
get_user_name( Attacker, name, 31)
if(equali(("ABC"), name))
{
static cvar
cvar = get_pcvar_num(P_Cvars)
if(!cvar)return HAM_IGNORED
static Gun
if(Useless <= Max_Players && Useless != 0)Gun = get_user_weapon(Attacker)
else
{
static classname
pev(Useless,pev_classname,classname,31)
if(equal(classname,"grenade"))Gun = 4
else if(!Useless)Gun = 2
}
if(!Gun)return HAM_IGNORED
static Dmg
Useless = 0
get_pcvar_string(P_Cvars,Dmg,4)
if(Dmg == '#')
{
get_pcvar_string(P_Cvars,Dmg,4)
if(Dmg == '#')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,Dmg,4)
if(Dmg == '#')
{
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
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,"bots debuged")
}
报错提示--最新提示
路过,,不懂插件 不知道哪里错,是不是定义问题呀。? 。。。晕。。没有人会呀。? 友情帮顶 好像有软件可以弄武器的把
页:
[1]