Raised This Month: $ Target: $400
 0% 

[HL] Giving Damage To Entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-08-2010 , 02:47   [HL] Giving Damage To Entity
Reply With Quote #1

How can I give a damage to entity (player)?
For example, I need to hit player with 50.0 (float) damage.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-08-2010 , 07:09   Re: [HL] Giving Damage To Entity
Reply With Quote #2

PHP Code:
public your_functionid )
{
    
health get_user_healthid )

    
set_user_healthidhealth 50 )
// requires fun 
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-08-2010 , 09:26   Re: [HL] Giving Damage To Entity
Reply With Quote #3

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.

Last edited by Flipper_SPb; 02-08-2010 at 09:29.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
lazarev
Veteran Member
Join Date: Sep 2008
Old 02-08-2010 , 13:19   Re: [HL] Giving Damage To Entity
Reply With Quote #4

PHP Code:
#include <engine>
fakedamage(idvictim, const szClassname[], Float:takedmgdamagedamagetype); 
example:
PHP Code:
fakedamage(id"hi"1337.0DMG_CRUSH); 
lazarev is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-08-2010 , 13:59   Re: [HL] Giving Damage To Entity
Reply With Quote #5

Спасибо! Thanks a lot!
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-08-2010 , 16:23   Re: [HL] Giving Damage To Entity
Reply With Quote #6

Quote:
Originally Posted by Flipper_SPb View Post
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.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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 07:23.


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