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

Custom FOV


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
God Of Gaming
Junior Member
Join Date: Feb 2013
Location: Bulgaria
Old 11-22-2018 , 09:37   Custom FOV
Reply With Quote #1

Just a quick and simple plugin to allow clients to change their FOV. I couldn't find another so I made my own. CS has FOV locked to 90 by default, which is not ideal for modern monitors, especially since the GoldSrc engine is Vert-. Plugin is for CS, but should work in other mods, or should be easy to adapt to work.

To use, open console and type fov 105 which would be good for most modern monitors, or whatever value you wish between 90 and 180. You have to do that after each map change, so it might be best to bind it to a key like bind p "fov 105" for easy access.

Code is based on this plugin from ConnorMcLeod : default_fov . What I changed was to make it possible for each client to set his FOV individually, the original plugin had it as a global server-side setting, which didn't take into account that different players have different monitors.
Attached Files
File Type: sma Get Plugin or Get Source (default_fov.sma - 1296 views - 1.3 KB)
__________________
God Of Gaming is offline
Send a message via Skype™ to God Of Gaming
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-22-2018 , 16:00   Re: Custom FOV
Reply With Quote #2

I see, you check if fov != 90 (default).
Enjoy the bug with weapons with the scope.
__________________
My English is A0
E1_531G is offline
God Of Gaming
Junior Member
Join Date: Feb 2013
Location: Bulgaria
Old 11-22-2018 , 16:56   Re: Custom FOV
Reply With Quote #3

What bug? Scopes seem to work just fine, and it goes back to the new fov after unscoping?
__________________
God Of Gaming is offline
Send a message via Skype™ to God Of Gaming
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-22-2018 , 18:02   Re: Custom FOV
Reply With Quote #4

OMG... I thought about it as a "true" condition. Nevermind. It's not good to look at the code when you are tired.
__________________
My English is A0
E1_531G is offline
God Of Gaming
Junior Member
Join Date: Feb 2013
Location: Bulgaria
Old 07-10-2022 , 17:53   Re: Custom FOV
Reply With Quote #5

Small update, blocking the ability to change FOV while zooming with a scoped weapon, as that could be used as a cheat
Attached Files
File Type: sma Get Plugin or Get Source (default_fov.sma - 245 views - 1.4 KB)
__________________
God Of Gaming is offline
Send a message via Skype™ to God Of Gaming
krudge137
Junior Member
Join Date: Jun 2022
Old 07-28-2022 , 15:44   Re: Custom FOV
Reply With Quote #6

Quote:
Originally Posted by God Of Gaming View Post
Small update, blocking the ability to change FOV while zooming with a scoped weapon, as that could be used as a cheat
Is it possible to make this plugin work with "say /fov", instead of typing it in console?

I want something like this :

Code:
public plugin_init() {
	register_plugin( PLUGIN, VERSION, AUTHOR );

	for( new i=0; i<32; i++)
		customFOV[ i ] = CS_DEFAULT_FOV;

	register_clcmd( "say /fov", "userFOV", 0, "changes default_fov" );
	
	register_message( get_user_msgid( "SetFOV" ), "Message_SetFOV" );
	RegisterHam( Ham_Spawn, "player", "OnCBasePlayer_Spawn_P", true );
krudge137 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-29-2022 , 09:56   Re: Custom FOV
Reply With Quote #7

I looked at the code. Here is code I made about half a decade ago. Welcome to it.
Code:
#include amxmodx #include amxmisc #define MAX_PLAYERS 32 new g_szMsgSetFov new g_iArg1[4]; public plugin_init ( ) {     register_plugin ( "Field Of View", "0.1", "spinx" )     register_clcmd ( "set_fov", "Command_SetFov", ADMIN_SLAY, "<name or #userid> <#>" )     g_szMsgSetFov = get_user_msgid ( "SetFOV" ) } public Command_SetFov ( id, level, cid ) {     if ( !cmd_access ( id, level, cid, 3 ) )         return PLUGIN_HANDLED     new szNick [ MAX_PLAYERS ]     read_argv ( 1, szNick, sizeof ( szNick ) - 1 )     read_argv ( 2, g_iArg1, charsmax(g_iArg1) )     new iPlayer = cmd_target ( id, szNick, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF )     if ( !iPlayer )         return PLUGIN_HANDLED     set_fov ( iPlayer, str_to_num(g_iArg1) )     return PLUGIN_CONTINUE; } set_fov ( iClient, iValue ) {     emessage_begin ( MSG_ONE_UNRELIABLE, g_szMsgSetFov, _, iClient );     ewrite_byte ( iValue );     emessage_end ( ); }
__________________
DJEarthQuake is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 07-29-2022 , 23:27   Re: Custom FOV
Reply With Quote #8

cool
__________________
bigdaddy424 is offline
Reply


Thread Tools
Display Modes

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 18:55.


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