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

[Req] Cancel reload when shooting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xairgeo
Member
Join Date: Oct 2014
Old 06-26-2018 , 02:23   [Req] Cancel reload when shooting
Reply With Quote #1

Can someone make a plugin that cancels the reload when pressing the attack button?, When I'm reloading and spot an enemy I have to switch weapons to cancel the reload and then switch back to shoot. It'll be easier to just make the reload stop when the +attack button is pressed like in most fps.
xairgeo is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-26-2018 , 05:11   Re: [Req] Cancel reload when shooting
Reply With Quote #2

The idea is good but you can't shoot without a magazine.
__________________
Relaxing is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 06-26-2018 , 05:19   Re: [Req] Cancel reload when shooting
Reply With Quote #3

how about unlimited ammo
__________________
SED LYF !!!
SHIELD755 is offline
sekac
Senior Member
Join Date: Nov 2016
Old 06-26-2018 , 08:38   Re: [Req] Cancel reload when shooting
Reply With Quote #4

Quote:
Originally Posted by SHIELD755 View Post
I AM THE GUY WHO HELP FREE
You sure are!
sekac is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 06-26-2018 , 09:17   Re: [Req] Cancel reload when shooting
Reply With Quote #5

what i dont understand it is my sighnature bro and i help free
__________________
SED LYF !!!
SHIELD755 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 06-26-2018 , 10:43   Re: [Req] Cancel reload when shooting
Reply With Quote #6

Issues:
  • First shoot on reload is not visible.

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#pragma semicolon 1
#pragma compress 1

#define PDATA_SAFE 2
#define WEAPON_XTRA_OFF 4
#define PLAYER_XTRA_OFF 5

#define m_pPlayer 41
#define m_pActiveItem 373
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack	47
#define m_flTimeWeaponIdle 48
#define m_fInReload 54
#define m_fInSpecialReload 55
#define m_flNextAttack 83

new const SHOTGUN_BITSUM = (1 << CSW_M3)|(1 << CSW_XM1014);

public plugin_init()
{
	register_plugin("Allow Shoot On Reload", "Advance", "Ghost");
	register_forward(FM_CmdStart, "FM_CmdStart_Pre");
}

public FM_CmdStart_Pre(PlayerID, UC_Handle, Seed)
{
	static Buttons, OldButtons;
	Buttons = entity_get_int(PlayerID, EV_INT_button);
	OldButtons = entity_get_int(PlayerID, EV_INT_oldbuttons);
	
	if ((Buttons & IN_ATTACK) && !(OldButtons & IN_ATTACK))
	{
		new Weapon = get_pdata_cbase(PlayerID, m_pActiveItem);
		
		if (pev_valid(Weapon) < PDATA_SAFE)
			return;
		
		if (!cs_get_weapon_ammo(Weapon))
			return;
		
		new IsShotgun = ((1 << cs_get_weapon_id(Weapon)) & SHOTGUN_BITSUM);
		
		if (get_pdata_int(Weapon, IsShotgun ? m_fInSpecialReload : m_fInReload))
		{
			set_pdata_int(Weapon, IsShotgun ? m_fInSpecialReload : m_fInReload, 0);
			set_pdata_float(PlayerID, m_flNextAttack, 0.0);
			set_pdata_float(Weapon, m_flNextPrimaryAttack, 0.0);
			set_pdata_float(Weapon, m_flNextSecondaryAttack, 0.0);
			set_pdata_float(Weapon, m_flTimeWeaponIdle, 0.0);
			ExecuteHamB(Ham_Weapon_PrimaryAttack, Weapon);
		}
	}
}
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
xairgeo
Member
Join Date: Oct 2014
Old 06-26-2018 , 18:53   Re: [Req] Cancel reload when shooting
Reply With Quote #7

Quote:
Originally Posted by Ghosted View Post
Issues:
  • First shoot on reload is not visible.

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#pragma semicolon 1
#pragma compress 1

#define PDATA_SAFE 2
#define WEAPON_XTRA_OFF 4
#define PLAYER_XTRA_OFF 5

#define m_pPlayer 41
#define m_pActiveItem 373
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack	47
#define m_flTimeWeaponIdle 48
#define m_fInReload 54
#define m_fInSpecialReload 55
#define m_flNextAttack 83

new const SHOTGUN_BITSUM = (1 << CSW_M3)|(1 << CSW_XM1014);

public plugin_init()
{
	register_plugin("Allow Shoot On Reload", "Advance", "Ghost");
	register_forward(FM_CmdStart, "FM_CmdStart_Pre");
}

public FM_CmdStart_Pre(PlayerID, UC_Handle, Seed)
{
	static Buttons, OldButtons;
	Buttons = entity_get_int(PlayerID, EV_INT_button);
	OldButtons = entity_get_int(PlayerID, EV_INT_oldbuttons);
	
	if ((Buttons & IN_ATTACK) && !(OldButtons & IN_ATTACK))
	{
		new Weapon = get_pdata_cbase(PlayerID, m_pActiveItem);
		
		if (pev_valid(Weapon) < PDATA_SAFE)
			return;
		
		if (!cs_get_weapon_ammo(Weapon))
			return;
		
		new IsShotgun = ((1 << cs_get_weapon_id(Weapon)) & SHOTGUN_BITSUM);
		
		if (get_pdata_int(Weapon, IsShotgun ? m_fInSpecialReload : m_fInReload))
		{
			set_pdata_int(Weapon, IsShotgun ? m_fInSpecialReload : m_fInReload, 0);
			set_pdata_float(PlayerID, m_flNextAttack, 0.0);
			set_pdata_float(Weapon, m_flNextPrimaryAttack, 0.0);
			set_pdata_float(Weapon, m_flNextSecondaryAttack, 0.0);
			set_pdata_float(Weapon, m_flTimeWeaponIdle, 0.0);
			ExecuteHamB(Ham_Weapon_PrimaryAttack, Weapon);
		}
	}
}
It works perfectly thanks! idk what you mean by the first shoot on reload not being visible.
xairgeo 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 23:30.


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