From 8e3b6f4166eff8ac76c44db477ce14615a892234 Mon Sep 17 00:00:00 2001 From: s1lent Date: Thu, 24 May 2018 12:50:50 +0700 Subject: [PATCH] Enhance item_security --- regamedll/dlls/items.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index 16455b59..0708287b 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -282,13 +282,32 @@ LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote, CCSItemAntidote) void CItemSecurity::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/w_security.mdl"); + + if (pev->model.IsNullOrEmpty()) + { + // default model + SET_MODEL(ENT(pev), "models/w_security.mdl"); + } + else + { + // custom model + SET_MODEL(ENT(pev), pev->model); + } + CItem::Spawn(); } void CItemSecurity::Precache() { - PRECACHE_MODEL("models/w_security.mdl"); + if (pev->model.IsNullOrEmpty()) + { + // default model + PRECACHE_MODEL("models/w_security.mdl"); + return; + } + + // custom model + PRECACHE_MODEL(pev->model); } BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer)