I do this in Sell! and in 1v1(Knife Fight) if you want to take a look.
I strip the weapons first and then after I am done stripping I assign the appropriate into there current slot
This:
Code:
public EquipAvailableWeapon(client)
{
// Find a new weapon to equip
new pos = 0;
new weaponEntity = -1;
do {
weaponEntity = GetPlayerWeaponSlot(client, pos);
pos++;
} while(weaponEntity == -1 && pos < 5);
if(weaponEntity != -1)
SDKCall(hEquipWeapon, client, weaponEntity);
}
Is a function I use to find the most appropriate weapon. It could easily be adapted to go straight to the knife something like this.
Code:
public EquipKnife(client)
{
new weaponEntity = -1;
weaponEntity = GetPlayerWeaponSlot(client, 2);
if(weaponEntity != -1)
SDKCall(hEquipWeapon, client, weaponEntity);
}
Here is the setup for the SDKCall
Code:
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Weapon_Equip");
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
hEquipWeapon = EndPrepSDKCall();
Code:
"Games"
{
"cstrike"
{
"Offsets"
{
"Weapon_Equip"
{
"windows" "217"
"linux" "218"
}
}
}
}