Premium Реклама Spotlight Bundles Boost Банери Кредити
Основно Начало Сървъри Marketplace Форум Сървъри
Общности Хостинг Добави Auction Boost
Ресурси
Библиотеки Карти Видеа Магазин Bundles
Инструменти
Builder Demo CFG HUD
AMXX API
Вход Регистрация
TOP SERVER
[IG] Easy Surf | Ramp Fix | RANKS | REPLAYS
Counter-Strike 1.6
surf_flyin_fortress
40.160.19.36:27015
18.05 18:49
8/64
186ms
/ Библиотеки / pmodel.inc

pmodel.inc

.inc 2.1 KB 79 реда 04.04.2026
Pawn / AMX Mod X
#if defined P_MODEL_INCLUDED
#endinput
#endif
#define P_MODEL_INCLUDED

#include <fakemeta>
#include <cstrike>

stock __PlayerModels[33][64];
stock __SetClientKeyValue = INVALID_HANDLE;

/*
 * Precaches player model.
 * Also attempts to precache the "T" file if it exists.
 *
 * model[]    model name (e.g. "vip").
 * late       set to true if precaching model not in plugin_precache().
 *
 * @return    model index.
 */
stock PrecachePlayerModel(const model[], bool:late = false)
{
	new path[128], ret;
	formatex(path, charsmax(path), "models/player/%s/%s.mdl", model, model);
	late ? (ret = engfunc(EngFunc_PrecacheModel, path)) : (ret = precache_model(path));
	
	formatex(path, charsmax(path), "models/player/%s/%sT.mdl", model, model);
	
	if (file_exists(path))
		late ? engfunc(EngFunc_PrecacheModel, path) : precache_model(path);
	
	return ret;
}

/*
 * Initializes usage of player models.
 *
 * use      true - use player models, false - stop using player models.
 *
 * @NOTE    Must call before using SetPlayerModel(). Recommended in plugin_init().
 */
stock UsePlayerModels(bool:use = true)
{
	if (use)
	{
		if (__SetClientKeyValue == INVALID_HANDLE)
			__SetClientKeyValue = register_forward(FM_SetClientKeyValue, "__OnSetClientKeyValue");
	}
	else
	{
		if (__SetClientKeyValue != INVALID_HANDLE)
		{
			unregister_forward(FM_SetClientKeyValue, __SetClientKeyValue);
			__SetClientKeyValue = INVALID_HANDLE;
		}
	}
}

/*
 * Sets player model.
 *
 * client     player index.
 * model[]    model name (e.g. "vip"). Leave empty to reset model.
 */
stock SetPlayerModel(client, const model[] = "")
{
	model[0] != EOS ? copy(__PlayerModels[client], charsmax(__PlayerModels[]), model) : (__PlayerModels[client][0] = EOS);
	set_user_info(client, "model", model);
}

public __OnSetClientKeyValue(client, const buffer[], const key[], const value[])
{	
	if (__PlayerModels[client][0] == EOS || !(CS_TEAM_T <= cs_get_user_team(client) <= CS_TEAM_CT) || !equal(key, "model"))
		return FMRES_IGNORED;
	
	set_user_info(client, "model", __PlayerModels[client]);
	
	return FMRES_SUPERCEDE;
}
РЕКЛАМИРАЙ ПРИ НАС!
AMXX-BG.INFO
КАК ДА ИЗПОЛЗВАМ
Добави в началото на .sma файла:
#include <pmodel>
1. Изтегли
Свали файла от бутона по-горе
2. Копирай
Постави в scripting/include/
3. Включи
Добави #include директивата
4. Компилирай
Използвай amxxpc или scripting/compile.exe
PrivateServ.NET