Code: Select all
#include <amxmodx>#include <engine>#include <hamsandwich>#include <cstrike>#include <fakemeta_util> #define PLUGIN "skinai"#define VERSION "v1"#define AUTHOR "......" #define TERRMODEL "........"#define CTMODEL "..........." new cvar_modelsnew bool:changedModel[33 char] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_SetClientKeyValue,"SetClientKeyValue") RegisterHam(Ham_Spawn, "player", "client_spawn", 1)} public plugin_precache(){ static modelname[128] formatex(modelname, 127, "models/player/%s/%s.mdl",TERRMODEL, TERRMODEL) engfunc(EngFunc_PrecacheModel, modelname) formatex(modelname, 127, "models/player/%s/%s.mdl", CTMODEL, CTMODEL) engfunc(EngFunc_PrecacheModel, modelname)} public SetClientKeyValue(id, const infobuffer[], const key[]){ return equal(key,"model") && changedModel{id} ? FMRES_SUPERCEDE : FMRES_IGNORED} public client_spawn(id){ if(!is_user_alive(id)) return HAM_IGNORED; if( get_user_flags(id) & ADMIN_IMMUNITY ) { static CsTeams:team team = cs_get_user_team(id) if(team == CS_TEAM_T) { set_user_model(id, TERRMODEL) changedModel{id} = true } else if (team == CS_TEAM_CT) { set_user_model(id, CTMODEL) changedModel{id} = true } } return HAM_IGNORED;} public client_disconnect(id){ changedModel{id} = false} /*========================*//*=========STOCKAI=========*/ stock set_user_model(id,model[]){ engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetInfoKeyBuffer,id), "model", model)}