AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Scoping damage not being multiplied (https://forums.alliedmods.net/showthread.php?t=159221)

Excalibur.007 06-14-2011 07:43

[HELP] Scoping damage not being multiplied
 
Ham_TraceAttack(post/pre)
PHP Code:

public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], trdamagebits)
{
    if(
victim == attacker || !is_user_alive(attacker) || !is_user_alive(victim) || !zp_get_user_zombie(victim))
        return 
HAM_IGNORED
        
    
if(!(<= victim <= iMaxPlayers))
        return 
HAM_IGNORED
        
    
if(get_tr2(trTR_iHitgroup) == HIT_HEAD)
    {
        
IsHeadshot[attacker] = true
    
}
    return 
HAM_IGNORED


FM_TraceLine(post/pre)
PHP Code:

public fw_TraceLine(Float:start[3], Float:end[3], noMonstersidtrace)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
static victimvictim get_tr2(traceTR_pHit)
    
    if(!(
<= victim <= iMaxPlayers) || !is_user_alive(victim))
        return 
FMRES_IGNORED
    
    
if(get_tr2(traceTR_iHitgroup) == HIT_HEAD && (pev(idpev_button) & IN_ATTACK))
    {
        
IsHeadshot[id] = true
    
}
    
    return 
FMRES_IGNORED


Ham_TakeDamage(pre)
PHP Code:

public fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if(
victim == attacker || !is_user_alive(victim) || !is_user_alive(attacker))
        return 
HAM_IGNORED
        
    
if(iCurrentClass[victim] == && !zp_get_user_zombie(victim))
        
set_pdata_float(victimOFFSET_PAINSHOCK1.0OFFSET_LINUX)
    
    if(!
zp_get_user_zombie(victim))
        return 
HAM_IGNORED
    
    
switch(iCurrentClass[attacker])
    {
        case 
1:
        {
            if(
SUPPORT_SPECIALIST)
                
SetHamParamFloat(4damage dmg_ss)
        }
        case 
2:
        {
            if(
SHARPSHOOTER)
            {
                if(
IsHeadshot[attacker])
                {
                    
IsHeadshot[attacker] = false
                    SetHamParamFloat
(4damage dmg_s hsdmg_s)
                }
                    
                else
                {
                    
SetHamParamFloat(4damage dmg_s)
                }
            }
        }
        case 
3:
        {
            if(
COMMANDO)
                
SetHamParamFloat(4damage dmg_c)
        }
        case 
4:
        {
            if(
BERSERKER)
                
SetHamParamFloat(4damage dmg_b)
        }
    }
    return 
HAM_IGNORED


Define
PHP Code:

#define SHARPSHOOTER        (iCurrentWeapon[attacker] == CSW_SCOUT || iCurrentWeapon[attacker] == CSW_AWP || iCurrentWeapon[attacker] == CSW_SG550 || iCurrentWeapon[attacker] == CSW_G3SG1 || iCurrentWeapon[attacker] == CSW_GLOCK18 || iCurrentWeapon[attacker] == CSW_USP || iCurrentWeapon[attacker] == CSW_P228 || iCurrentWeapon[attacker] == CSW_DEAGLE || iCurrentWeapon[attacker] == CSW_ELITE) 

Snipers damage multiplier doesn't seems to work at all. Other pistols damage do multiply. Sry. Could only give codes related to the problem.

Focus on the case 2 which is Sharpshooter.

More description:
Scope damage doesn't multiplies but without scope it does multiply.

Exolent[jNr] 06-14-2011 11:32

Re: [HELP] Snipers damage not being multiplied
 
Show all code where iCurrentWeapon is set.

Excalibur.007 06-14-2011 19:18

Re: [HELP] Snipers damage not being multiplied
 
PHP Code:

register_event("CurWeapon""event_CurWeapon""be"

PHP Code:

public event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    iCurrentWeapon
[id] = read_data(2)
    
    if(
iCurrentClass[id] == 4)
    {    
        if(
iCurrentWeapon[id] != CSW_KNIFE)
            return 
PLUGIN_HANDLED
        
        
static Float:N_SpeedN_Speed rof_b
        
        
static weapon[32], ent
        get_weaponname
(iCurrentWeapon[id], weapon31)
        
ent fm_find_ent_by_owner(-1weaponid)
        
        if(
ent)
        {
            static 
Float:DelayFloat:M_Delay
            Delay 
get_pdata_float(ent464) * N_Speed
            M_Delay 
get_pdata_float(ent474) * N_Speed
            
            
if(Delay 0.0)
            {
                
set_pdata_float(ent46Delay4)
                
set_pdata_float(ent47M_Delay4)
            }
        }
    }
    return 
PLUGIN_HANDLED


Only CurWeapon is related to iCurrentWeapon.

Ignore this
PHP Code:

if(iCurrentClass[id] == 4)
{
//...


Oh there are FM_TraceLine & Ham_TraceAttack. Choose either 1 of them. Both of them have the same problems. My code uses both FM and Ham so just choose whichever is better.

Excalibur.007 06-15-2011 20:37

Re: [HELP] Snipers damage not being multiplied
 
Anybody has the same problems?

Scoping doesn't adds the damage multiplier

Topic title changed. Not snipers but it's scoping.


All times are GMT -4. The time now is 23:34.

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