Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Viewmodel Submodel Support #60

Open
kovakovi2000 opened this issue Feb 14, 2025 · 1 comment
Open

Viewmodel Submodel Support #60

kovakovi2000 opened this issue Feb 14, 2025 · 1 comment

Comments

@kovakovi2000
Copy link

There is a workaround from the server side to display submodels in the viewmodel, but it is flickery, or you have to suspend many other events, which causes latency in animations, etc.

It would be ideal if the client could retain the assigned submodel instead of resetting it to 0 for submodels.

We use submodels on our server, but for foreign play, any solution introduces problems due to latency. A client-side fix could help mitigate these issues.

For reference:
TheDoctor0/CSGOMod
ShadowsAdi/CSGORemake
Here’s the relevant code snippet:

//alive
set_entvar(id, var_weaponanim, iAnim);
set_entvar(iWeapon, var_body, iBody);
rg_weapon_send_animation(iPlayer, iAnim);

//observer
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, i);
write_byte(iAnim); // animation index
write_byte(iBody); // submodel index
message_end();

It would be useful to have a nextclient-specific message from the server to a client to set only the submodel, rather than updating it manually with every animation. Currently, this update needs to be sent to the player and all observers on each weapon deploy, reload, shot, etc., which is inefficient.

A simpler solution could be ensuring that when iBody is set like this:

set_entvar(iWeapon, var_body, iBody);

it does not reset to 0 on the next animation. This way, we wouldn’t have to force cl_lw 0 on the client to suspend event prediction.

This workaround initially aims to bypass the 512-model limit, but outright removing that limit would create a significant disparity in accessibility between this and other clients.

Please keep in mind that I am not an expert on this topic, if I’ve misunderstood anything, I’d be happy to hear corrections! I'm also unsure how much of this issue lies on the server side versus the client side.

@Polarhigh
Copy link
Contributor

You can use the NextClientServerApi server module to set the body for the viewmodel. The body will not be reset until you reset it explicitly.

Here's a brief example https://github.com/CS-NextClient/NextClientServerApi/blob/main/amxx_test/addons/amxmodx/scripting/test_nextclient_api.sma#L378

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants