AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   m_hViewModel is nullptr afer updating sourcemod (https://forums.alliedmods.net/showthread.php?t=335169)

kadet.89 11-12-2021 07:05

m_hViewModel is nullptr afer updating sourcemod
 
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?

nosoop 11-13-2021 06:16

Re: m_hViewModel is nullptr afer updating sourcemod
 
Sounds like an unintentional regression from one of the sendprop array changes - can you file an issue and provide sample code?

kadet.89 11-13-2021 12:40

Re: m_hViewModel is nullptr afer updating sourcemod
 
1 Attachment(s)
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

asherkin 11-15-2021 16:36

Re: m_hViewModel is nullptr afer updating sourcemod
 
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.

kadet.89 11-16-2021 12:52

Re: m_hViewModel is nullptr afer updating sourcemod
 
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.


All times are GMT -4. The time now is 05:15.

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