Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO] OnTakeDamage headshot damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-19-2018 , 08:55   [CS:GO] OnTakeDamage headshot damage
Reply With Quote #1

I want save amount of damage and block it
Code:
public Action OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
	if(IsValidClient(attacker)) 
	{
		DMG[victim] += damage;
		PrintToChatAll("%f",damage);
	}	
	return Plugin_Handled;
}
But when i shoot head with helm damage ~ 120 like without it
how can i save real damage and block it
Maybe use another function?

Last edited by Indarello; 08-21-2018 at 11:34.
Indarello is offline
Rachnus
Senior Member
Join Date: Jun 2016
Location: Funland
Old 08-19-2018 , 09:01   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #2

hook player_hurt event and
PHP Code:
int dmg event.GetInt("dmg_health"
__________________
Github: https://github.com/jimppan
Steam: http://steamcommunity.com/id/jimppan
_____________________________________________ _________
Taking private requests

Last edited by Rachnus; 08-19-2018 at 09:01.
Rachnus is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-19-2018 , 09:18   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #3

Code:
damage = 0.0;
return Plugin_Changed;
to block damage
__________________
8guawong is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-19-2018 , 09:19   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #4

Quote:
Originally Posted by Rachnus View Post
hook player_hurt event and
PHP Code:
int dmg event.GetInt("dmg_health"
I can block death on player_hurt?
HMM... i can give 5000 hp and collect damage on player_hurt

Last edited by Indarello; 08-19-2018 at 09:25.
Indarello is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-19-2018 , 19:23   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #5

Using events is to late.

Here is an example from Killshot Reverse.
__________________
Neuro Toxin is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-20-2018 , 00:53   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #6

Quote:
Originally Posted by Neuro Toxin View Post
Using events is to late.

Here is an example from Killshot Reverse.
Sorry, I cant find how to save real damage in helmet in this example
Indarello is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-20-2018 , 03:39   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #7

Try comparing the damage value in the OnTakeDamage hook to the value in the OnTakeDamageAlive hook.
__________________
Peace-Maker is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-20-2018 , 19:18   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #8

Quote:
Originally Posted by Peace-Maker View Post
Try comparing the damage value in the OnTakeDamage hook to the value in the OnTakeDamageAlive hook.
This is the key to getting accurate damage values.
__________________
Neuro Toxin is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 08-21-2018 , 11:33   Re: [CS:GO] OnTakeDamage headshot damage
Reply With Quote #9

Quote:
Originally Posted by Neuro Toxin View Post
This is the key to getting accurate damage values.
Yes this works good,
there is more difference between this functions? Cause i cant find info in include file
thanks

Last edited by Indarello; 08-22-2018 at 13:22.
Indarello is offline
Reply



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 16:49.


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