Raised This Month: $51 Target: $400
 12% 

sm_weaponzoom


Post New Thread Reply   
 
Thread Tools Display Modes
Author
foo bar
AlliedModders Donor
Join Date: Dec 2012
Location: Canada
Plugin ID:
3967
Plugin Version:
1.6c
Plugin Category:
Gameplay
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    22 
    Plugin Description:
    Weaponzoom for HL2:DM (and possibly others)
    Old 11-11-2013 , 20:03   sm_weaponzoom
    Reply With Quote #1

    Weapon Zoom Sourcemod plugin for HL2 Death Match and possibly others (untested) by [foo] bar.

    This plugin adds enhanced zoom to weapons by changing the FOV of the player when a player uses secondary attack (ATTACK2) on a configured weapon, or through bound console commands. By default the plugin adds zoom to weapon_357, but can be added to other weapons that don't have an attack2 mode.

    I have some changes in the works, but I'd love to hear feedback on how I can improve this plugin. It's coming up to my first year of Sourcemod coding and learning how to do things more effectively is important to me. Constructive criticism is appreciated.

    To reduce zoom, a player can hold down their "walk" (alt) key while pressing ATTACK2.

    Zoom is automatically turned off if toggle_zoom or suit zoom is turned on (for quick release).

    The plugin also registers three console commands: weaponzoom_in, weaponzoom_out, and weaponzoom_unzoom. This is particularly useful for binding mwheelup and mwheeldown to zoom in and out, and an extra mouse button unzoom completely.

    Example:

    Code:
    bind mwheelup weaponzoom_in
    bind mwheeldown weaponzoom_out
    bind mouse5 weaponzoom_unzoom
    The plugin also supports an "ICU" sound, played to a player who's being zoomed in on. This is fun for causing a bit of panic on players, especially in large sniper maps.

    Installation
    1. Upload plugins/sm_weaponzoom.smx into addons/sourcemod/plugins
    2. Upload translations/sm_weaponzoom.phrases.txt into addons/sourcemod/translations
    3. Upload html/sm_weaponzoom.html to a web server and set sm_weaponzoom_helpurl to that web address (see below)
    4. Load plugin using sm plugins load sm_weaponzoom
    5. If required, tweak cfg/sourcemod/plugin.sm_weaponzoom.cfg ; Reload using "sm plugins reload sm_weaponzoom" from srcds console.

    Configuration

    On first load the plugin will generate cfg/sourcemod/plugin.sm_weaponzoom.cfg with default settings.

    Here's a brief list of cvar's and what they do:

    Code:
     sm_weaponzoom_weapons        List of weapons to work on.  ie: "weapon_357 weapon_pistol" etc. 
     sm_weaponzoom_helpurl        Web address for in-game help.  Set to nothing ("") to disable.
     sm_weaponzoom_cmdallzoom     1: allow weaponzoom_in and weaponzoom_out on all weapons. (default)
                                  0: limited to weapons specified by sm_weapon_commands 
     sm_weaponzoom_icusound           Sound to play to a player being zoomed in on (useful for teasing 
                                  players on large maps) 
     sm_weaponzoom_icusound_mintime   Minimum number of seconds between targetted player hearing a 
                                  sound from a stalking player
    Out of box the zoom settings should be suitable for most servers. If you want tweak them, adjust the following cvar's to suite:

    Code:
     sm_weaponzoom_zoommax        Maximum zoom levels (1-9) 
     sm_weaponzoom_zoomstart          Starting "zoom" (FOV).  High = less zoom, low = high zoom.   
                                  Range is 1-89.  35 or 40 is a good starting point. 
     sm_weaponzoom_zoomincrement      Increment to take away from the FOV to increase zoom
    Note: Perhaps counter-intuitively, the FOV is negated by sm_weapon_zoomincrement for each zoom increment performed by the player. If the FOV hits 0, the plugin unzooms the player (otherwise wierdness occurs).

    In-game commands

    Player settings can be accessed either through the chat command: !settings (if you have this enabled) or !weaponzoom.

    Players can:
    • Turn it off completely
    • Set their own maximum zoom (up to the maximum set by sm_weaponzoom_maxzoom)
    • Disable attack2 (alt-fire) zooming (ie: if they only want to use the console commands through bindings instead)
    • Turn off hearing ICU
    • View in-game help
    • In-game help

    An html helpfile is included for you to display in-game help via !weaponzoom. (Download the zip for the html help file, it is not included in this post).

    Upload it to your fast download site, web server, or whatever, and set sm_weaponzoom_helpurl to the correct web address.

    By default the web address is set to a web server under the author's control but you are encouraged to host it yourself lest the in-game help is updated to a newer but incompatible version, or suddenly just stops working down the road.

    Future changes TODO list

    At the moment there's a couple of changes I plan on implementing in a future release:
    • Losing the increment level and zoom level calculations in favour of an explicit list of zoom levels (fov) set by the sysop
    • Changing the player configuring for "max zoom" to allowing a player to set which zoom levels they want.

    Credits

    Many thanks to Outlaw for prompting me to code this, and to Nyarlathotep, jono, Boogyman and anyone I forgot to mention for testing and suggesting feature improvements.

    Donations

    If you enjoy this plugin please take a moment to donate! I happily accept donations!
    • Purchases of games on my wishlist
    • Paypal (contact me directly if you want to do this)

    Thanks, I hope you enjoy this plugin. And have fun sniping!

    [foo] bar
    Attached Files
    File Type: zip sm_weaponzoom-1.6c.zip (36.6 KB, 517 views)
    File Type: sp Get Plugin or Get Source (sm_weaponzoom.sp - 1272 views - 20.9 KB)
    File Type: txt sm_weaponzoom.phrases.txt (434 Bytes, 588 views)
    __________________
    [foo] bar
    foo-games.com Game Mods, Plugins and Tools for Game Masters | My Github

    Last edited by foo bar; 10-12-2020 at 18:49. Reason: changing source control
    foo bar is offline
    belgvr
    Member
    Join Date: Dec 2008
    Location: Brazil
    Old 04-04-2020 , 23:57   Re: sm_weaponzoom
    Reply With Quote #2

    Excellent work... love it.
    But here goes a suggestion in case you still plan to improve it: you should remove the crossbow's original zoom and have it replaced by this one.
    Actually it does work via sm_weaponzoom_weapons "weapon_crossbow" but it gets glitchy and conflicts with the original zoom.
    belgvr is offline
    foo bar
    AlliedModders Donor
    Join Date: Dec 2012
    Location: Canada
    Old 10-12-2020 , 18:50   Re: sm_weaponzoom
    Reply With Quote #3

    Quote:
    Originally Posted by belgvr View Post
    Excellent work... love it.
    But here goes a suggestion in case you still plan to improve it: you should remove the crossbow's original zoom and have it replaced by this one.
    Actually it does work via sm_weaponzoom_weapons "weapon_crossbow" but it gets glitchy and conflicts with the original zoom.
    Thanks! I'll look into this more.
    __________________
    [foo] bar
    foo-games.com Game Mods, Plugins and Tools for Game Masters | My Github

    Last edited by foo bar; 10-12-2020 at 18:59.
    foo bar is offline
    jmcpit
    Junior Member
    Join Date: Sep 2015
    Location: Zurich, Switzerland
    Old 09-25-2022 , 09:25   Re: sm_weaponzoom
    Reply With Quote #4

    Hi

    How do you have to make the configuration if you want to have 2 weapons with the zoom? Or is that not possible?
    jmcpit is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 06:10.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode