View Single Post
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-02-2019 , 16:26   Re: [L4D/L4D2]ThirdPersonShoulder_Detect(1.4 - 18/7/2017)
Reply With Quote #10

Quote:
Originally Posted by Lux View Post
... so querying the client convar c_thirdpersonshoulder only happens once not multiple at once by otherplugins, just by using a simple forward.
That is not correct at all.
Otherplugins, using your plugin's forward, never query for that convar.
And vice versa, your plugin query for that convar multiple times (once each 0.25 sec.).

Also, I noticed several bugs when testing and when observing the source code.
1) I don't see a description of your forward meaning. However "TP_OnThirdPersonChanged" - I think that should mean - call forward only once as soon as person view mode is changed.
However, it is called infinite times for me (see screenshot) - L4d1. Test plugin:

Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

public void TP_OnThirdPersonChanged(int iClient, bool bIsThirdPerson)
{
	PrintToChat(iClient, "3rd person is changed to: %b", bIsThirdPerson);
}
EDIT. Ok, I found description of forward: "Forwards the varable of c_thirdpersonshoulder client convar".
However, in that case, the name of the forward does not match the meaning. Why not make that forward do exactly how it is named, call the forward only once when person view mode is really changed instead of spamming.

2) You are creating forward call every time QueryClientConVarCallback of "c_thirdpersonshoulder" is raised. It's incorrect. Because if you set third person view, next exit the server, next enter the server again, "c_thirdpersonshoulder" will be initially == 1, but player is in 1st person mode! As soon as I use command "thirdpersonshoulder", "c_thirdpersonshoulder" is changed to "0", but real person view is not changed and at the same time according your logic new forward will be created when it shouldn't. I see you are using some fix, but it is intended for "bIsThirdPerson" value correction only.
Attached Images
File Type: jpg notify.jpg (36.7 KB, 921 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 03-02-2019 at 16:35.
Dragokas is offline