Raised This Month: $32 Target: $400
 8% 

Damage Tracker Plugin.. need what the player got hit by..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
12Toastie
Junior Member
Join Date: Nov 2014
Old 03-17-2022 , 02:19   Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #1

so I am using this

Code:
public CBasePlayer_TakeDamage_Post(id, iInflictor, iAttacker, Float:flDamage, bitsDamageType){
	
	new weapon[40] 
	get_weaponname(get_user_weapon(iAttacker), weapon, sizeof(weapon) - 1)

	
	
	client_print(0, print_chat, "%s", weapon);
	
	
}
What i want to get is what weapon the player got hit by.. for example in TFC if you shoot a rocket.. switch to shotty, and the rocket hits after switching to shotty, it will register as the player getting hit by tf_weapon_supershotgun (the weapon the attacker is holding). I want it to register that they got hit by a rocket. Is there a way to do this? or another function that can accomplish all this?

Last edited by 12Toastie; 03-19-2022 at 20:58.
12Toastie is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-17-2022 , 06:07   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #2

Do you have the rocket plugin code?

Check if the inflictor is not a player then the damage is done by a third world object.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-17-2022 at 06:08.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
12Toastie
Junior Member
Join Date: Nov 2014
Old 03-17-2022 , 20:39   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #3

thank you for your reply! i do not have any type of plugin for rockets or any source code pertaining to rockets

i checked iInflictor and bitDamageType with %u and %d they return the same numbers for blast damage for rockets and grenades as well as pipebombs..

I tried using get_user_name for iInflictor just to see what it spits out.. gives me the hostname

Last edited by 12Toastie; 03-17-2022 at 20:40.
12Toastie is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-18-2022 , 01:21   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #4

Inflictor param is the entity which does the damage ( usually a weapon ) attacker and id are real player indexes. Param id is the victim's index.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
12Toastie
Junior Member
Join Date: Nov 2014
Old 03-19-2022 , 00:26   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #5

Quote:
Originally Posted by Shadows Adi View Post
Inflictor param is the entity which does the damage ( usually a weapon ) attacker and id are real player indexes. Param id is the victim's index.
cool that was my suspicion.. but idk how to get the weapon name


new weaponName[40]
get_weaponname(iInflictor, weaponName, sizeof(weaponName) -1)

and i get this error..

L 03/18/2022 - 211:10: [AMXX] Run time error 10: native error (native "get_weaponname")
L 03/18/2022 - 211:10: [AMXX] [0] damagerecorder2.sma::CBasePlayer_TakeDamage_P ost (line 54)

Last edited by 12Toastie; 03-19-2022 at 00:32.
12Toastie is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-19-2022 , 04:31   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #6

Quote:
Originally Posted by 12Toastie View Post
cool that was my suspicion.. but idk how to get the weapon name


new weaponName[40]
get_weaponname(iInflictor, weaponName, sizeof(weaponName) -1)

and i get this error..

L 03/18/2022 - 211:10: [AMXX] Run time error 10: native error (native "get_weaponname")
L 03/18/2022 - 211:10: [AMXX] [0] damagerecorder2.sma::CBasePlayer_TakeDamage_P ost (line 54)
Check if the inflictor is actually a weapon. As I said "infilctor is usually a weapon"

PHP Code:
if(CSW_P228 <= inflictor <= CSW_P90)
{
    
// execute

__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-19-2022 , 08:09   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #7

Quote:
Originally Posted by Shadows Adi View Post
Check if the inflictor is actually a weapon. As I said "infilctor is usually a weapon"

PHP Code:
if(CSW_P228 <= inflictor <= CSW_P90)
{
    
// execute

The inflictor is either a player index or an entity index but never csw id. If its an entity index not a player index, use pev_classname
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-19-2022 at 08:10.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-19-2022 , 13:47   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
The inflictor is either a player index or an entity index but never csw id. If its an entity index not a player index, use pev_classname
Ok, you're right, just tested it.

In order to detect with which weapon got victim hit, get attacker's weapon ID and convert it to weapon's name:

PHP Code:
new szWeapon[32]
get_weaponname(get_user_weapon(iAttacker), szWeaponcharsmax(szWeapon)) 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 03-19-2022 at 14:00.
Shadows Adi is offline
12Toastie
Junior Member
Join Date: Nov 2014
Old 03-19-2022 , 20:52   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #9

Quote:
Originally Posted by Shadows Adi View Post
Ok, you're right, just tested it.

In order to detect with which weapon got victim hit, get attacker's weapon ID and convert it to weapon's name:

PHP Code:
new szWeapon[32]
get_weaponname(get_user_weapon(iAttacker), szWeaponcharsmax(szWeapon)) 
This will work great with hitscan weapons, but not projectiles like a rocket or pipebomb in TFC.

I do really appreciate the responses guys

edit: returned 0

Last edited by 12Toastie; 03-19-2022 at 20:57.
12Toastie is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-20-2022 , 02:06   Re: Damage Tracker Plugin.. need what the player got hit by..
Reply With Quote #10

Does it returns any index at all?
Code:
get_user_weapon()
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Reply


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


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