You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can't purposefully drop items in TF2 like you can in CS:S/GO (no drop command). However, when you die (e.g. kill), your current weapon is dropped for other team members to use along with an ammo pack. The big difference in TF2 though, is that this dropped weapon becomes a new tf_dropped_weapon entity and therefore never satisfies the FindEntityByClassname(ent, "weapon_*") check in shavit-misc's Timer_Cron when gCV_NoWeaponDrops.BoolValue is true.
while ((ent=FindEntityByClassname(ent, "weapon_*")) !=-1)
{
if (GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity") ==-1)
{
AcceptEntityInput(ent, "Kill");
}
}
}
SDKHook_WeaponDrop also doesn't behave as you would expect in TF2. When you die, the WeaponDrop callback contains the entity index of the last equipped weapon but NOT the entity index of the newly created tf_dropped_weapon. Unless the player changes their loadout, the weapon entity index remains the same before and after respawning, so the only thing OnWeaponDrop does is kill whatever weapon entity was equipped at time of death.
So basically neither Timer_Cron or the WeaponDrop callback kill dropped weapons in TF2. Luckily though TF2 has a built-in ConVar for this functionality, tf_dropped_weapon_lifetime, so there’s no need to use a timer or hook WeaponDrop.
The text was updated successfully, but these errors were encountered:
You can't purposefully drop items in TF2 like you can in CS:S/GO (no
drop
command). However, when you die (e.g.kill
), your current weapon is dropped for other team members to use along with an ammo pack. The big difference in TF2 though, is that this dropped weapon becomes a new tf_dropped_weapon entity and therefore never satisfies theFindEntityByClassname(ent, "weapon_*")
check in shavit-misc's Timer_Cron when gCV_NoWeaponDrops.BoolValue is true.bhoptimer/addons/sourcemod/scripting/shavit-misc.sp
Lines 959 to 970 in 68a57b9
SDKHook_WeaponDrop also doesn't behave as you would expect in TF2. When you die, the WeaponDrop callback contains the entity index of the last equipped weapon but NOT the entity index of the newly created tf_dropped_weapon. Unless the player changes their loadout, the weapon entity index remains the same before and after respawning, so the only thing OnWeaponDrop does is kill whatever weapon entity was equipped at time of death.
bhoptimer/addons/sourcemod/scripting/shavit-misc.sp
Lines 1474 to 1480 in 68a57b9
So basically neither Timer_Cron or the WeaponDrop callback kill dropped weapons in TF2. Luckily though TF2 has a built-in ConVar for this functionality,
tf_dropped_weapon_lifetime
, so there’s no need to use a timer or hook WeaponDrop.The text was updated successfully, but these errors were encountered: