Raised This Month: $57 Target: $400

Help me SDKHook_OnTakeDamage

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Join Date: Jun 2018
Old 06-24-2018 , 22:02   Help me SDKHook_OnTakeDamage
Reply With Quote #1

I have made the menu from propa, I want to add to each prop health, have found here such code at a forum
#include <sdkhooks>

public void OnEntityCreated(int entity, const char[] classname) {
	if(StrContains(classname, "prop_physics", false) >= 0) {
		SDKHook(entity, SDKHook_OnTakeDamage, OnTakeDamage);

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom) {
	if(attacker <= 0 || !IsClientInGame(attacker)) {
		return Plugin_Continue;
	int attackerTeam = GetClientTeam(attacker);
	if(attackerTeam == 2 && damagetype != DMG_SLASH) {
		return Plugin_Handled;
	} else if(attackerTeam == 3) {
		damage = 10.0;
		return Plugin_Changed;
	return Plugin_Continue;
I have put his propa have ceased to receive a loss.
prop_physics - have ceased to break, Help me please.
alex123pavlov is offline
Senior Member
Join Date: Jan 2016
Old 06-25-2018 , 05:37   Re: Help me SDKHook_OnTakeDamage
Reply With Quote #2

PHP Code:
public void OnEntityCreated(int iEntity, const char[] sClassName)
    if (
StrContains(sClassName"prop_physics") != -1) {

void OnEntitySpawned(int iEntity)
    if (
IsValidEntity(iEntity)) {

Make sure to see the prop/entity spawns before hooking damage.

Currently accepting private requests.

Last edited by LenHard; 06-25-2018 at 08:16.
LenHard is offline

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 05:47.

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