I tried to make simple script using MeRcyLeZZ model tutorial, but i also used ConnorMcLeod's method with set_user_info.
Anyway this is the outcome, don't know is it working, didn't had time to test it.
My question is: "is there any better method than this?"
Will this result in SVC_BAD?
Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
new Ubrania_CT[4][]={"sas","gsg9","urban","gign"};
new Ubrania_Terro[4][]={"arctic","leet","guerilla","terror"};
new g_player_model[33][32];
public plugin_init()
{
register_forward(FM_SetClientKeyValue, "SetClientKeyValue")
register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged")
RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawn", 1)
}
public Ham_PlayerSpawn(id)
{
if(is_user_alive(id))
DefaultModel(id)
}
public DefaultModel(id)
{
if (!is_user_connected(id))
return PLUGIN_CONTINUE;
new CsTeams:iTeam;
iTeam = cs_get_user_team(id)
switch(iTeam)
{
case CS_TEAM_T:fm_cs_set_user_model(id, Ubrania_Terro[random(sizeof(Ubrania_Terro))])
case CS_TEAM_CT:fm_cs_set_user_model(id, Ubrania_CT[random(sizeof(Ubrania_CT))])
}
return PLUGIN_CONTINUE;
}
public fw_SetClientKeyValue(id, infobuffer[], key[], value[])
{
if(equal(key, "model") && !equal(value, g_player_model[id]))
return FMRES_SUPERCEDE;
return FMRES_IGNORED;
}
public fw_ClientUserInfoChanged( id )
{
static currentmodel[32];
fm_cs_get_user_model( id, currentmodel, sizeof currentmodel - 1);
if (!equal(currentmodel, g_player_model[id]))
fm_cs_set_user_model( id, g_player_model[id]);
return FMRES_IGNORED;
}
stock fm_cs_get_user_model(id, model[], len)
get_user_info(id, "model", model, len)
stock fm_cs_set_user_model( player, const modelname[])
{
copy(g_player_model[player], sizeof g_player_model[] - 1,modelname)
set_user_info(player, "model", modelname)
}