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

m_hViewModel is nullptr afer updating sourcemod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 11-12-2021 , 07:05   m_hViewModel is nullptr afer updating sourcemod
Reply With Quote #1

I updated sourcemod on my CS:GO server to version 1.11.0.6800 and all my plugins, which use m_hViewModel stoped working.
I digged into it and found out that after updating the sourcemod m_hViewModel is always nullptr for all players. I rolled back to 1.11.0.6603 and the bug has gone.

I'd like to keep on using the newer verison of sourcemod, what can I use instead of m_hViewModel to identify the view model indices?

Last edited by kadet.89; 11-12-2021 at 07:06.
kadet.89 is offline
Send a message via Skype™ to kadet.89
nosoop
Veteran Member
Join Date: Aug 2014
Old 11-13-2021 , 06:16   Re: m_hViewModel is nullptr afer updating sourcemod
Reply With Quote #2

Sounds like an unintentional regression from one of the sendprop array changes - can you file an issue and provide sample code?
__________________
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; 11-13-2021 at 06:22.
nosoop is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 11-13-2021 , 12:40   Re: m_hViewModel is nullptr afer updating sourcemod
Reply With Quote #3

I retrieve m_hViewModel via an extension.
If I do it in an smx plugin this way:
PHP Code:
int viewModel GetEntPropEnt(clientProp_Send"m_hViewModel"); 
It works and returns correct index,
But in the extension I do it this way:
PHP Code:
unsigned int offset;
sm_sendprop_info_t info
if(gamehelpers->FindSendPropInfo("CCSPlayer""m_hViewModel", &info))
{
    
offset info.actual_offset;

And the returned offset is 0. (In 1.10 it prints correct offset: "InitProp m_hViewModel, 4056")
Strange thing is that the offsets are correct for all the other properties which I retrieve. Looks like FindSendPropInfo was partially broken in 1.11.

Creating a C++ reproducible example is not a trivial thing, I might find some time in future, for now I see the only way to avoid this problem is downgrading to 1.10


In netprops m_hViewModel is defined two times, it might be the reason why FindSendPropInfo can't get the offset for it.
https://gist.github.com/saul/766b8f8...553cd708db6338
Attached Files
File Type: txt offsets.txt (3.1 KB, 36 views)

Last edited by kadet.89; 11-13-2021 at 12:49.
kadet.89 is offline
Send a message via Skype™ to kadet.89
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-15-2021 , 16:36   Re: m_hViewModel is nullptr afer updating sourcemod
Reply With Quote #4

1.11 has gained proper support for legacy array props. You need to get the array contents prop and add its offset, as FindSendPropInfo now gives you the array wrapper instead. See the changes in https://github.com/alliedmodders/sourcemod/pull/1550 - we might be able to fiddle the C++ API to work if you do open an issue though.
__________________
asherkin is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 11-16-2021 , 12:52   Re: m_hViewModel is nullptr afer updating sourcemod
Reply With Quote #5

asherkin, Thanks, I checked the code and see that some adjustment is to be made to get correct offsets, so technically the issue is on my side.
kadet.89 is offline
Send a message via Skype™ to kadet.89
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 13:51.


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