AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I change the head dmg (https://forums.alliedmods.net/showthread.php?t=126542)

kostov 05-10-2010 14:06

How do I change the head dmg
 
How can this transformed code, so the impact to the head to take more dmg?

PHP Code:

#include <amxmodx>
#include <hamsandwich>

new CvarFloat

public plugin_init()
{
    
register_plugin("""""")
    
CvarFloat      register_cvar("awp_damage""50");
    
RegisterHam(Ham_TakeDamage,"player","TakeDamage");
}

public 
TakeDamage(victim,inflictor,attacker,Float:damage,damage_bits){
    if(
inflictor && inflictor)
        
SetHamParamFloat(4get_user_weapon(attacker) == CSW_KNIFE get_pcvar_float(CvarFloat) : damage)



HLM 05-10-2010 14:22

Re: How do I change the head dmg
 
are you wanting the head damage to deal 50 more damage?

kostov 05-10-2010 14:25

Re: How do I change the head dmg
 
shoot body = 50dmg
shoot head =
over 50dmg

HLM 05-10-2010 14:39

Re: How do I change the head dmg
 
Quote:

Originally Posted by kostov (Post 1176630)
Code:

        SetHamParamFloat(4, get_user_weapon(attacker) == CSW_KNIFE ? get_pcvar_float(CvarFloat) : damage)

I dont know too much about sethamparamfloat, but im reading this as, if its a headshot with csw_knife, hit him for 50 damage, else, just do the normal damage, so...

Code:

SetHamParamFloat(4, get_user_weapon(attacker) == CSW_KNIFE ? (damage + get_pcvar_float(CvarFloat)) : damage
that should fix it, but I dont know to be honest :(

kostov 05-10-2010 14:53

Re: How do I change the head dmg
 
Currently, wherever it takes targeting 50 damage. I just want to change the headshot to take in more than a certain cvar

wrecked_ 05-10-2010 15:20

Re: How do I change the head dmg
 
You can't get whether it's a headshot or not based on the Ham_TakeDamage forward alone (unless you want to compare the guns with the damage dealt, which would be dumb and ugly). You'll need to use different forwards.

Voi 05-11-2010 12:46

Re: How do I change the head dmg
 
use Ham_TraceAttack in pre(without 1 in the end of the hook in plugin init)
instead Ham_TakeDamage

and then get the hitplace from traceline:
Code:

hitplace = get_tr2( tr, TR_iHitgroup )
(you have tr in the hook)

I just recenly have an issue that I was needing hitplace in hamsandwich. As far as I remember its the only way.


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

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