请哪位帮帮一下.........谢谢
首先感谢原作者,想增加手雷爆炸时不见人(就是躲在里面的人)不掉血这个功能,
请哪位帮帮一下.........谢谢
#include <amxmodx>
#include <fakemeta>
new normalTrace, lastTrace, cvEnabled, weapon, dummy;
// plugin load
public plugin_init()
{
register_plugin("No Walls","0.13","Avalanche");
register_cvar("nowalls_version","0.13",FCVAR_SERVER);
cvEnabled = register_cvar("nowalls_enabled","1");
register_event("ResetHUD","event_resethud","b");
register_clcmd("fullupdate","cmd_fullupdate");
register_forward(FM_TraceLine,"fw_traceline");
register_forward(FM_PlayerPostThink,"fw_playerpostthink");
}
// reset normal trace id on join or leave
public client_connect(id)
{
normalTrace = 0;
}
public client_disconnect(id)
{
normalTrace = 0;
}
// player spawns, and some other such things
public event_resethud(id)
{
lastTrace = 0;
}
// block forced resethud call
public cmd_fullupdate(id)
{
return PLUGIN_HANDLED;
}
// traceline hook, meat and bones of the entire plugin
public fw_traceline(Float:vecStart,Float:vecEnd,ignoreM,id,ptr) // pentToSkip == id, for clarity
{
if(!is_user_connected(id))
return FMRES_IGNORED;
// grab normal trace
if(!normalTrace)
{
normalTrace = ptr;
return FMRES_IGNORED;
}
// ignore normal trace
else if(ptr == normalTrace)
return FMRES_IGNORED;
// no functionality
if(!get_pcvar_num(cvEnabled))
return FMRES_IGNORED;
// not a player entity, or player is dead
if(!is_user_alive(id))
return FMRES_IGNORED;
// not shooting anything
if(!(pev(id,pev_button) & IN_ATTACK))
return FMRES_IGNORED;
weapon = get_user_weapon(id,dummy,dummy);
// using a shotgun, expect multiple tracelines
if(weapon == CSW_M3 || weapon == CSW_XM1014)
return FMRES_IGNORED;
// this is a second traceline, for shooting through walls
if(ptr == lastTrace)
{
// values sure to throw off any traceline
set_tr(TR_vecEndPos,Float:{4096.0,4096.0,4096.0});
set_tr(TR_AllSolid,1);
set_tr(TR_pHit,0);
set_tr(TR_iHitgroup,0);
set_tr(TR_flFraction,1.0);
return FMRES_SUPERCEDE;
}
// remeber traceline index for next time
lastTrace = ptr;
return FMRES_IGNORED;
}
// finished client calculations, reset our traceline index
public fw_playerpostthink(id)
{
lastTrace = 0;
} 是看不到手雷还是看不到攻击者. 就是看不见手雷即使人雷很近也不受到伤害(如手雷爆炸而人躲在门后也不被伤害)
谢谢先了... 这个可以完全代替你之前那个插件了.自己试下.
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#define PLUGIN_NAME "No Walls"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
#define DMG_HEGRENADE (1 << 24)
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHam(Ham_TakeDamage,"player","fw_TakeDamage");
}
public fw_TakeDamage(victim, idinflictor, idattacker, Float:damage, damagebits)
{
if((damagebits & DMG_HEGRENADE))
{
if(victim==idattacker) //如果自己炸自己
return HAM_IGNORED;
else{
if(!is_visible(victim,idinflictor))
{
SetHamParamFloat(4,0.0);
return HAM_HANDLED;
}
}
}else{
if(!is_visible(idattacker,victim))
{
SetHamParamFloat(4,0.0);
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
顶。。。。这也要改。。。。 本帖最后由 心静如水 于 2009-4-4 22:26 编辑
手雷功能达到了,但很难杀死人.....特难才对...... 手雷功能达到了,但很难杀死人.....特难才对...... 试试这个.
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <xs>
#define PLUGIN_NAME "No Walls"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
#define DMG_HEGRENADE (1 << 24)
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHam(Ham_TakeDamage,"player","fw_TakeDamage");
}
public fw_TakeDamage(victim, idinflictor, idattacker, Float:damage, damagebits)
{
if((damagebits & DMG_HEGRENADE))
{
if(victim==idattacker) //如果自己炸自己
return HAM_IGNORED;
else{
if(!fm_is_ent_visible(victim,idinflictor,1))
{
SetHamParamFloat(4,0.0);
return HAM_HANDLED;
}
}
}else{
if(!fm_is_ent_visible(idattacker,victim,1))
{
SetHamParamFloat(4,0.0);
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
stock bool:fm_is_ent_visible(index, entity, ignoremonsters = 0) {
new Float:start, Float:dest;
pev(index, pev_origin, start);
pev(index, pev_view_ofs, dest);
xs_vec_add(start, dest, start);
pev(entity, pev_origin, dest);
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0);
new Float:fraction;
get_tr2(0, TR_flFraction, fraction);
if (fraction == 1.0 || get_tr2(0, TR_pHit) == entity)
return true;
return false;
}
本帖最后由 心静如水 于 2009-4-6 00:55 编辑
好像编译的CX.INC文件出错?
...
修改(141行)enum xs_logtypes 成 ;enum xs_logtypes 才能编译...谢谢zwfgdlc老师!
页:
[1]