Пользователь
- Сообщения
- 23
- Реакции
- 3
Доброго времени суток, вопрос в следующем, если заменять модели игроков с помощью данного плагина, как правильно реализовать смену модели другим плагином, например покупкой в магазине модели противника?
Правильное ли решение например в плагине магазина сменить модель данным образом?
Код:
#include <amxmodx>
#include <reapi>
new g_szPlayerModel[33][TeamName][64];
public plugin_precache()
{
precache_model("models/player/cmr_administrator/cmr_administrator.mdl");
precache_model("models/player/cmr_admin/cmr_admin.mdl");
precache_model("models/player/cmr_player/cmr_player.mdl");
precache_model("models/player/cmr_player/cmr_player.mdl");
precache_model("models/player/cmr_lady1/cmr_lady1.mdl");
}
public plugin_init()
{
register_plugin("[ReAPI] Custom Models", "1.6.1", "neugomon");
RegisterHookChain(RG_CBasePlayer_Spawn, "fwdPlayerSpawn_Post", true);
RegisterHookChain(RG_CBasePlayer_SetClientUserInfoModel, "fwdSetClientUserInfoModel_Pre", false);
}
public client_putinserver(id)
{
g_szPlayerModel[id][TEAM_TERRORIST][0] = EOS;
g_szPlayerModel[id][TEAM_CT][0] = EOS;
if(get_user_flags(id) & ADMIN_RCON)
{
CopyModel(id, "arctic", "cmr_administrator");
}
else if(get_user_flags(id) & ADMIN_LEVEL_C)
{
CopyModel(id, "arctic", "cmr_lady1");
}
else if(get_user_flags(id) & ADMIN_CHAT)
{
CopyModel(id, "arctic", "cmr_admin");
}
else if(get_user_flags(id) & ADMIN_LEVEL_D)
{
CopyModel(id, "arctic", "cmr_player");
}
else
{
CopyModel(id, "arctic", "cmr_player");
}
}
public fwdPlayerSpawn_Post(id)
{
if(!is_user_alive(id))
return;
switch(TeamName:get_member(id, m_iTeam))
{
case TEAM_TERRORIST:
if(g_szPlayerModel[id][TEAM_TERRORIST][0]) rg_set_user_model(id, g_szPlayerModel[id][TEAM_TERRORIST]);
case TEAM_CT:
if(g_szPlayerModel[id][TEAM_CT][0]) rg_set_user_model(id, g_szPlayerModel[id][TEAM_CT]);
}
}
public fwdSetClientUserInfoModel_Pre(const id, infobuffer[], szNewModel[])
{
new TeamName:iTeam = get_member(id, m_iTeam);
if(iTeam == TEAM_TERRORIST || iTeam == TEAM_CT)
{
if(g_szPlayerModel[id][iTeam][0] && strcmp(szNewModel, g_szPlayerModel[id][iTeam]) != 0)
SetHookChainArg(3, ATYPE_STRING, g_szPlayerModel[id][iTeam]);
}
return HC_CONTINUE;
}
stock CopyModel(index, modelT[], modelCT[])
{
copy(g_szPlayerModel[index][TEAM_TERRORIST], charsmax(g_szPlayerModel[][]), modelT);
copy(g_szPlayerModel[index][TEAM_CT], charsmax(g_szPlayerModel[][]), modelCT);
}
Код:
new g_szPlayerModel[33][TeamName][64];
...code...
// покупка модели
CopyModel(i, "model_t", "model_ct");
// или так?
switch(TeamName:get_member(id, m_iTeam))
{
case TEAM_TERRORIST:
if(g_szPlayerModel[id][TEAM_TERRORIST][0]) rg_set_user_model(id, g_szPlayerModel[id][TEAM_TERRORIST]);
case TEAM_CT:
if(g_szPlayerModel[id][TEAM_CT][0]) rg_set_user_model(id, g_szPlayerModel[id][TEAM_CT]);
}
...code...
stock CopyModel(index, modelT[], modelCT[])
{
copy(g_szPlayerModel[index][TEAM_TERRORIST], charsmax(g_szPlayerModel[][]), modelT);
copy(g_szPlayerModel[index][TEAM_CT], charsmax(g_szPlayerModel[][]), modelCT);
}
Последнее редактирование: