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

Preventing a player from reloading?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 01-02-2006 , 13:55   Preventing a player from reloading?
Reply With Quote #1

Any ideas? Right now I'm hooking GameFrame PRE, and checking if they have pressed the button with CBP->m_afButtonPressed. If they are pressing reload, I set the buttonpressed to 0.. This doesn't work there, the game still gets the reload event.


Suggestions?
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 01-02-2006 , 14:03  
Reply With Quote #2

Not sure why you are trying to do this, but maybe you could set their spare ammo to zero using offsets from the player pointer.

I'm not sure, but I think for CSS each of the ammo types has a different offset (not sure exactly how many there are, but each ammo type is used in 2-5 weapons).
L. Duke is offline
[email protected]
Member
Join Date: Dec 2005
Old 01-02-2006 , 14:46  
Reply With Quote #3

Hmmm, I looked at the concommands for it and noticed it has two : "reload" and "+reload". Easy enough to everride "reload" with a CON_COMMAND_F of your own, but I got some weird results when I did it to "+reload". Ended up making me reload after every shot I fired.
Lojo.jacob@gmail.com is offline
haza55
Member
Join Date: Jul 2005
Old 01-02-2006 , 17:04  
Reply With Quote #4

ok the source engine uses a system of, off and on
sooo when u press R it goes "+reload" and when u release it it goes "-reload"

so if u do +reload the engine will keep trying to reload

so if u wanted to stop people from reloading which is a gay idea block the con command +reload
haza55 is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 01-02-2006 , 18:18  
Reply With Quote #5

Quote:
Originally Posted by L. Duke
Not sure why you are trying to do this, but maybe you could set their spare ammo to zero using offsets from the player pointer.

I'm not sure, but I think for CSS each of the ammo types has a different offset (not sure exactly how many there are, but each ammo type is used in 2-5 weapons).
Not possible.. the mod is sourceforts, and the reload function of one of the guns welds a block in place.. theres no ammo involved.

You don't get +reload as a clientcommand, so its not possible that way.

I've been trying CBP->m_nImpulse, but it never gets changed.
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
showdax
Senior Member
Join Date: Dec 2004
Old 01-02-2006 , 19:14  
Reply With Quote #6

You could try hooking CBaseCombatWeapon::Reload(). It's declared in game_shared/basecombatweapon_shared.h in the SDK, but that class might differ in SourceForts.

To get the weapon's instance, you could use CBaseEntity *CBasePlayer::HasNamedItem(const char *), CBaseCombatWeapon *CBaseCombatCharacter::GetActiveWeapon() const, or cycle through with virtual CBaseCombatWeapon *CBaseCombatCharacter::GetWeapon(int) const and int CBaseCombatCharacter::WeaponCount() const.
showdax is offline
Send a message via MSN to showdax
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 01-02-2006 , 19:31  
Reply With Quote #7

Yea, I was trying to avoid having to hook a bunch of different stuff, but it doesn't seem possible.. theres no function called when I need it to, other then ones in the weapon classes
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
Reply



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 08:53.


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