View Single Post
Author Message
kkkivi
New Member
Join Date: Mar 2021
Old 04-25-2021 , 15:22   Can anyone rearrange this plugin
Reply With Quote #1

Guys this plugin allows me to make a fps limit on my server. But players (especially non-steam) can easily get over this plugin with typing in console developer 1 and fps_modem.. Can anyone disable this commands on my server? Pls help me thank you
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
 
#define PLUGIN "[AMXX] - FPS MAX"
#define VERSION "1.0"
#define AUTHOR "Nill_"
 
new Trie:g_tCvars;
 
const g_iFpsMax = x; // Sets The FPS Limit.

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
}

public plugin_cfg()
{
    g_tCvars = TrieCreate();
 
    new szFpsMax[3];
    num_to_str(g_iFpsMax, szFpsMax, charsmax(szFpsMax));
   
    TrieSetString(g_tCvars, "fps_max", szFpsMax);
   
    set_task(0.8, "OnTaskCheckCvars", _, _, _, "b");
}

public plugin_end()
{
	TrieDestroy(g_tCvars);
}

public client_putinserver(id)
{
    if(!is_user_bot(id))
    client_cmd( id, "fps_max %d", g_iFpsMax);
}

public OnTaskCheckCvars()
{
    new szPlayers[ 32 ], iNum;
    get_players(szPlayers, iNum, "c");
 
    static iTempID;
 
    for(new i; i < iNum; i++)
    {
        iTempID = szPlayers[i];
       
        query_client_cvar(iTempID, "fps_max", "OnCvarResult");
    }
}

public OnCvarResult(id, const szCvar[], const szValue[])
{
    new szValueCheck[4], szReason[128];
    TrieGetString( g_tCvars, szCvar, szValueCheck, charsmax(szValueCheck));
   
    new iValue = str_to_num(szValue);
   
    if(equal(szCvar, "fps_max"))
    {    
        if(iValue > g_iFpsMax)
        {
            formatex( szReason, charsmax(szReason), "FPS ABOVE THE ALLOWED LIMIT.");
           
            server_cmd( "kick #%d YOU ARE USING MORE THAN 101 FPS.", get_user_userid(id));
            client_print( id, print_console, szReason);
        }
    }
    return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
*/
kkkivi is offline