Don't bump until 2 weeks have passed since last post.
To use
Ham_Item_Deploy, you need to grab the player's index from the entity that is passed to the function
Code:
#include <amxmodx>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
// private data for weapons
const XO_WEAPONS = 4;
const m_pPlayer = 41;
public plugin_init() {
// hook after the knife has deployed
RegisterHam(Ham_Item_Deploy, "weapon_knife", "FwdDeployKnifePost", 1);
}
public FwdDeployKnifePost(entity) {
// check if entity can has private data
if(pev_valid(entity) == 2) {
// grab the player id holding the weapon
new id = get_pdata_cbase(entity, m_pPlayer, XO_WEAPONS);
// grab models
new v_model[64], p_model[64];
GetModels(id, CSW_KNIFE, v_model, charsmax(v_model), p_model, charsmax(p_model));
// if has view model
if(v_model[0]) {
// set view model
set_pev(id, pev_viewmodel2, v_model);
}
// if has player model
if(p_model[0]) {
// set player model
set_pev(id, pev_weaponmodel2, p_model);
}
}
}
__________________