Raised This Month: $114 Target: $400
 28% 

Solved [TF2] Detect when player leaves spawn area


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-05-2019 , 21:43   [TF2] Detect when player leaves spawn area
Reply With Quote #1

Can I detect when a client has left their respawn area (func_respawnroom)? I've been trying to figure out how but I've got nothing so far.

Thanks! -Theon

Last edited by Theon32; 04-09-2019 at 18:19.
Theon32 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-06-2019 , 03:35   Re: [TF2] Detect when player leaves spawn area
Reply With Quote #2

The easiest way would probably be to use HookEntityOutput to hook func_respawnroom's OnEndTouch output.

I'm not sure if the client would be returned as the caller or activator, though.

Edit: I would think the func_respawnroom entity would be the caller and the client the activator.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-06-2019 at 03:37.
Powerlord is offline
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-06-2019 , 09:31   Re: [TF2] Detect when player leaves spawn area
Reply With Quote #3

Thank you very much, but do you think I can add a delay to this? Whenever I respawn it goes off like 10-20 times until it stops.
This is the issue. Read the video description if you wanna know why I am making this plugin. https://youtu.be/wcCDgpDdO4A

Last edited by Theon32; 04-06-2019 at 11:08. Reason: Displays video of what is happening.
Theon32 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 04-07-2019 , 03:34   Re: [TF2] Detect when player leaves spawn area
Reply With Quote #4

Check if the m_iSpawnRoomTouchCount netprop is equal to zero before you attempt to teleport in the output hook, I suppose. Or just do a think hook for that check.

Too lazy to check the map, but I'd guess there's multiple respawn room entities, and when you're respawning / teleporting, it triggers the OnEndTouch output of one of them.
__________________
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)

Last edited by nosoop; 04-07-2019 at 03:35.
nosoop is offline
Theon32
Member
Join Date: Sep 2018
Location: mvm_isolation_rc3
Old 04-08-2019 , 06:49   Re: [TF2] Detect when player leaves spawn area
Reply With Quote #5

I solved it myself by using a 3 second timer as a cooldown and freezing the player during it with SetEntityMoveType. Thanks for all the help!
Theon32 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 23:19.


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