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

[CS:GO] Detect player in Taser's range


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xc_ace
New Member
Join Date: Jun 2020
Old 12-24-2022 , 06:51   [CS:GO] Detect player in Taser's range
Reply With Quote #1

I want to make a plugin to detect whether player is in my range when I using Taser. Is there are any ways to make it come true? (Sorry for my bad english, its not my main language)

Last edited by Xc_ace; 12-24-2022 at 07:05.
Xc_ace is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 12-24-2022 , 13:26   Re: [CS:GO] Detect player in Taser's range
Reply With Quote #2

Yes, something like this is possible with a SourceMod plugin. There are SDKHooks that will allow you to know when a player has the taser equipped; I would try SDKHook_WeaponSwitchPost and you may need to look at the classname of the weapon to see if it's the taser or not.

Once you know the taser is the active weapon then you'll need to script a way to detect whether the enemy player is in range or not. There are several options available there - one would be to loop through all clients and get the distance between the player with the taser and the enemy players and if at least one is within range then provide that indication to the player with the taser. You may also consider using TraceRay to see if you're actively looking at an enemy player and then check if the distance is within a certain amount to that particular enemy player.
__________________
databomb is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-24-2022 , 15:21   Re: [CS:GO] Detect player in Taser's range
Reply With Quote #3

here is something... wierd content
- When ever you hold taser, 1 sec timer will run repeatly.
- Print in chat player count and names what are in range.
- Some wierd angle check, look players front of you 80 degree wide area wher you aim or something like that.
Spoiler
__________________
Do not Private Message @me
Bacardi is offline
Xc_ace
New Member
Join Date: Jun 2020
Old 12-24-2022 , 23:32   Re: [CS:GO] Detect player in Taser's range
Reply With Quote #4

Quote:
Originally Posted by databomb View Post
Yes, something like this is possible with a SourceMod plugin. There are SDKHooks that will allow you to know when a player has the taser equipped; I would try SDKHook_WeaponSwitchPost and you may need to look at the classname of the weapon to see if it's the taser or not.

Once you know the taser is the active weapon then you'll need to script a way to detect whether the enemy player is in range or not. There are several options available there - one would be to loop through all clients and get the distance between the player with the taser and the enemy players and if at least one is within range then provide that indication to the player with the taser. You may also consider using TraceRay to see if you're actively looking at an enemy player and then check if the distance is within a certain amount to that particular enemy player.
Thanks to answer, but I have another question, can I detect the taser's damage to player? as far as I know, the Taser has damage attenuation when player is out-of-range and I don't know how many damage attenuation per hammer units
Xc_ace is offline
Xc_ace
New Member
Join Date: Jun 2020
Old 12-24-2022 , 23:35   Re: [CS:GO] Detect player in Taser's range
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
here is something... wierd content
- When ever you hold taser, 1 sec timer will run repeatly.
- Print in chat player count and names what are in range.
- Some wierd angle check, look players front of you 80 degree wide area wher you aim or something like that.
Spoiler
Thanks your code, it save my lots of time and realized the angles-detect feature, which I didn't think about.
Xc_ace is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 12-25-2022 , 13:02   Re: [CS:GO] Detect player in Taser's range
Reply With Quote #6

Quote:
Originally Posted by Xc_ace View Post
Thanks to answer, but I have another question, can I detect the taser's damage to player? as far as I know, the Taser has damage attenuation when player is out-of-range and I don't know how many damage attenuation per hammer units
Damage can be detected using the player_hurt event. See the details for CS:GO here:
https://wiki.alliedmods.net/Counter-...ts#player_hurt

If you need to modify the taser damage then use SDKHook_OnTakeDamage; for example, use that SDKHook if you want to remove the damage attentuation for the taser and cause it to kill anyone within range.
__________________
databomb 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 18:26.


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