Как сделать свою модель для любой привилегии?
Как сделать свою модель для любой привилегии?

В данной статье я расскажу вам, как можно поставить свою модель игрока для любой привилегии.Например у вас 5 привилегий и у каждой привилегии будет своя модель игрока!

Открываем исходник главного мода и ищем такую строку:

// Customization vars
Перед ней добавляем:

#define MYMODELFLAG                    ADMIN_LEVEL_C
где ADMIN_LEVEL_C - это флаг, у которого будет заданная вами модель.


После // Customization vars добавляем:

new Array:model_myname, Array:g_modelindex_myname;

Далее ищем такую строку:

// Initialize a few dynamically sized arrays

И после нее добавляем:

model_myname = ArrayCreate(32, 1);
g_modelindex_myname = ArrayCreate(1, 1);

Двигаемся дальше и ищем:

// Custom weapon models

перед ней добавляем:

for (i = 0; i < ArraySize(model_myname); i++)
{
	ArrayGetString(model_myname, i, buffer, charsmax(buffer))
	format(buffer, charsmax(buffer), "models/player/%s/%s.mdl", buffer, buffer)
	ArrayPushCell(g_modelindex_myname, engfunc(EngFunc_PrecacheModel, buffer))
	if (g_force_consistency == 1) force_unmodified(force_model_samebounds, {0,0,0}, {0,0,0}, buffer)
	if (g_force_consistency == 2) force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, buffer)
}

Теперь ищем такие строки:

if (g_handle_models_on_separate_ent)
{
	// Set the right model


и заменяем этот код:

if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	iRand = random_num(0, ArraySize(model_admin_human) - 1)
	ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}

на этот:

if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	iRand = random_num(0, ArraySize(model_admin_human) - 1)
	ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
else if (get_user_flags(id) & MYMODELFLAG)
{
	iRand = random_num(0, ArraySize(model_myname) - 1)
	ArrayGetString(model_myname, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_myname, iRand))
}

Листаем чуть-чуть ниже и видим такой код:

// Set the right model, after checking that we don't already have it
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	size = ArraySize(model_admin_human)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
			
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
	}
}

и заменяем его на этот:

// Set the right model, after checking that we don't already have it
if (get_user_flags(id) & MYMODELFLAG)
{
	size = ArraySize(model_myname)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_myname, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
			
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_myname, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_myname, iRand))
	}
}
else if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	size = ArraySize(model_admin_human)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
			
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
	}
}

Уже почти закончили, ищите такой код:

if (g_handle_models_on_separate_ent)
{
	// Set the right model
	if (g_survivor[id])
	{
		iRand = random_num(0, ArraySize(model_survivor) - 1)
		ArrayGetString(model_survivor, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_survivor, iRand))
	}
	else
	{
		if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
		{
			iRand = random_num(0, ArraySize(model_admin_human) - 1)
			ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
			if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
		}
		else
		{
			iRand = random_num(0, ArraySize(model_human) - 1)
			ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
			if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
		}
	}

В этом блоке кода мы заменяем только этот код:

if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	iRand = random_num(0, ArraySize(model_admin_human) - 1)
	ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}

на этот:

if (get_user_flags(id) & MYMODELFLAG)
{
	iRand = random_num(0, ArraySize(model_myname) - 1)
	ArrayGetString(model_myname, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_myname, iRand))
}
else if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	iRand = random_num(0, ArraySize(model_admin_human) - 1)
	ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
	if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}

Листаем немного ниже и находим такой код:

if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	size = ArraySize(model_admin_human)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
				
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
	}
}

и заменяем его на такой:

if (get_user_flags(id) & MYMODELFLAG)
{
	size = ArraySize(model_myname)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_myname, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
				
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_myname, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_myname, iRand))
	}
}
else if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
	size = ArraySize(model_admin_human)
	for (i = 0; i < size; i++)
	{
		ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
		if (equal(currentmodel, tempmodel)) already_has_model = true
	}
				
	if (!already_has_model)
	{
		iRand = random_num(0, size - 1)
		ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
		if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
	}
}

Выходим на финиш и последнее, ищем такую строку:

else if (equal(key, "ADMIN HUMAN"))

и перед ней добавляем:

else if (equal(key, "MYNAMEMODEL HUMAN"))
{
	// Parse models
	while (value[0] != 0 && strtok(value, key, charsmax(key), value, charsmax(value), ','))
	{
		// Trim spaces
		trim(key)
		trim(value)
						
		// Add to models array
		ArrayPushString(model_myname, key)
	}
}


Все с исходником мы закончили работу. Теперь его можно компилировать и заменять амхх файл.

Осталось зайти в zombieplague.ini
И там где
ADMIN HUMAN =
ниже добавляем:
MYNAMEMODEL HUMAN = название модели
Сохраняем и закрываем файл. Все, теперь у игроков с флагом MYMODELFLAG будет установлена модель MYNAMEMODEL HUMAN из zombieplague.ini

Hello, our administration publishes only cannon content, put like under the post below and write the best comment, we are preparing material just for you, Darling Гость.

Donate you can do to the author Universe, a gift in the form of a donation to his electronic piggy bank ;)


Comments 8
Информация
Посетители, находящиеся в группе Guests, не могут оставлять комментарии к данной публикации.
Foundation for your build
ReHLDS 3.4.0.654

ReHLDS (Reverse-engineered) - this is a new step forward that gives a second wind to our servers. ReHLDS works 2 times faster than HLDS.

AmxModx 1.8.3

AMXModX is a Metamod add-on that allows you to create new modifications for Half-Life in the Pawn language

Reunion 0.1.92

Reunion is a continuation of Dproto for ReHLDS. This is a metamod plugin that allows you to log into the 47/48 Non-Steam server.

Revoice 0.1.0.32

Revoice is a Metamod plugin that allows voice chat between non-steam and steam clients.

Metamod-r 1.3.0.127

The new Metamod-r contains a huge number of performance optimizations and much cleaner code. The kernel was written using a JIT compiler.

Ultimate Unprecacher 1.1

Ultimate Unprecacher is a plugin for MetaMod, it works on the principle of disabling unnecessary resources on your server, thereby you can free up space for resources for your plugins, using this module you can get rid of error 512!

ReAuthCheck 0.1.6

ReAuthCheck - this is a Metamod plugin that checks your players for validity, with this module for REHLDS you can protect your server from bots that constantly spam ads or simply clog up a slot on the server!

NetBufExtender (NBEX) 1.0

NetBufExtender or NBEX - This is a metamod plugin that expands the пїЅInternet bufferпїЅ: server and client buffers (not 100% guaranteed). Expands up to 64 kb. This means that players are less likely to be kicked with the error "Reliable channel overflowed"".

UserInfoNetOptimizer (UINO) 1.0

UINO пїЅ metamod plugin that allows you to remove unnecessary fields from userinfo(setinfo) when the engine passes it to other players on the server. This measure reduces the amount of data transferred and slightly reduces the chance of being kicked with "Reliable channel overflowed".

Information

Welcome to TB-TEAM.COM!

Welcome To Our New Website For CS1.6 Resources!.
Register
Create your own account!

Register Now!
Login
Already registered? Come on, log in quickly!

Login to the site