i got this script for hit multiple player for deagle weapon, (make higher penetration)
https://forums.alliedmods.net/showthread.php?t=148432
but i have no idea to use that.
i try on ham_traceattack, but not work.
please help.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
public plugin_init()
{
RegisterHam(Ham_TraceAttack, "player", "fw_PlayerTraceAttack")
}
public fw_PlayerTraceAttack(Victim, Attacker, Float:Damage, Float:Direction[3], TraceResult, DamageBits)
{
if(!is_user_alive(Attacker))
return HAM_IGNORED
if(get_user_weapon(Attacker) != CSW_DEAGLE)
return HAM_IGNORED
trace()
return HAM_SUPERCEDE
}
public trace()
{
new Float:vecStart[3] // This should be the original start position
new Float:vecEnd[3] // And this should be the end position
new iTraceHit // hitted entity
new iEntToIgnore // this would change at every trace
new iTraceHandle = create_tr2()// trace handle
while(engfunc(EngFunc_TraceLine, vecStart, vecEnd, DONT_IGNORE_MONSTERS, iEntToIgnore, iTraceHandle)) // will always return 1, see engfunc.cpp
{
iTraceHit = get_tr2(iTraceHandle, TR_pHit) // getting hitted entity
if(get_global_float(GL_trace_fraction) >= 1.0) // the traceline finished at the original end position, so we will stop here
break;
if(!is_user_alive(iTraceHit)) // if you want to stop the traceline when it hits a wall, use this
break;
// your functions here
// the next traceline will start at the end of the last one
iEntToIgnore = iTraceHit
get_tr2(iTraceHandle, TR_vecEndPos, vecStart)
}
get_tr2(iTraceHandle, TR_vecEndPos, vecEnd) // out of the loop, this will get the last position of the last traceline. you can use a beam effect or something if you want
free_tr2(iTraceHandle) // freeing the tracehandle
}
and how to limit for certain mount of enemy ?
thanks.