The first, you must open your .sln progect and in tree you must open "Server". Now create new file "item_armor.cpp" and write there this code:
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Armor for player.
//
// Made by hitmen047
//=============================================================================//
#include "cbase.h" // Это Х.З. что, но без него никак
#include "hl2_player.h" // Относится к игроку
#include "basecombatweapon.h" // Относится к "basecombatweapon"
#include "gamerules.h" // Обращение к игровым правилам
#include "items.h" // Обращение к объектам, которые можно использовать
#include "engine/IEngineSound.h" // Использует звуки
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class CItemArmor : public CItem // Задаём класс
{
public:
DECLARE_CLASS( CItemArmor, CItem );
void Spawn( void ) // Спавнится наш бронежилет
{
Precache( ); // Задаётся
SetModel( "models/NeoDement/elitehelmet.mdl" ); // Моделька
BaseClass::Spawn( ); // В итоге спавнится
}
void Precache( void ) // Что-то связаное с использованием
{
PrecacheModel ("models/NeoDement/elitehelmet.mdl"); // Моделька
PrecacheScriptSound( "ItemArmor.Touch" ); // Звук при поднятии
}
bool MyTouch( CBasePlayer *pPlayer )
{
CHL2_Player *pHL2Player = dynamic_cast( pPlayer );
return ( pHL2Player && pHL2Player->ApplyBattery() ); // Указываем, что игроку прибавляется энергия костюма
}
};
LINK_ENTITY_TO_CLASS(item_armor, CItemArmor); // название энити
PRECACHE_REGISTER(item_armor); // название энити
Okey! That's all! No you must compill project, then copy .dll files to bin folder of your mod.
Where is model?
Где модель?
А модель самому нужно делать.
It's your care.