/*
author - rmx#6930
*/

/*
feel free to paste this code, just remember to give me credits
*/

/* function */
function viewmodel() {
    local = Entity.GetLocalPlayer();
    scoped = Entity.GetProp(local, "CCSPlayer", "m_bIsScoped");
 
    if (!Entity.IsAlive(local) || !World.GetServerString()) {
    Convar.SetFloat("r_drawvgui", 1);
    Convar.SetInt("fov_cs_debug", 0);
    }
    if (scoped) {
    Convar.SetFloat("r_drawvgui", 0);
    if (!UI.IsHotkeyActive("Visual", "WORLD", "View", "Thirdperson")) {
    Cheat.ExecuteCommand("fov_cs_debug 90");
    }
    } else {
    Convar.SetFloat("r_drawvgui", 1);
    Convar.SetInt("fov_cs_debug", 0);
    }
}

function unload() {
   Cheat.ExecuteCommand("fov_cs_debug 0");
}

/* callback */
Cheat.RegisterCallback("CreateMove", "viewmodel");
Cheat.RegisterCallback("Unload", "unload");