WriteByte(MSG_ONE, type);
}
-.float hasweapon_complain_spam;
float client_hasweapon(entity cl, float wpn, float andammo, float complain)
{
float f;
if(time < self.hasweapon_complain_spam)
complain = 0;
+
+ if(wpn == WEP_HOOK && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
+ complain = 0;
+
if(complain)
self.hasweapon_complain_spam = time + 0.2;
sprint(self, "Invalid weapon\n");
return FALSE;
}
- if (WEPSET_CONTAINS_EW(cl, wpn))
+ if (cl.weapons & WepSet_FromWeapon(wpn))
{
if (andammo)
{
{
// DRESK - 3/16/07
// Report Proper Weapon Status / Modified Weapon Ownership Message
- if (WEPSET_CONTAINS_AW(weaponsInMap, wpn))
+ if (weaponsInMap & WepSet_FromWeapon(wpn))
{
Send_WeaponComplain(cl, wpn, W_Name(wpn), 1);
return FALSE;
}
-.float weaponcomplainindex;
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
{
// We cannot tokenize in this function, as GiveItems calls this
return 0;
}
-#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, FALSE, TRUE)
+void W_SwitchWeapon_Force(entity e, float w)
+{
+ e.cnt = e.switchweapon;
+ e.switchweapon = w;
+ e.selectweapon = w;
+}
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity pl)
// hack to ensure it switches to an OTHER weapon (in case the other fire mode still has ammo, we want that anyway)
float w, ww;
w = pl.weapon;
- if(WEPSET_CONTAINS_EW(pl, w))
+ if(pl.weapons & WepSet_FromWeapon(w))
{
- WEPSET_ANDNOT_EW(pl, w);
+ pl.weapons &= ~WepSet_FromWeapon(w);
ww = w_getbestweapon(pl);
- WEPSET_OR_EW(pl, w);
+ pl.weapons |= WepSet_FromWeapon(w);
}
else
ww = w_getbestweapon(pl);