Raised This Month: $ Target: $400
 0% 

Custom weapon damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gold Fish
Senior Member
Join Date: Mar 2020
Old 04-08-2020 , 15:09   Custom weapon damage
Reply With Quote #1

Hello, I put the hook on the damage from the weapon through
HTML Code:
SDKHook(entity, SDKHook_OnTakeDamage, OnTakeDamage);,
I change the damage, but then I check it after injuring the infected ones and I find that the damage additionally increases or decreases depending on the hit box, how will the damage change me so that it does not change at all and is exactly the same as I configured in the plugin?

sorry for my English

game L4D2

Last edited by Gold Fish; 04-08-2020 at 15:12.
Gold Fish is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-08-2020 , 15:14   Re: Custom weapon damage
Reply With Quote #2

Show your code... please.
Bacardi is offline
Gold Fish
Senior Member
Join Date: Mar 2020
Old 04-08-2020 , 16:11   Re: Custom weapon damage
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Show your code... please.
HTML Code:
public void OnClientPutInServer(int client)
{
	SDKHook(client, SDKHook_TraceAttack, OnTakeDamage);
}
public void  OnClientDisconnect(int client)
{
	SDKUnhook(client, SDKHook_TraceAttack, OnTakeDamage);
}

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{

	if (damage <= 0.0 || victim < 1 || victim > 2048 || attacker < 1 || attacker > MaxClients)
		return Plugin_Continue;

	damage = 100.0;
	return Plugin_Changed;
}

This is the simplest example, even after such a change in damage, when hit in the leg, less than 100 will be taken away, and when hit in the head twice as much

Last edited by Gold Fish; 04-08-2020 at 16:13.
Gold Fish 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 23:13.


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