View Single Post
xerox8521
Senior Member
Join Date: Sep 2011
Old 12-20-2023 , 10:13   Re: CSS Knife can't be equipped with Command ?
Reply With Quote #2

You are passing a weapon id to EquipPlayerWeapon which requires an entity index of that weapon.
Your game crashes as it tries to equip a non weapon entity.
What you need is the return value of GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) which you then can pass to EquipPlayerWeapon. Be sure to always check if GetPlayerWeaponSlot does not return -1 before attempting to use EquipPlayerWeapon.
xerox8521 is offline