AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Traceline hit (https://forums.alliedmods.net/showthread.php?t=233756)

m4m3ts 01-19-2014 19:57

Traceline hit
 
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(VictimAttackerFloat:DamageFloat:Direction[3], TraceResultDamageBits
{
    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_TraceLinevecStartvecEndDONT_IGNORE_MONSTERSiEntToIgnoreiTraceHandle)) // will always return 1, see engfunc.cpp
    
{
        
iTraceHit get_tr2(iTraceHandleTR_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
(iTraceHandleTR_vecEndPosvecStart)
    }

    
get_tr2(iTraceHandleTR_vecEndPosvecEnd// 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.

meTaLiCroSS 01-19-2014 20:38

Re: Traceline hit
 
Quote:

Originally Posted by m4m3ts (Post 2088272)
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(VictimAttackerFloat:DamageFloat:Direction[3], TraceResultDamageBits
{
    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_TraceLinevecStartvecEndDONT_IGNORE_MONSTERSiEntToIgnoreiTraceHandle)) // will always return 1, see engfunc.cpp
    
{
        
iTraceHit get_tr2(iTraceHandleTR_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
(iTraceHandleTR_vecEndPosvecStart)
    }

    
get_tr2(iTraceHandleTR_vecEndPosvecEnd// 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.

So you don't need that.

Best way is hooking FireBullets3 with Rage, and change penetration parameter with the number of penetrations that you want for the weapon.


All times are GMT -4. The time now is 10:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.