// AntiZoom by Rennnyyy
//
// Change here your special configuration

block config
{
  //Restrict the zoom of the AWP
  es_xset az_awp 1  

  //Restrict the zoom of the G3SG1 (T-Autosniper)
  es_xset az_gsg 1   

  //Restrict the zoom of the SG550 (CT-Autosniper)
  es_xset az_sg 1   

  //Restrict the zoom of the Scout
  es_xset az_scout 1  

  //Set to 1 if players should get the same ammo in the clip after zooming
  //Set to 0 if players should get a reloaded weapon after zooming
  //My advice: 1
  es_xset az_same_clip 1

  //Set to 1 if players should get the same ammo as stock after zooming
  //Set to 0 if players should get a full stock-ammo after zooming
  //My advice: 1
  es_xset az_same_ammo 1
}

//Do not edit under this line unless you know ESS

block load
{
  es_xdoblock antizoom/config
  es_msg #multi #green[AntiZoom]#default has been loaded
}

block unload
{
  es_msg #multi #green[AntiZoom]#default has been unloaded
}

event weapon_zoom
{
  es_xset az_do 0
  
  if (event_var(es_userweapon) == weapon_awp) do
  {
    if(server_var(az_awp) == 1) do
    {
      es_xset az_do 1
    }
  }
  if (event_var(es_userweapon) == weapon_g3sg1) do
  {
    if(server_var(az_gsg) == 1) do
    {
      es_xset az_do 1
    }
  }
  if (event_var(es_userweapon) == weapon_sg550) do
  {
    if(server_var(az_sg) == 1) do
    {
      es_xset az_do 1
    }
  }
  if (event_var(es_userweapon) == weapon_scout) do
  {
    if(server_var(az_scout) == 1) do
    {
      es_xset az_do 1
    }
  }

  ifx true(az_do == 1) do
  {
    if (server_var(az_same_clip) == 1) do
    {
      es_xset az_clip 0
      es playerget clip az_clip event_var(userid) event_var(es_userweapon)
    }
  
    if (server_var(az_same_ammo) == 1) do
    {
      es_xset az_ammo 0
      es playerget ammo az_ammo event_var(userid) event_var(es_userweapon)
    }
  
    es est_removeweapon event_var(userid) 1

    es_give event_var(userid) event_var(es_userweapon)

    if (server_var(az_same_clip) == 1) do
    {
      es playerset clip event_var(userid) event_var(es_userweapon) server_var(az_clip)
    }

    if (server_var(az_same_ammo) == 1) do
    {
      es playerset ammo event_var(userid) event_var(es_userweapon) server_var(az_ammo)
    }
    es_tell event_var(userid) #multi #green[AntiZoom]#default You can't zoom with this weapon
  }
}