Raised This Month: $ Target: $400
 0% 

Why doesn't player take damage with knife?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VJScope
Senior Member
Join Date: Jul 2012
Location: Finland
Old 06-10-2013 , 07:07   Why doesn't player take damage with knife?
Reply With Quote #1

Code:
#include <sdkhooks>
#include <sdktools>

public OnPluginStart()
{
	for(new i = 1; i <= MaxClients; i++)
	{
		if(IsClientInGame(i))
			OnClientPutInServer(i);
	}
}

public OnClientPutInServer(client)
{
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
	if(0 < attacker <= MaxClients)
	{
		new ent = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon");
		if(ent > MaxClients)
		{
			new String:clsname[15];
			GetEntityClassname(ent, clsname, sizeof(clsname));
			if(StrEqual(clsname[7], "knife"))
			{
				damageForce[0] *= 1.5;
				damageForce[1] *= 1.5;
				//damageForce[2] /= 500.0;
				damageForce[2] = 300.0;
				//PrintToServer("damageForce %0.0f %0.0f %0.0f", damageForce[0], damageForce[1], damageForce[2]);
				TeleportEntity(victim, NULL_VECTOR, NULL_VECTOR, damageForce);
				return Plugin_Handled;
			}
		}
	}

	return Plugin_Continue;
}
Players don't take damage by knife when this plugin is on. Why?
__________________
Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.

Last edited by VJScope; 06-10-2013 at 07:07.
VJScope is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-10-2013 , 07:35   Re: Why doesn't player take damage with knife?
Reply With Quote #2

Code:
return Plugin_Handled;
Damage is blocked.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 06-10-2013 , 08:31   Re: Why doesn't player take damage with knife?
Reply With Quote #3

You are looking for plugin changed :/
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-10-2013 , 12:54   Re: Why doesn't player take damage with knife?
Reply With Quote #4

Maybe try to explain what exactly you are expecting from the code lines, and what exactly doesn't work.
eg.: Why should TeleportEntity deal damage ?
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 06-10-2013 , 14:36   Re: Why doesn't player take damage with knife?
Reply With Quote #5

looks like hes trying to create knockback
blodia is offline
VJScope
Senior Member
Join Date: Jul 2012
Location: Finland
Old 06-11-2013 , 17:05   Re: Why doesn't player take damage with knife?
Reply With Quote #6

berni, you already fixed the plugin. Thanks for your help!
__________________
Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
VJScope 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 05:04.


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