View Single Post
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 02-10-2018 , 22:04   Re: Weapons War v7.5 (26 Weapons)
Reply With Quote #306

White Fang, now try to disable that cvar. Then, see different.

Instinctpt1, I will test it in my local server and give you the result.

Edit: After test it. There is only small errors in your code. You just need to enable below cvar:
Code:
g_iWeaponDrop = register_cvar("spr_weapon_drop", "1") // 0; Prevent players to drop any weapons || 1; Allow players to drop current war weapon
Set it to "1" instead "0".

This is because the code to malfunction other weapon is being checked using this cvar. See below:
Code:
// Credit to ConnorMcLeod: https://forums.alliedmods.net/showpost.php?p=1238819&postcount=47
public cs_war_WeaponsDeploy(iWeapon)
{
	if(pev_valid(iWeapon) == 2)
	{
		if(g_bInWar)
		{
			if(get_pcvar_num(g_iWeaponDrop))
			{
				new iId = get_pdata_int(iWeapon, m_iId, XO_WEAPONS)
				if(iId != g_WeaponIndex)
				{
					set_pdata_float(iWeapon, m_flNextPrimaryAttack, 99999.0, XO_WEAPONS)
					set_pdata_float(iWeapon, m_flNextSecondaryAttack, 99999.0, XO_WEAPONS)
				}
			}
		}
		else if(g_bLastRoundIsWar)
		{
			set_pdata_float(iWeapon, m_flNextPrimaryAttack, 0.0, XO_WEAPONS)
			set_pdata_float(iWeapon, m_flNextSecondaryAttack, 0.0, XO_WEAPONS)
		}
	}
}
If you want to prevent weapon drop, yet want to have malfunction feature, you can remove the weapon drop cvar check in above code. Then, it will be as below:
Code:
// Credit to ConnorMcLeod: https://forums.alliedmods.net/showpost.php?p=1238819&postcount=47
public cs_war_WeaponsDeploy(iWeapon)
{
	if(pev_valid(iWeapon) == 2)
	{
		if(g_bInWar)
		{
			new iId = get_pdata_int(iWeapon, m_iId, XO_WEAPONS)
			if(iId != g_WeaponIndex)
			{
				set_pdata_float(iWeapon, m_flNextPrimaryAttack, 99999.0, XO_WEAPONS)
				set_pdata_float(iWeapon, m_flNextSecondaryAttack, 99999.0, XO_WEAPONS)
			}
		}
		else if(g_bLastRoundIsWar)
		{
			set_pdata_float(iWeapon, m_flNextPrimaryAttack, 0.0, XO_WEAPONS)
			set_pdata_float(iWeapon, m_flNextSecondaryAttack, 0.0, XO_WEAPONS)
		}
	}
}
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 02-10-2018 at 23:13.
zmd94 is offline