View Single Post
Plugin Info:     Modification:          Category:         
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 07-28-2019 , 10:54   Disconnected players func_tank fix (HLDS-bug crash fix too)
Reply With Quote #1

Recently it has been discovered a crash bug on HLDS related with func_tank entities.
Here it's the issue at official Half-Life Github: https://github.com/ValveSoftware/halflife/issues/2594

The issue is related to player disconnection while using a func_tank entity.

Is this issue affecting me?
Only if your server is using a map that has a func_tank entity.

It's an entity used on too many jailbreak maps.
For example: the six canyons at jb_snow [ Screenshot ] [ Video ]

According to this comment: https://forums.alliedmods.net/showpo...76&postcount=6
It's already fixed at ReGameDLL

What's a func_tank entity?
"It simulates a gun turret that can aim and shoot things." from https://developer.valvesoftware.com/wiki/Func_tank
So, if you have a map in your server with something like this, that entity probably is a func_tank and your server it's affected by the issue.
List of entities affected and fixed by the plugin:
  • func_tank
  • func_tankmortar
  • func_tankrocket
  • func_tanklaser

Steps to reproduce both issues
First, a bug appeared. Steps to reproduce:
  1. Control a func_tank
  2. Disconnect using it
  3. Reconnect
  4. Now, if you look to the entity you have controlled previously, it follows your angles movement with the camera.
    Really a visual bug, because player can't shoot with it unless he will use it again.

Then, players can abuse this bug to cause a server crash.
We will need two different players. Steps to reproduce:
  1. Connect the two players
  2. 1st player use the func_tank
  3. Disconnect while using (1st player)
  4. Reconnect (1st player).
    Note: 1st player will be able to move the angles of the entity without using it (the visual bug mentioned above).
  5. 2nd player use the func_tank.
    Now func_tank attached to 2nd player and 1st can't move the angles of the entity.
  6. 2nd player uses retry command while using func_tank
  7. Finally crash server when player full reconnected

To protect our servers against this bug abuse, I made a plugin to fix the bug while we wait for an official fix by Valve.

Possibly someone can provide a better way to fix this bug.
Any improvement for the plugin will be welcomed.

For developers:
Plugin was tested and working well.

Changelog
Code:
v0.2 (01 june 2020)
It seems using get_pdata_int on client_disconnect sometimes server crashes on mapchange.
- Replaced client_disconnect to fakemeta disconnect forward
- Not reset m_pTank offset (anyways, don't needed?)

v0.1 (28 july 2019) - 305 views
- First release
Attached Files
File Type: sma Get Plugin or Get Source (func_tank_fix_disconnect.sma - 292 views - 1.4 KB)

Last edited by baneado; 08-11-2021 at 07:03.
baneado is offline