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

Restrict FPS of specific player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mixtaz
Junior Member
Join Date: Sep 2017
Old 10-26-2023 , 04:25   Restrict FPS of specific player
Reply With Quote #1

Hello everyone. I have rather peculiar problem. There is a guy on my server who is playing on very high fps and he is doing something called SGS (stand-up ground strafing) and some sort of parachute shenaningans.

He is ruining experience for some of the players and I want to force limit his FPS to 100. I've made an attempt to make a plugin that stops him, but for some reason whenever he joins it also automatically kicks everyone whose fps is above 100.

But in this case he is the only threat actor here so I only care that he has 100 FPS max. Here is the code I've made:

PHP Code:
#include < amxmodx >

#define PLUGIN_VERSION "1.1"

#define TASK_FREQ 2.0 

#define isThreat(%1) equal(%1, g_szThreatActorSID)

new Trie:g_tCvars;

const 
g_iFpsMax 100;
const 
g_iFpsOverride 0;

new const 
g_szThreatActorSID[] = "STEAM_0:1:122354662";
new 
g_szAuthID32 ]

public 
plugin_cfg( )
{
    
g_tCvars TrieCreate( );

    new 
szFpsMax], szFpsOverride];
    
num_to_strg_iFpsMaxszFpsMaxcharsmaxszFpsMax ) );
    
num_to_strg_iFpsOverrideszFpsOverridecharsmaxszFpsOverride ) );
    
    
TrieSetStringg_tCvars"fps_max"szFpsMax );
    
TrieSetStringg_tCvars"fps_override"szFpsOverride );
    
    
set_taskTASK_FREQ"OnTaskCheckCvars"___"b" );
}

public 
plugin_init( )
{
    
register_plugin"Fps Limit"PLUGIN_VERSION"DoNii x Mixtaz" );
    
register_cvar"fps_limit_cvar"PLUGIN_VERSIONFCVAR_SERVER FCVAR_SPONLY );
}

public 
plugin_end( )
TrieDestroyg_tCvars );

public 
client_authorizedid )
{
    
get_user_authid(idg_szAuthIDcharsmax(g_szAuthID))

    if(
isThreat(g_szAuthID))
        
client_printidprint_console"Ustaw komendy fps_max 100 i fps_override 0!" );
}

public 
OnTaskCheckCvars( )
{
    new 
szPlayers32 ], iNum;
    
get_playersszPlayersiNum"c" );
    static 
iTempID;

    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];

        if(
isThreat(g_szAuthID))
        {
            
query_client_cvariTempID"fps_max""OnCvarResult" );
            
query_client_cvariTempID"fps_override""OnCvarResult" );
        }
    }
}

public 
OnCvarResultid, const szCvar[ ], const szValue[ ] )

    new 
szValueCheck], szReason128 ];
    
TrieGetStringg_tCvarsszCvarszValueCheckcharsmaxszValueCheck ) );
    
    new 
iValue str_to_numszValue );
    
    if( 
equalszCvar"fps_max" ) )
    {    
        if( 
iValue g_iFpsMax )
        {
            
formatexszReasoncharsmaxszReason ), "^n***************************^n** Ustaw komendy fps_max 100 i fps_override 0! ^n***************************"g_iFpsMax );
            
            
server_cmd"kick #%d"get_user_useridid ));
            
client_printidprint_consoleszReason );
        }
    }
    
    else if( 
equalszCvar"fps_override" ) )
    {
        if( 
iValue != g_iFpsOverride )
        {
            
formatexszReasoncharsmaxszReason ), "^n***************************^n** Ustaw komendy fps_max 100 i fps_override 0! <- **^n***************************"g_iFpsOverride );
            
            
server_cmd"kick #%d"get_user_useridid ));
            
client_printidprint_consoleszReason );
        }
    }
    return 
PLUGIN_CONTINUE;

Mixtaz is offline
 


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 23:54.


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