#include <amxmodx>
#include <reapi>
#include <pmodel>
new const T_Model[] = "silentai_T_NEW"
new const CT_Model[] = "silentai_CT_NEW"
public plugin_precache()
{
PrecachePlayerModel(T_Model)
PrecachePlayerModel(CT_Model)
}
public plugin_init()
{
register_event("TeamInfo", "OnTeamInfo", "a"); // Uzregistruojam ivyki, kai zaid?jo komanda pasikeicia.
RegisterHookChain(RG_CBasePlayer_Killed, "@OnPlayerPreSpawn", false); //veikia
UsePlayerModels(); // Sita butina panaudot, kitaip SetPlayerModel() neveiks.
}
@OnPlayerPreSpawn(client)
{
SetPlayerModel(client);
}
public client_disconnected(id)
{
SetPlayerModel(id)
}
public OnTeamInfo()
{
new client = read_data(1); // Gaunam zaid?jo ID i? ivykio.
// Imanoma, kad jis atsijunge, tad reikia patikrinti.
if (!is_user_connected(client))
return;
// Gaunam nauja zaidejo komanda is ivykio.
new team[2];
read_data(2, team, charsmax(team));
CustomSetPlayerModel(client, team[0]);
}
CustomSetPlayerModel(client, team)
{
new flags = get_user_flags(client);
switch (team)
{
case 'T':
{
if (flags & ADMIN_IMMUNITY) set_entvar(client, var_skin, 3);
else if (flags & ADMIN_BAN) set_entvar(client, var_skin, 2);
else if (flags & ADMIN_LEVEL_H) set_entvar(client, var_skin, 1);
else if (is_user_steam(client)) set_entvar(client, var_skin, 0);
else return;
SetPlayerModel(client, T_Model);
}
case 'C':
{
if (flags & ADMIN_IMMUNITY) set_entvar(client, var_skin, 3);
else if (flags & ADMIN_BAN) set_entvar(client, var_skin, 2);
else if (flags & ADMIN_LEVEL_H) set_entvar(client, var_skin, 1);
else if (is_user_steam(client)) set_entvar(client, var_skin, 0);
else return;
SetPlayerModel(client, CT_Model);
}
}
}