Not tested at all :
[Edit] Oops you wanted only *get*. Oh well, whatever.
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
const m_iZoomType = 363;
const m_pActiveItem = 373;
const m_iId = 43;
const CS_FIRST_ZOOM = 0x28;
const CS_SECOND_AWP_ZOOM = 0xA;
const CS_SECOND_NONAWP_ZOOM = 0xF;
const CS_AUGSG552_ZOOM = 0x37;
const CS_NO_ZOOM = 0x5A;
enum
{
CS_RESET_ZOOM,
CS_SET_NO_ZOOM,
CS_SET_FIRST_ZOOM,
CS_SET_SECOND_ZOOM,
CS_SET_AUGSG552_ZOOM,
};
#define MAX_CLIENTS 32
new gi_MsgResetHUD;
new gi_Zooming[ MAX_CLIENTS + 1 ];
public plugin_init ()
{
register_forward ( FM_PlayerPreThink, "Forward_PlayerPreThink" );
register_forward ( FM_MessageBegin , "Forward_MessageBegin" );
gi_MsgResetHUD = get_user_msgid ( "ResetHUD" );
}
public client_disconnect ( id )
{
gi_Zooming[ id ] = 0;
}
public Forward_PlayerPreThink ( const id )
{
if ( gi_Zooming[ id ] )
{
set_pdata_int ( id, m_iZoomType, gi_Zooming[ id ] );
}
}
public Forward_MessageBegin ( const msg_dest, const msg_type, const Float:vf_Origin[], const id )
{
if ( msg_type == gi_MsgResetHUD )
{
if ( gi_Zooming[ id ] )
{
gi_Zooming[ id ] = 0;
}
}
}
stock fm_get_user_zoom ( const id )
{
switch ( get_pdata_int ( id, m_iZoomType ) )
{
case CS_NO_ZOOM : return CS_SET_NO_ZOOM;
case CS_FIRST_ZOOM : return CS_SET_FIRST_ZOOM;
case CS_SECOND_AWP_ZOOM, CS_SECOND_NONAWP_ZOOM : return CS_SET_SECOND_ZOOM;
case CS_AUGSG552_ZOOM : return CS_AUGSG552_ZOOM;
}
return 0;
}
stock fm_set_user_zoom ( const id , const i_ZoomType, const i_Mode )
{
new i_Value, i_CurWeapon = get_pdata_int ( get_pdata_cbase ( id, m_pActiveItem ), m_iId );
gi_Zooming[ id ] = 0;
if ( i_ZoomType == CS_RESET_ZOOM )
{
set_pdata_int ( id, m_iZoomType, CS_NO_ZOOM );
return 1;
}
switch ( i_ZoomType )
{
case CS_SET_NO_ZOOM : i_Value = CS_NO_ZOOM;
case CS_SET_FIRST_ZOOM : i_Value = CS_FIRST_ZOOM;
case CS_SET_SECOND_ZOOM : i_Value = ( i_CurWeapon == CSW_G3SG1 || i_CurWeapon == CSW_SG550 || i_CurWeapon == CSW_SCOUT ) ? CS_SECOND_NONAWP_ZOOM : CS_SECOND_AWP_ZOOM;
case CS_SET_AUGSG552_ZOOM : i_Value = CS_AUGSG552_ZOOM;
default : return 0;
}
if ( !i_Mode )
{
gi_Zooming[ id ] = i_Value;
}
set_pdata_int ( id, m_iZoomType, i_Value );
return 1;
}