AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Amplify damage taken from trigger_hurt (https://forums.alliedmods.net/showthread.php?t=242649)

georgik57 06-22-2014 13:25

Amplify damage taken from trigger_hurt
 
I can't find damage type trigger_hurt in the hlsdk_const.ini. Please help me detect the trigger_hurt damage.

Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     register_plugin("D7 Damage Amplifier Trigger Hurt", "0.0.1", "D i 5 7 i n c T")         RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") } public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) {     if (damage >= 100.0 && /* DETECT TRIGGER_HURT DAMAGE */)     {         damage *= 500.0                 SetHamParamFloat(4, damage)     } }

Flick3rR 06-22-2014 13:41

Re: Amplify damage taken from trigger_hurt
 
PHP Code:

(dmgbits DMG_GENERIC

?
That's the only thing on my mind right now, will se anywhere to help!
EDIT: I think that this thread, and mostly ConnorMcLeod's reply, will help you.
https://forums.alliedmods.net/showthread.php?t=94221

.Dare Devil. 06-22-2014 14:35

Re: Amplify damage taken from trigger_hurt
 
Trigger_hurt can have different damage types.
I see 2 ways to do this.

#1
PHP Code:

if( attacker 32 || is_valid_entity(attacker) || pevattackerpev_solid ) == SOLID_TRIGGER )
{
// trigger_hurt or ohter entity what did damage and have solid_trigger
// ps: only costom entities can be that way


#2
Ohter way is to find all trigger_hurts in plugin_init and set they for example pev_iuser to something and then check it.

GuskiS 06-22-2014 14:38

Re: Amplify damage taken from trigger_hurt
 
Why not check inflictors classname? I don't know, but it might work.

.Dare Devil. 06-22-2014 14:44

Re: Amplify damage taken from trigger_hurt
 
Quote:

Originally Posted by GuskiS (Post 2155753)
Why not check inflictors classname? I don't know, but it might work.

Checking the strings in takedamage is bad thing.
You should avoid checking strings on fast called functions.

GuskiS 06-22-2014 16:32

Re: Amplify damage taken from trigger_hurt
 
If he is checking damage >= 100.0 then that string check wouldn't be called that often cause I doubt that there are many things that can cause such damage in one tick/frame :)


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

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