Raised This Month: $32 Target: $400
 8% 

Issue with fov plugin by Dr.McKay


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
deville
AlliedModders Donor
Join Date: Oct 2016
Old 06-03-2017 , 08:45   Issue with fov plugin by Dr.McKay
#1

Hi! I recently added the Unrestricted FOV plugin by Dr.McKay to my CS:GO server where you can in an unrestricted way configure your FOV (not the same as viewmodel). In order to reset the FOV to it's standard value, you need to type !fov without a value. However, it doesn't seem to do so. The message is displayed but nothing happens. Could someone take a look? Thanks in advance!

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <easy_commands>

#undef REQUIRE_EXTENSIONS
#include <tf2>

#define PLUGIN_VERSION    "1.2.0"

public Plugin:myinfo = {
    
name        "[ANY] Unrestricted FOV",
    
author        "Dr. McKay",
    
description    "Allows players to choose their own FOV",
    
version        PLUGIN_VERSION,
    
url            "http://www.doctormckay.com"
};

new 
Handle:cookieFOV;
new 
Handle:cvarFOVMin;
new 
Handle:cvarFOVMax;

#define UPDATE_FILE        "unrestricted_fov.txt"
#define CONVAR_PREFIX    "ufov"
#include "mckayupdater.sp"

public OnPluginStart() {
    
cookieFOV RegClientCookie("unrestricted_fov""Client Desired FOV"CookieAccess_Private);
    
    
cvarFOVMin CreateConVar("ufov_min""20""Minimum FOV a client can set with the !fov command"_true20.0true180.0);
    
cvarFOVMax CreateConVar("ufov_max""130""Maximum FOV a client can set with the !fov command"_true20.0true180.0);
    
    
RegEasyConCmd("sm_fov <FOV>"Command_FOV, {Cmd_Cell}, 10);
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Command_FOV(clientfov) {
    if(!
AreClientCookiesCached(client)) {
        
ReplyToCommand(client"\x04[SM] \x01This command is currently unavailable. Please try again later.");
        return;
    }
    if(
fov == 0) {
        
QueryClientConVar(client"fov_desired"OnFOVQueried);
        
ReplyToCommand(client"\x04[SM] \x01Your FOV has been reset.");
        return;
    }
    if(
fov GetConVarInt(cvarFOVMin)) {
        
QueryClientConVar(client"fov_desired"OnFOVQueried);
        
ReplyToCommand(client"\x04[SM] \x01The minimum FOV you can set with !fov is %d."GetConVarInt(cvarFOVMin));
        return;
    }
    if(
fov GetConVarInt(cvarFOVMax)) {
        
QueryClientConVar(client"fov_desired"OnFOVQueried);
        
ReplyToCommand(client"\x04[SM] \x01The maximum FOV you can set with !fov is %d."GetConVarInt(cvarFOVMax));
        return;
    }
    
decl String:cookie[12];
    
IntToString(fovcookiesizeof(cookie));
    
SetClientCookie(clientcookieFOVcookie);
    
    
SetEntProp(clientProp_Send"m_iFOV"fov);
    
SetEntProp(clientProp_Send"m_iDefaultFOV"fov);
    
    
ReplyToCommand(client"\x04[SM] \x01Your FOV has been set to %d on this server."fov);
}

public 
Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) {
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
AreClientCookiesCached(client)) {
        return;
    }
    
    
decl String:cookie[12];
    
GetClientCookie(clientcookieFOVcookiesizeof(cookie));
    new 
fov StringToInt(cookie);
    if(
fov GetConVarInt(cvarFOVMin) || fov GetConVarInt(cvarFOVMax)) {
        return;
    }
    
SetEntProp(clientProp_Send"m_iFOV"fov);
    
SetEntProp(clientProp_Send"m_iDefaultFOV"fov);
}

public 
TF2_OnConditionAdded(clientTFCond:condition) {
    if(
condition != TFCond_TeleportedGlow) {
        return;
    }
    
decl String:cookie[12];
    
GetClientCookie(clientcookieFOVcookiesizeof(cookie));
    new 
fov StringToInt(cookie);
    if(
fov GetConVarInt(cvarFOVMin) || fov GetConVarInt(cvarFOVMax)) {
        return;
    }
    
SetEntProp(clientProp_Send"m_iFOV"fov);
    
SetEntProp(clientProp_Send"m_iDefaultFOV"fov);
}

public 
TF2_OnConditionRemoved(clientTFCond:condition) {
    if(
condition != TFCond_Zoomed) {
        return;
    }
    
decl String:cookie[12];
    
GetClientCookie(clientcookieFOVcookiesizeof(cookie));
    new 
fov StringToInt(cookie);
    if(
fov GetConVarInt(cvarFOVMin) || fov GetConVarInt(cvarFOVMax)) {
        return;
    }
    
SetEntProp(clientProp_Send"m_iFOV"fov);
    
SetEntProp(clientProp_Send"m_iDefaultFOV"fov);
}

public 
OnFOVQueried(QueryCookie:cookieclientConVarQueryResult:result, const String:cvarName[], const String:cvarValue[]) {
    if(
result != ConVarQuery_Okay) {
        return;
    }
    
SetClientCookie(clientcookieFOV"");
    
SetEntProp(clientProp_Send"m_iFOV"StringToInt(cvarValue));
    
SetEntProp(clientProp_Send"m_iDefaultFOV"StringToInt(cvarValue));

deville is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 06-03-2017 , 09:29   Re: Issue with fov plugin by Dr.McKay
#2

Why not ask in the plugin's thread?
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
deville
AlliedModders Donor
Join Date: Oct 2016
Old 06-03-2017 , 14:21   Re: Issue with fov plugin by Dr.McKay
#3

Quote:
Originally Posted by KissLick View Post
Why not ask in the plugin's thread?
I did! Still waiting for a reply. Thought I'd post here as well as in my understanding this section is used for scripting help etc.
deville is offline
Closed Thread


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 22:13.


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