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

Solved [TF2] Best way to detect whether player is invulnerable-ubered?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 10-29-2019 , 08:53   [TF2] Best way to detect whether player is invulnerable-ubered?
Reply With Quote #1

What's the best way to detect whether the player is ubered?

I know it could be done by manually checking the conditions, but i'm wondering if there's a general way of just finding out if the player is ubered and invulnerable.
I checked through the netprops + datamaps but there didn't seem to be anything resembling m_bUberInvuln or something like that.
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 10-29-2019 at 20:22.
Shadowysn is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-29-2019 , 09:16   Re: [TF2] Best way to detect whether player is invulnerable-ubered?
Reply With Quote #2

The conditions are a netprop, so you can use TF2_IsPlayerInCondition(client, TFCond_Ubercharged).
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 10-29-2019 , 09:28   Re: [TF2] Best way to detect whether player is invulnerable-ubered?
Reply With Quote #3

Quote:
Originally Posted by DJ Tsunami View Post
The conditions are a netprop, so you can use TF2_IsPlayerInCondition(client, TFCond_Ubercharged).
I was just asking whether there was a way to generally detect Uber-invuln without conditions, because there's other uber-invuln effects that aren't TFCond_Ubercharged and don't get counted as it.
(Like the canteen Uber buff, for example.)
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4
Shadowysn is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-29-2019 , 11:11   Re: [TF2] Best way to detect whether player is invulnerable-ubered?
Reply With Quote #4

For checking ubercharge: You could check the condition's inflictor with low-level memory reads, but that just narrows the effect down to a client. I have accessors for those, but they're not all that safe -- probably should get it set up as a proper library at some point.

A pretty basic way to check would be to use Pelipoika's GetHealerByIndex function stock to iterate over a target's healers, then check if they have the correct medigun out with charge currently being drained.

----

For checking invulnerability: TF2 itself implements CTFPlayerShared::IsInvulnerable(), and all it does is check if the player has TF_COND_INVULNERABLE, TF_COND_INVULNERABLE_USER_BUFF, TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED, or TF_COND_INVULNERABLE_CARD_EFFECT conditions set.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop 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 18:26.


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