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

Solved Shot is NOT registering when quickly switching weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 09-21-2017 , 16:40   Shot is NOT registering when quickly switching weapons
Reply With Quote #1

Hi,

I have a problem with a Counter-Strike 1.6 server.

Steps to reproduce on the server:
  1. Fire the AWP or Scout
  2. Press Q quickly to switch to the previous weapon
  3. Press Q again to switch back to the AWP/Scout

Actual Result:
The shot is not registered on the server. No ammo fired.
EDIT: The shooting sound and animation is played on the client side, but no actual bullet is fired.

Client/Server info:
  • The client ping is well under 20 ms, has stable 100 FPS
  • No packet loss or choke (according to net_graph)
  • Server is running at 800-900 "FPS" (according to rcon stats)
  • Server network connection bandwidth is 1 Gbps
  • HLDS is using 10-20% CPU, 15-20% RAM (no other demanding processes are running)

I've tried running the server on lower (100) sys_ticrate with the same results.

What could be the problem in this case?

Last edited by felhasznalo; 05-01-2019 at 08:28. Reason: marked as solved, client side bug
felhasznalo is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-21-2017 , 17:07   Re: Shot is registering when quickly switching weapons
Reply With Quote #2

It is ok.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 09-22-2017 , 03:27   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #3

Please see the edit.
felhasznalo is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-22-2017 , 14:48   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #4

It is ok, because it is client-side prediction bug. It always was there. So, it is bugged on any server.
There are several ways to make bind for this:
Code:
bind v "+attack;lastinv;lastinv;wait;-attack"
Or:
Code:
bind v "lastinv;+attack;lastinv;wait;-attack"
Or:
Code:
bind v "lastinv;lastinv;+attack;wait;-attack"
It is bugged because the client knows nothing about lastinv, he just sends it to the server. The lastinv command will always be executed first on the server-side, because states of IN_* buttons are always at the end of the network packet from the client. (packet data consists of two parts: reliable and unreliable, unreliable data always goes after reliable, client commands that are forwarded to the server, like the dlfile, are located in reliable data, states of buttons, like IN_ATTACK, are located in clc_move, which is in unreliable data)
It can be "fixed" on the server-side by reordering the packet data (so, shot will be registered).
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 09-22-2017 , 15:39   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #5

Is there a plugin/module/proxy/firewall rule to edit these packets?

Or is there any documentation for the packet format?
felhasznalo is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-22-2017 , 16:00   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #6

You can try to change this behaviour in ReHLDS.
I have made test code in sv_user.cpp:
Code:
void SV_ParseStringCommand(client_t *pSenderClient)
->
Code:
std::vector<std::function<void()>> g_delayedCommands; void SV_ParseStringCommand(client_t *pSenderClient)

Code:
        Cmd_TokenizeString(s);         gEntityInterface.pfnClientCommand(sv_player);
->
Code:
        g_delayedCommands.emplace_back([s = std::string{s}] {             Cmd_TokenizeString((char*)s.c_str());             gEntityInterface.pfnClientCommand(sv_player);         });

Code:
        if (c == -1)             return;
->
Code:
        if (c == -1) {             for (auto&& cmd : g_delayedCommands) {                 std::move(cmd)();             }             g_delayedCommands.clear();             return;         }
This works for me, but sometimes not, because lastinv command and button states can be in different packets.
__________________

Last edited by PRoSToTeM@; 09-22-2017 at 16:11.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 09-22-2017 , 17:06   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #7

Why is this more noticeable on some servers?

I've played on many servers which didn't have this problem.
felhasznalo is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-22-2017 , 17:21   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #8

@felhasznalo maybe these servers have low sv_maxupdaterate.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 09-23-2017 , 04:20   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #9

Can't we add a few packet delay to the weapon change commands?
felhasznalo is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 09-25-2017 , 08:50   Re: Shot is NOT registering when quickly switching weapons
Reply With Quote #10

Quote:
Originally Posted by felhasznalo View Post
Can't we add a few packet delay to the weapon change commands?
It's a client side bug. Forget it.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
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 16:26.


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