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

FF2 related: SDKHooks shows OnTakeDamage's attacker==7012


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 03-15-2016 , 15:33   FF2 related: SDKHooks shows OnTakeDamage's attacker==7012
Reply With Quote #1

It's little strange to see two issues about ff2 in this subforum. The important thing is this subplugin:
Spoiler


I'm hooking every sentry. SDKHook_OnTakeDamagePost is not called for sentries(on my server is not called, why?) and for this reason I use the pre hook. The strage thing is that attacker argument is 7012!!! HOW IS IT POSSIBLE?

Here a picture of the chat messages:
Spoiler
Attached Files
File Type: sp Get Plugin or Get Source (ff2_killicon.sp - 46 views - 10.8 KB)
__________________
My plugins:
*None for now*


Steam:
naydef

Last edited by Naydef; 03-15-2016 at 15:38.
Naydef is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-15-2016 , 15:57   Re: FF2 related: SDKHooks shows OnTakeDamage's attacker==7012
Reply With Quote #2

The callbacks for OnTakeDamage and OnTakeDamagePost are different.

Callbacks for OnTakeDamage:

Code:
	function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype);
	function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3]);
	// DON'T attempt to access 'damagecustom' var if feature status != available
	function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon,
		float damageForce[3], float damagePosition[3], int damagecustom);
Callbacks for OnTakeDamagePost:

Code:
	function void (int victim, int attacker, int inflictor, float damage, int damagetype);
	function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon, const float damageForce[3], const float damagePosition[3]);
	function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon, 
		const float damageForce[3], const float damagePosition[3], int damagecustom);
The main differences are that, other than victim, OnTakeDamage takes references / non-const arrays while OnTakeDamagePost takes values and const arrays.

So, what you're actually seeing is the reference rather than the value of the reference.

Edit: These are in 1.7 syntax.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-15-2016 at 16:00.
Powerlord is offline
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 03-15-2016 , 16:21   Re: FF2 related: SDKHooks shows OnTakeDamage's attacker==7012
Reply With Quote #3

Ok, maybe I have little confused while trying different hook types and callbacks. But there is one little problem. OnTakeDamagePost is not called for sentries. Is this normal?

Edit: Yes, I was really confused. But the question stays. OnTakeDamagePost is not called for sentries. Is this normal?
__________________
My plugins:
*None for now*


Steam:
naydef

Last edited by Naydef; 03-15-2016 at 16:25.
Naydef 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 15:56.


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