#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#define VIP_FLAG ADMIN_LEVEL_H
// TT
#define TT_V "models/teamDefaultKnifes/v_tt.mdl" // v_
#define TT_P "models/teamDefaultKnifes/p_tt.mdl" // p_
// CT
#define CT_V "models/teamDefaultKnifes/v_ct.mdl" // v_
#define CT_P "models/teamDefaultKnifes/p_ct.mdl" // p_
#define PLUG_VER "1.0"
#define PLUG_NAME "Team Default Knifes"
new mExists;
public plugin_init(){
register_plugin(PLUG_NAME, PLUG_VER, "ArKaNeMaN");
RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
RegisterHam(Ham_Item_Deploy, "weapon_knife", "wDeployKnife", true);
server_print("[%s %s] loaded.", PLUG_NAME, PLUG_VER);
}
public OnPlayerSpawn(id)
{
if(!is_user_alive(id) || !is_user_vip(id))
return
}
bool:is_user_vip(id)
return !!(get_user_flags(id) & VIP_FLAG)
public plugin_precache(){
if(file_exists(TT_V)){
mExists |= (1<<0);
precache_model(TT_V);
}
if(file_exists(TT_P)){
mExists |= (1<<1);
precache_model(TT_P);
}
if(file_exists(CT_V)){
mExists |= (1<<2);
precache_model(CT_V);
}
if(file_exists(CT_P)){
mExists |= (1<<3);
precache_model(CT_P);
}
}
public wDeployKnife(ent){
static id; id = get_pdata_cbase(ent, 41, 4);
static team; team = get_user_team(id);
switch(team){
case 1:{
if(mExists & (1<<0)) set_pev(id, pev_viewmodel2, TT_V);
if(mExists & (1<<1)) set_pev(id, pev_weaponmodel2, TT_P);
}
case 2:{
if(mExists & (1<<2)) set_pev(id, pev_viewmodel2, CT_V);
if(mExists & (1<<3)) set_pev(id, pev_weaponmodel2, CT_P);
}
}
return HAM_IGNORED;
}