[CODE] Fix crowbar and Glock Created 13 years ago2011-01-23 18:15:18 UTC by The Mad Carrot The Mad Carrot

Created 13 years ago2011-01-23 18:15:18 UTC by The Mad Carrot The Mad Carrot

Posted 13 years ago2011-01-23 18:18:08 UTC Post #289581
Does anyone know (looking at Potatis, 2muchvideogames, ChickenFist and anyone else who know their way in the HL SDK) how to fix the crowbar and Glock?

When you try to gib a dead body, the crowbar goes apeshit. I actually like this glitch because you can easily gib a body if it's blocking a door or something. Still, i'd like this fixed.

And the Glock keeps reloading even if its clip is full (17 rounds).
Posted 13 years ago2011-01-23 18:20:57 UTC Post #289582
I think you're using an older sdk but the glock problem is easily fixable, look at the reload part of the glock code, I think the number that specifies whether to allow reload or not is supposed to be 17, but in the older code it's some other number (like 18 or 20 or something). Just change it back to 17.
Posted 13 years ago2011-01-23 18:26:19 UTC Post #289584
Im using the 2.3 SDK. It's the latest, right?

As for the Reload code, it's already at 17:
void CGlock::Reload( void )
{
	if ( m_pPlayer->ammo_9mm <= 0 )
		 return;

	int iResult;

	if (m_iClip == 0)
		iResult = DefaultReload( 17, GLOCK_RELOAD, 1.5 );
	else
		iResult = DefaultReload( 17, GLOCK_RELOAD_NOT_EMPTY, 1.5 );

	if (iResult)
	{
		m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
	}
}
Yet it still reloads on full clip.
Posted 13 years ago2011-01-23 18:34:57 UTC Post #289585
Don't know much about the topic but the original code was set for the Glock to have 18 rounds per clip so maybe if you set it back to that it would fix it, unless of course you don't want to make that change.
Posted 13 years ago2011-01-23 18:41:54 UTC Post #289586
Oh lol, it does work. I was playing a old mod wich dll was probably build from an older SDK version.
So yeah, no fix needed.

But the crowbar glitch is still there.
Posted 13 years ago2011-01-23 19:08:55 UTC Post #289593
Fully patched\updated game and source code?
Crollo CrolloTrollo
Posted 13 years ago2011-01-23 19:26:42 UTC Post #289598
I don't know, 2.3 is the latest version and i've never heard of patches/updates for the SDK.

Im using Steam HL so yeah, it's the latest version as well.
Posted 13 years ago2011-01-25 15:42:25 UTC Post #289636
2.3-p3 is the latest almost-official version.
To fix the crowbar glitch, try replacing
[quote] m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME;
			if ( !pEntity->IsAlive() )
				  return TRUE;
			else
				  flVol = 0.1;[/quote]
with
[quote] m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME;
			if(!pEntity->IsAlive()) {
				m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
				  return TRUE;
			} else {
				  flVol = 0.1;
			}[/quote]
I haven't tested this, but I believe it will fix the glitch.
Oskar Potatis Oskar Potatis🦔
Posted 13 years ago2011-01-25 16:02:03 UTC Post #289637
Thanks, that did it!

+5 crowbars for you.
Posted 13 years ago2011-01-30 01:13:06 UTC Post #289771
what's that do? manually set the attack delay?
Tetsu0 Tetsu0Positive Chaos
Posted 13 years ago2011-01-30 01:43:12 UTC Post #289773
Completely eyballing it with my noob c++ eye, I'd say it adds a delay specifically whenever you hit a body.
Crollo CrolloTrollo
Posted 13 years ago2011-02-04 19:53:07 UTC Post #290059
Yeah, I fixed both those things in the Static Friction editor. I don't remember how I did the crowbar (and I've since lost the code) but to fix the Glock you should just be able to add this after:

if ( m_pPlayer->ammo_9mm <= 0 )
return;

if (m_iClip == 17)
return;
Posted 13 years ago2011-02-04 20:14:36 UTC Post #290061
It was already fixed in the code, but the glitch still exists in the default hl.dll file.
You must be logged in to post a response.