So what I want to do is essentially change the fov value of weapons that can zoom. I'm not even sure if this is possible since it might be entirely client side but I just thought I'd ask some of the "experts" around here.
I'm pretty sure that "zooming" with a weapon, in CSS at least, is essentially just the users fov value being lowered from the default 90, a screen overlay being added, muzzle flash sprites being disabled or set transparent, and a mouse sensitivity reduction. From what I've gathered, all the sniper rifles first zoom fov is 30, and the second 15. The aug and sg552 rifles is 55.
My coding experience is well, not much. I know a bit of programing concepts I've just never really put them to use. I know some java from a college course I've taken recently, have been messing around with eventscripts for a while now, and just recently got interrested in python but thats about it.
Anyways, I put together some rough skeleton code
Code:
/**
* ====================
* Weapon Zoom
* Author: ----
* ====================
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define VERSION "0.1"
// Variables will go here
public Plugin:myinfo =
{
name = "Weapon Zoom",
author = "Gabe B",
description = "Sets a custom Fov and Overlay on weapons that can zoom",
version = VERSION,
url = ""
};
public OnPluginStart()
{
// ======================================================================
HookEvent("weapon_zoom", PlayerZoom);
// ======================================================================
CreateConVar("gs_weaponzoom_version",VERSION,"[WeaponZoom] Current version of this plugin",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
public Action:PlayerZoom(Handle:event, const String:name[], bool:dontBroadcast)
{
GetClientWeapon(client , String:Weapon ,MaxLength)
decl String:weaponName[8];
GetEventString(event, "weapon", weaponName, sizeof(weaponName));
if (WeaponCheck(weaponName))
{
}
}
public WeaponCheck(String:weapon[])
{
if(strcmp(weapon, "aug") == 0 || strcmp(weapon, "sg552") == 0 || strcmp(weapon, "scout") == 0 || strcmp(weapon, "sg550") == 0 || strcmp(weapon, "g3sg1") == 0 || strcmp(weapon, "awp") == 0)
{
return 1;
}
return 0;
}
At this point I'm sort of completely in the dark.
I'm not really sure where to go.....
Should I hook into the weapon_zoom event and change the value when its fired?
Also, theres no source for me to reference because obviously css source code has never been released so I'm not sure what value i'll be changing. Iv'e been looking at weapon_crossbow.cpp from the source sdk base though.
Any help anyone can give would be greatly appreciated.