AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting the same TraceLine twice (https://forums.alliedmods.net/showthread.php?t=76997)

Dores 09-03-2008 11:28

Setting the same TraceLine twice
 
Can I do this:
PHP Code:


set_tr2
(traceTR_pHitid);
set_tr2(traceTR_pHitent); 

?

Exolent[jNr] 09-03-2008 11:33

Re: Setting the same TraceLine twice
 
What are you trying to accomplish?

Dores 09-03-2008 13:24

Re: Setting the same TraceLine twice
 
Well, I want that when a player attacks an enemy and hit him, it will also damage the nearest player to the enemy (if the nearest player is an enemy as well). So I wanted to make sure it will hit the original target for 100%, along with the nearest enemy to the victim.

Or maybe I can simply get the damage of the attack from Ham_TakeDamage and use: set_user_health(ent, get_user_health(ent) - damage)?

Exolent[jNr] 09-03-2008 15:31

Re: Setting the same TraceLine twice
 
Quote:

Originally Posted by dor123 (Post 680609)
Or maybe I can simply get the damage of the attack from Ham_TakeDamage and use: set_user_health(ent, get_user_health(ent) - damage)?

That would be easiest.

Alka 09-03-2008 17:30

Re: Setting the same TraceLine twice
 
Or use ExecuteHam(Ham_TakeDamage,...) to avoid health bug.

Dores 09-03-2008 17:33

Re: Setting the same TraceLine twice
 
Quote:

Originally Posted by Alka (Post 680750)
Or use ExecuteHam(Ham_TakeDamage,...) to avoid health bug.

Ok i'll try them both, thanks guys :D

EDIT: Can I use ExecuteHam(Ham_TakeDamage,...) on more than one entity? For example using it twice to decrease health for 2 entities?
And where and how am I suppose to use it?
I don't know much about the HamSandwich module...:oops:

Alka 09-03-2008 17:52

Re: Setting the same TraceLine twice
 
Code:

Ham_TakeDamage
  * Execute params: ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);

yes, of course you can, you must get the index of entity and execute the func.

Dores 09-03-2008 17:59

Re: Setting the same TraceLine twice
 
this = victim?
and who is the idinflictor? what is the difference between inflictor and attacker?
and can I use this message/event in any function I want?

Sorry for all the questions, I'm still learning... Gladly from you and Exolent. :D

danielkza 09-03-2008 18:03

Re: Setting the same TraceLine twice
 
Quote:

Originally Posted by dor123 (Post 680767)
this = victim?
and who is the idinflictor? what is the difference between inflictor and attacker?
and can I use this message/event in any function I want?

Sorry for all the questions, I'm still learning... Gladly from you and Exolent. :D

Inflictor = Entity used to do the damage. Normally the index of the player weapons. Attacker is the player wielding the weapon.

Exolent[jNr] 09-03-2008 18:06

Re: Setting the same TraceLine twice
 
this = entity being damaged
idinflictor = entity causing damage
attacker = entity causing idinflictor to cause damage

------------------

Example:
Player2 shoots Player1:

this = Player1
idinflictor = Player2
attacker = Player2

Note: With guns, the inflictor and attacker are the same. But with grenades, the inflictor is the grenade entity index.

------------------

Example:
Player1 falls from a high spot and gets hurt

this = Player1
idinflictor = Player1 (or 0, cant remember)
attacker = Player1 (or 0, cant remember)

Note: To check if player fell, use the 5th parameter "damagebits":
Code:
public EventTakeDamage(client, inflictor, attacker, Float:damage, damagebits) {     if( damagebits & DMG_FALL )     {         // player fell     } }


EDIT:
Quote:

Originally Posted by danielkza (Post 680769)
Inflictor = Entity used to do the damage. Normally the index of the player weapons. Attacker is the player wielding the weapon.

It is never the index of a weapon unless it is a grenade.


All times are GMT -4. The time now is 03:10.

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