AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Custom FOV (https://forums.alliedmods.net/showthread.php?t=312232)

God Of Gaming 11-22-2018 09:37

Custom FOV
 
1 Attachment(s)
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.

E1_531G 11-22-2018 16:00

Re: Custom FOV
 
I see, you check if fov != 90 (default).
Enjoy the bug with weapons with the scope.

God Of Gaming 11-22-2018 16:56

Re: Custom FOV
 
What bug? Scopes seem to work just fine, and it goes back to the new fov after unscoping?

E1_531G 11-22-2018 18:02

Re: Custom FOV
 
OMG... I thought about it as a "true" condition. Nevermind. It's not good to look at the code when you are tired.

God Of Gaming 07-10-2022 17:53

Re: Custom FOV
 
1 Attachment(s)
Small update, blocking the ability to change FOV while zooming with a scoped weapon, as that could be used as a cheat

krudge137 07-28-2022 15:44

Re: Custom FOV
 
Quote:

Originally Posted by God Of Gaming (Post 2783491)
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 );


DJEarthQuake 07-29-2022 09:56

Re: Custom FOV
 
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 ( ); }

bigdaddy424 07-29-2022 23:27

Re: Custom FOV
 
cool


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

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