Raised This Month: $ Target: $400
 0% 

Solved [TF2] TF2_SetPlayerClass bug after recent TF2 update


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
heavyisgps
Member
Join Date: Aug 2018
Old 10-26-2021 , 18:33   [TF2] TF2_SetPlayerClass bug after recent TF2 update
Reply With Quote #1

Bug:

When calling the code
PHP Code:
MakeEngineer(client)
{
TF2_SetPlayerClass(clientTFClass_Engineer);
    
TF2_RegeneratePlayer(client);

from another plugin. It doesn't change the class correctly.

Scenario 1:
1. My class is scout
2. I trigger the code from Plugin A
3. Plugin A makes the call from Plugin B
4. Plugin B executes the code snippet above.
5. I am now an Engineer, but with scout weapons, and without a builder and destroyer tool. Not able to build even with build commands.

Scenario 2:
1. My class is scout
2. I trigger the code from Plugin B
3. Plugin B executes the code snippet from above.
4. I am now an Engineer with my current Engineer loadout, I can build and destroy my buildings normally.

This was not an issue previously, and I think the issue first was discovered when the latest TF2 update hit.

The same issue goes for spy as well. Where you can't disguise as you don't have a disguise kit.

If you already are the class you change to, it works normally.

The same thing also happens if you already are a spy, or engineer and switch to another class, then you keep your disguise kit and builder items.
__________________
Creator of the Hi GPS Balance mod for TF2.

www.higps.no

Last edited by heavyisgps; 10-27-2021 at 16:27.
heavyisgps is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-26-2021 , 22:06   Re: [TF2] TF2_SetPlayerClass bug after recent TF2 update
Reply With Quote #2

It would be helpful if you attach your plugin A and plugin B.
PC Gamer is offline
heavyisgps
Member
Join Date: Aug 2018
Old 10-27-2021 , 15:51   Re: [TF2] TF2_SetPlayerClass bug after recent TF2 update
Reply With Quote #3

Quote:
Originally Posted by PC Gamer View Post
It would be helpful if you attach your plugin A and plugin B.
We just made another plugin and confirmed that it does work, it's just our plugin that is a mess

https://github.com/higps/robogithub

The issue is when we call bedane.sp from berobot_handler.sp

https://github.com/higps/robogithub/...andler.sp#L664

MakeUncleDane
https://github.com/higps/robogithub/...bedane.sp#L222

the loadout isn't correctly refreshed, as you keep your previous items. However if we call the same function from within bedane.sp it works normally. It's the same function with the same client being applied.

I guess I have to just revert commits until I can find where it works again.

You're welcome to look at the messy code if you want.

To reproduce:

Compile:
berobot_factory.sp
berobot_handler.sp
berobot_storage.sp
berobot_voicelines.sp
berobot_volunteer.sp

Then bedane.sp and bepaladin.sp.

1. Be scout
2. Use sm_mr "Uncle Dane"
3. You can't build anything, as game still thinks you are scout somehow.
4. Use sm_mr "Mr Paladin"
5. You don't have a sapper in your secondary slot, but whatever secondary your engineer has.
__________________
Creator of the Hi GPS Balance mod for TF2.

www.higps.no
heavyisgps is offline
heavyisgps
Member
Join Date: Aug 2018
Old 10-27-2021 , 16:28   Re: [TF2] TF2_SetPlayerClass bug after recent TF2 update
Reply With Quote #4

Solved, issue was that I changed the logic on when to supercede the regenerate too early, as the logic I used wasn't available until the next frame
__________________
Creator of the Hi GPS Balance mod for TF2.

www.higps.no
heavyisgps is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-27-2021 , 18:10   Re: [TF2] TF2_SetPlayerClass bug after recent TF2 update
Reply With Quote #5

I had a theory on what may be wrong but I couldn't test them due to missing include files in the github repository. My thought was that it might have something to do with the dhook detour on regenerate or timing.

Anyway, I'm glad you solved it!
PC Gamer 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:27.


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