Can somebody make this plugin compatible with ZM mod?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define ACCESS_FLAG ADMIN_LEVEL_H
#define TASK_DELAY 0.5
#define TASK_MODEL 100
#define MODEL_PLAYER "vip"
new const VERSION[] = "1.0"
new pcvar_on
new g_has_custom_model[33],g_player_model[33][32],Float:g_models_counter
public plugin_init()
{
register_plugin("Inny model", VERSION, "FakeNick")
pcvar_on = register_cvar("model_on","1")
if(get_pcvar_num(pcvar_on))
{
register_logevent("event_round_end", 2, "1=Round_End")
RegisterHam(Ham_Spawn,"player","func_spawn",1)
register_forward(FM_SetClientKeyValue, "fw_key_value")
register_forward(FM_ClientUserInfoChanged, "fw_user_info_changed")
}
}
public plugin_precache()
{
new path[100]
formatex(path,sizeof path - 1,"models/player/playcs/%s.mdl",MODEL_PLAYER)
engfunc(EngFunc_PrecacheModel,path)
}
public func_spawn(id)
{
if(is_user_alive(id))
{
if(get_user_flags(id) & ACCESS_FLAG)
{
copy(g_player_model[id], sizeof g_player_model[] - 1, MODEL_PLAYER)
new currentmodel[32]
fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
if (!equal(currentmodel, g_player_model[id]))
{
set_task(1.0 + g_models_counter, "task_set_model", id+TASK_MODEL)
g_models_counter += TASK_DELAY
}
}else if (g_has_custom_model[id])
{
fm_reset_user_model(id)
}
}
}
public event_round_end()
{
g_models_counter = 0.0
}
public fw_key_value(id, const infobuffer[], const key[])
{
if (g_has_custom_model[id] && equal(key, "model"))
return FMRES_SUPERCEDE
return FMRES_IGNORED
}
public fw_ClientUserInfoChanged(id)
{
if (!g_has_custom_model[id])
return FMRES_IGNORED
static currentmodel[32]
fm_get_user_model(id, currentmodel, sizeof currentmodel - 1)
if (!equal(currentmodel, g_player_model[id]))
fm_set_user_model(id, g_player_model[id])
return FMRES_IGNORED
}
public task_set_model(id)
{
id -= TASK_MODEL
fm_set_user_model(id, g_player_model[id])
}
stock fm_set_user_model(player, const modelname[])
{
engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", modelname)
g_has_custom_model[player] = true
}
stock fm_get_user_model(player, model[], len)
{
engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len)
}
stock fm_reset_user_model(player)
{
g_has_custom_model[player] = false
dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player))
}