AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Protect player from he grenade (https://forums.alliedmods.net/showthread.php?t=240598)

faki 05-18-2014 12:31

Protect player from he grenade
 
How to ?
I use hamsandwich but i dont know how to made a check in takedmg event.

Flick3rR 05-18-2014 12:57

Re: Protect player from he grenade
 
PHP Code:

#define DMG_HE (1<<24)

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_TakeDamage"player""Damage")
}

public 
Damage(victinfatkFloat:damagedmgb)
{
    if(
dmgb DMG_HE |/*ooor the other way*/inf == CSW_HEGRENADE)
        
SetHamParamFloat(4damage*0)
    


This code sets the damage from grenades to 0, in other words, not a single damage caused by grenade. If you want it to be in some special conditions, I advise you to use a boolean. :)

swapped 05-18-2014 13:56

Re: Protect player from he grenade
 
Quote:

Originally Posted by faki (Post 2139522)
How to ?
I use hamsandwich but i dont know how to made a check in takedmg event.

Protect from what?

You wana block throw he grenade or what ?

HamletEagle 05-18-2014 14:00

Re: Protect player from he grenade
 
Swapped please don't comment in topics where you don't understand the goal. "Protect player from he grenade" -> no damage from he.

faki 05-18-2014 14:20

Re: Protect player from he grenade
 
Flick3rR, thank you! Works great!

swapped 05-19-2014 01:28

Re: Protect player from he grenade
 
Quote:

Originally Posted by HamletEagle (Post 2139564)
Swapped please don't comment in topics where you don't understand the goal. "Protect player from he grenade" -> no damage from he.

Aham, sorry but if i dont understand what they need to , how i can help him ?
I ask him to be more detalied to be able to help him :wink:

Blizzard_87 05-19-2014 21:32

Re: Protect player from he grenade
 
Try this?

https://forums.alliedmods.net/showthread.php?t=216946

claudiuhks 05-19-2014 23:28

Re: Protect player from he grenade
 
Flick3rR, are you serious? Inflictor from Ham_TakeDamage is not a constant value. Please edit your post.

Flick3rR 05-20-2014 03:35

Re: Protect player from he grenade
 
OK, as I saw the last two posts in this topic https://forums.alliedmods.net/showthread.php?t=134262 I was like the inflictor is used for grenades. So, if this is not the right way, or syntax, or something else, whats the problem.
P.S.: I use dmgbits mostly, so I'm not very clear with the inflictor, but as I get from these post it this topic, inflictor could be used for grenade index, but for other guns its same as attacker. I guess this is not the right way to get it, you may share?

YamiKaitou 05-20-2014 07:23

Re: Protect player from he grenade
 
The problem is that Inflictor is an Entity where CSW_HEGRENADE is not


All times are GMT -4. The time now is 09:40.

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