AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to stop grenades damage (https://forums.alliedmods.net/showthread.php?t=190238)

GhostMan 07-16-2012 08:41

how to stop grenades damage
 
PHP Code:

public hook_TakeDamage(victimattackeruselessFloat:damagedamagebits) {
 
     if(!
is_user_connected(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED
    
    
static classname[8]
    
pev(uselesspev_classnameclassnamecharsmax(classname))
    
    if(
g_iTimeLeft 0)
    {
        if((
equal(classname"grenade")))
        {
            return 
HAM_SUPERCEDE
        
}
    }
    return 
HAM_IGNORED


This one doesnt work. If i put (1<<24) its not working too. http://forums.alliedmods.net/showpos...8&postcount=71
Quote:

// For grenade damage (In CS) the bits is equal to (1<<24)

<VeCo> 07-16-2012 09:01

Re: how to stop grenades damage
 
PHP Code:

public hook_TakeDamage(victimattackeruseless 

It should be:

victim, useless, attacker

Else, your is_user_connected check fails and that's why damagebits check (and the whole function) doesn't work.

GhostMan 07-16-2012 10:01

Re: how to stop grenades damage
 
Quote:

Originally Posted by <VeCo> (Post 1751518)
Else, your is_user_connected check fails and that's why damagebits check (and the whole function) doesn't work.

Actually the damage from bullets or knife is stopped, but anyways, you mean i should completely remove this part?
PHP Code:

if(!is_user_connected(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED 


<VeCo> 07-16-2012 10:44

Re: how to stop grenades damage
 
I mean to reorder the parameters. You have changed the position of attacker and useless.

But actually, is_user_connected(victim) isn't needed - the victim is always a connected player.

Aooka 07-16-2012 11:31

Re: how to stop grenades damage
 
Code:
is_user_connected( );

->


Code:
is_user_alive( );

I think it's better.

lucas_7_94 07-16-2012 11:36

Re: how to stop grenades damage
 
No , is_user_connected is fine .


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

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