Raised This Month: $ Target: $400
 0% 

Protect player from he grenade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
faki
Senior Member
Join Date: Jul 2013
Old 05-18-2014 , 12:31   Protect player from he grenade
Reply With Quote #1

How to ?
I use hamsandwich but i dont know how to made a check in takedmg event.

Last edited by faki; 05-18-2014 at 12:32.
faki is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 12:57   Re: Protect player from he grenade
Reply With Quote #2

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.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-18-2014 , 13:56   Re: Protect player from he grenade
Reply With Quote #3

Quote:
Originally Posted by faki View Post
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 ?
swapped is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-18-2014 , 14:00   Re: Protect player from he grenade
Reply With Quote #4

Swapped please don't comment in topics where you don't understand the goal. "Protect player from he grenade" -> no damage from he.
HamletEagle is offline
faki
Senior Member
Join Date: Jul 2013
Old 05-18-2014 , 14:20   Re: Protect player from he grenade
Reply With Quote #5

Flick3rR, thank you! Works great!
faki is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-19-2014 , 01:28   Re: Protect player from he grenade
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
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
swapped is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 05-19-2014 , 21:32   Re: Protect player from he grenade
Reply With Quote #7

Try this?

https://forums.alliedmods.net/showthread.php?t=216946
__________________
Blizzard_87 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-19-2014 , 23:28   Re: Protect player from he grenade
Reply With Quote #8

Flick3rR, are you serious? Inflictor from Ham_TakeDamage is not a constant value. Please edit your post.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-20-2014 , 03:35   Re: Protect player from he grenade
Reply With Quote #9

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?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-20-2014 , 07:23   Re: Protect player from he grenade
Reply With Quote #10

The problem is that Inflictor is an Entity where CSW_HEGRENADE is not
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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