AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=43)
-   -   SH_DMG_KILL problems (https://forums.alliedmods.net/showthread.php?t=147340)

Exploited 01-08-2011 06:40

SH_DMG_KILL problems
 
Hey there,

So, I am using a Grim Reaper version with SH_DMG_KILL as it doesn't do like 10000 damage unlike the version with that hammethod you guys helped me with earlier. The problem with my SH_DMG_KILL thing is that it doesn't always kill in one hit, but it does sometimes. It does not matter how much hp the victim have left.

Heres my code:

PHP Code:

// Grim Reaper 
#include <superheromod> 
new gHeroID
new 
bool:gHasGrim[SH_MAXSLOTS+1]; 
//----------------------------------------------------------------------------- 
public plugin_init() 

    
register_plugin("SUPERHERO Grim Reaper""0.1""Author"); 
 
    new 
pLevel register_cvar("grimreaper_level""8");
 
    
gHeroID sh_create_hero("Grim Reaper"pLevel); 
    
sh_set_hero_info(gHeroID"Rawr!""Knife = 1 Hit KO"); 
 
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage"); 

//----------------------------------------------------------------------------- 
public sh_hero_init(idheroIDmode
    if ( 
gHeroID == heroID 
        
gHasGrim[id] = mode true false;     
//----------------------------------------------------------------------------- 
public client_damage(attackervictim)
{
    if (
victim != attacker && is_user_connected(attacker) ) 
    if ( 
sh_is_active() && gHasGrim[attacker] && pev(attackerpev_button) & IN_ATTACK2 && get_user_weapon(attacker) == CSW_KNIFE )
        
sh_extra_damage(victimattacker1"knife"0SH_DMG_KILL )


I was thinking that maybe making the damage higher? That is the third param, which I currently set to one.

Any ideas?

Exploited

The Art of War 01-08-2011 10:42

Re: SH_DMG_KILL problems
 
This is how I do it, dont know if its causing the problem though.

PHP Code:

public client_damage(attackervictim)
{
    if (
victim != attacker && is_user_connected(attacker) ) 
    if ( 
sh_is_active() && gHasGrim[attacker] && pev(attackerpev_button) & IN_ATTACK2 && get_user_weapon(attacker) == CSW_KNIFE )
        
sh_extra_damage(victimattacker1"knife"0SH_DMG_KILL )


to
PHP Code:

public client_damage(attackervictimdamage)
{
    if (
victim != attacker && is_user_connected(attacker) ) 
    if ( 
sh_is_active() && gHasGrim[attacker] && pev(attackerpev_button) & IN_ATTACK2 && get_user_weapon(attacker) == CSW_KNIFE )
        
sh_extra_damage(victimattackerdamage"knife"0SH_DMG_KILL )



Exploited 01-08-2011 15:39

Re: SH_DMG_KILL problems
 
Thank you, but that didn't solve my issue.

G-Dog 01-08-2011 16:31

Re: SH_DMG_KILL problems
 
try
PHP Code:

public client_damage(attackervictim)
{
    if (
victim != attacker && is_user_connected(attacker) ) 
    if ( 
sh_is_active() && gHasGrim[attacker] && pev(attackerpev_button) & IN_ATTACK2 && get_user_weapon(attacker) == CSW_KNIFE )
    {
        
set_user_godmode(victim0);
        
sh_extra_damage(victimattacker1"knife"0SH_DMG_KILL );
    }



Exploited 01-08-2011 16:53

Re: SH_DMG_KILL problems
 
May I ask, what did you do with the godmde and why did you do it?

G-Dog 01-08-2011 17:01

Re: SH_DMG_KILL problems
 
the only reason SH_DMG_KILL wouldn't work that I can think of is that the person has godmode, that or you modified superhero and broke that functionality

Exploited 01-08-2011 17:11

Re: SH_DMG_KILL problems
 
So would this version hit through Captain Americas shield?

Exploited 01-09-2011 06:40

Re: SH_DMG_KILL problems
 
I tried G-Dogs version, and it has the same results as mine did. It works sometimes, but not always and it is not Captain America.

The Art of War 01-09-2011 08:38

Re: SH_DMG_KILL problems
 
Sorry I failed there.

This is what I use in a code that is working:

Code:

public client_damage(attacker, victim, damage, wpnindex, hitplace)
{
        if ( !sh_is_active() ) return
        if ( !is_user_connected(victim) || !is_user_alive(attacker) ) return

        if ( gHasHero[attacker] && wpnindex == CSW_KNIFE && random_float(0.01, 1.00) <= get_pcvar_float(pCvarChance) && damage > 0 ) {

                new headshot = hitplace == 1 ? 1 : 0
                sh_extra_damage(victim, attacker, damage, "DamageName", headshot, SH_DMG_KILL)
        }
}

'
Then of course change "Hero" to the variable's name and DamageName to whatever you want.

Exploited 01-09-2011 11:49

Re: SH_DMG_KILL problems
 
Nope, doesn't work 100%.


All times are GMT -4. The time now is 18:36.

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