ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.71k stars 626 forks source link

[BUG] Regain all weapons via "fullupdate" command #271

Closed MPNumB closed 11 years ago

MPNumB commented 11 years ago

At some maps like awp_india, cs_deagle5, scoutzknivez, ect... you spawn with specific set of weapons. After some time you can run out of bullets, and should use knife or find other weapons.

But not many know that you can type in console "fullupdate" command, and if server doesn't block it, than your entire weapon-list is refreshed. You are striped from all the weapons, and then all weapons are re-given to you with predefined ammo, as if you just respawned.

Note: I do not recommend blocking "fullupdate" command, since it is needed for demo recording. Just fix the weapon re-give.

xPaw commented 11 years ago

The problem is that game_playerspawn target is fired at the wrong place, it should be fired on player spawn, not HUD init. Here's the part of code in HLSDK that is responsible for this.

void CBasePlayer :: UpdateClientData( void )
{
    if (m_fInitHUD)
    {
        // [ ... ]

        FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 );

        // [ ... ]
    }

    // [ ... ]
}
hotactions commented 11 years ago

i confirm it, sometimes you can even crash server.

alfred-valve commented 11 years ago

Changing this will break demos (because they will no longer get that event) and may have other unintended side effects.

MPNumB commented 11 years ago

Well, just made an amxmodx plugin what fixes this glitch. All works fine - no problems. http://forums.alliedmods.net/showthread.php?t=209418

xPaw commented 11 years ago

@alfred-valve I think you are wrong. FireTargets sends no information to client, therefore it can't break demos. This function just finds all entities with same targetname and activates them. I still believe this FireTargets line should be moved to player's Spawn function.

In fact, plugin above proves that blocking this behavior doesn't break demos.