AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HL] Giving Damage To Entity (https://forums.alliedmods.net/showthread.php?t=118139)

Flipper_SPb 02-08-2010 02:47

[HL] Giving Damage To Entity
 
How can I give a damage to entity (player)?
For example, I need to hit player with 50.0 (float) damage.

wrecked_ 02-08-2010 07:09

Re: [HL] Giving Damage To Entity
 
PHP Code:

public your_functionid )
{
    
health get_user_healthid )

    
set_user_healthidhealth 50 )
// requires fun 


Flipper_SPb 02-08-2010 09:26

Re: [HL] Giving Damage To Entity
 
If player has armor (Half-Life), it is not correct. Damage will affect on health and armor during the game. Example:
player has 100 HP/100 AP. After taking 50.0 damage he will be 90 HP/ 80 AP

I can calculate the loss of armor & health separately and use set_pev(player, pev_armorvalue, AP) and set_pev(player, pev_health, HP) to set it. But may be it's not best way.

lazarev 02-08-2010 13:19

Re: [HL] Giving Damage To Entity
 
PHP Code:

#include <engine>
fakedamage(idvictim, const szClassname[], Float:takedmgdamagedamagetype); 

example:
PHP Code:

fakedamage(id"hi"1337.0DMG_CRUSH); 


Flipper_SPb 02-08-2010 13:59

Re: [HL] Giving Damage To Entity
 
Спасибо! Thanks a lot!

wrecked_ 02-08-2010 16:23

Re: [HL] Giving Damage To Entity
 
Quote:

Originally Posted by Flipper_SPb (Post 1082635)
If player has armor (Half-Life), it is not correct. Damage will affect on health and armor during the game. Example:
player has 100 HP/100 AP. After taking 50.0 damage he will be 90 HP/ 80 AP

I can calculate the loss of armor & health separately and use set_pev(player, pev_armorvalue, AP) and set_pev(player, pev_health, HP) to set it. But may be it's not best way.

My bad, didn't see the [HL] in the title.


All times are GMT -4. The time now is 07:23.

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