Перевод этой страницы:

Xash3D

All old is new again

Инструменты пользователя

Инструменты сайта


Боковая панель

xashcookbook:en:recipes:code:server:cs_zoom

CS Style 2x Zooming

by Jmv_cyber, modified by CRxTRDude
Original site: http://www.planethalflife.com/hlprogramming/tutorial.asp?i=205

Tutorial type: Beginners - C/P


As you might have noticed, the previous tutorials only works for SDK 2.1. This one works for SDK 2.3 (and maybe 2.2, haven't tested that though). Anyway, replace the zoom from the secondary attack code from the crossbow 1) with this:

if (m_fInZoom == 0) // 0 means reset to default fov
{
  m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 45;
  m_fInZoom = 1;
}
else if (m_fInZoom == 1)
{
  m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 20;
  m_fInZoom = 2;
}
else if (m_fInZoom == 2)
{
  m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0;
  m_fInZoom = 0;
}
1) This can also be added on other long-range weapons as well, provided that you have derived from the crossbow code.
xashcookbook/en/recipes/code/server/cs_zoom.txt · Последние изменения: 2014/06/05 06:28 — crxtrdude