AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to disable automatic reloading in cs guns? (https://forums.alliedmods.net/showthread.php?t=128261)

Voi 05-30-2010 12:40

how to disable automatic reloading in cs guns?
 
how to disable automatic reloading in cs guns?

wrecked_ 05-30-2010 12:44

Re: how to disable automatic reloading in cs guns?
 
I can't think of a clean way to do it at the moment, but does anyone know if FM_CmdStart is called on automatic reloading along with manual reloading?

Voi 05-30-2010 12:57

Re: how to disable automatic reloading in cs guns?
 
Well i was rather thinking about weapon entity variable than doing it with hooks, blocks etc.

I remember there was an offset telling the weapon is autoreloadable, but im not sure if it can be set by server.

ConnorMcLeod 05-31-2010 16:19

Re: how to disable automatic reloading in cs guns?
 
You would need to access memory (with orpheu) and change :

int iFlags( void ) { return ItemInfoArray[ m_iId ].iFlags; }

and set ITEM_FLAG_NOAUTORELOAD flag off

From weapons.cpp :
Code:

                        // weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
                        if ( m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0 : gpGlobals->time ) )
                        {
                                Reload();
                                return;
                        }

Or you may do it filtering Ham_Reload if you use Ham, you could for example check if player reload button is pressed or not, not sure it would work though.

Voi 05-31-2010 17:43

Re: how to disable automatic reloading in cs guns?
 
Setting nextattack would work, but it would be messy. Could you provide the whole concept using orpheu, its black magic for me and theres no way I would alone do it in orpheu :<

joropito 05-31-2010 19:09

Re: how to disable automatic reloading in cs guns?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1196464)
Or you may do it filtering Ham_Reload if you use Ham, you could for example check if player reload button is pressed or not, not sure it would work though.

One way is checking at cmdstart for buttons and oldbutton and then set a variable to supercede Ham_Reload or not.

jim_yang 05-31-2010 22:07

Re: how to disable automatic reloading in cs guns?
 
if you use memory hack, just erase the function "Reload(); " in that if statement, that's the simple way.
just write 0x90 (NOP) instead of the original function call instructions
Code:

jmp XXXX or
call XXXX


ConnorMcLeod 06-01-2010 01:44

Re: how to disable automatic reloading in cs guns?
 
Quote:

Originally Posted by joropito (Post 1196576)
One way is checking at cmdstart for buttons and oldbutton and then set a variable to supercede Ham_Reload or not.

Thing is that no button is involved in automatic reload when weapons are empty.

@Voi
Have no single idea on the memory thing, it's more black for me than for you, i don't use orpheu at all (except 1 or 2 plugins done by other persons for my bhop server).

@jim
He only wants to disable automatic reload, not manual one.


THE JOB IS FOR ARKSHINE (mais d'abord faut qu'il aille débroussailler !!)

jim_yang 06-01-2010 01:55

Re: how to disable automatic reloading in cs guns?
 
You are right, what I mean is if your code sample is the auto one, then just disable the reload function call, not the reload function itself, that way is easy than hack other memory part. and I believe auto reload call and manual reload call are not the same one.
cause I'm not on my computer, so I can't confirm that.

joropito 06-01-2010 08:27

Re: how to disable automatic reloading in cs guns?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1196767)
Thing is that no button is involved in automatic reload when weapons are empty.

I mean with cmdstart you can know if it's reloading manually or not. (in fact, only manually with cmdstart).


All times are GMT -4. The time now is 05:17.

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