AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Can anyone rearrange this plugin (https://forums.alliedmods.net/showthread.php?t=332147)

kkkivi 04-25-2021 15:22

Can anyone rearrange this plugin
 
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 }
*/


iceeedr 04-26-2021 00:22

Re: Can anyone rearrange this plugin
 
Quote:

Originally Posted by kkkivi (Post 2745095)
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 }
*/


no steam = no help

kkkivi 04-26-2021 12:27

Re: Can anyone rearrange this plugin
 
Quote:

Originally Posted by iceeedr (Post 2745122)
no steam = no help

i want to prevent non steam players doing this. This plugin wont be any benefit to non steams unlike it will unbenefit. So whats wrong?

Mordekay 04-26-2021 12:31

Re: Can anyone rearrange this plugin
 
Wrong is, that you allow non-steam users to join your server.
You want us to help you to restrict something that steamers cannot do. (really? I'm sure you cannot change my fps-settings)
Get them to buy the game and your problem is solved by itself. (or not, I didn't check that.)
And BTW. Changing clients settings is called slow hacking, which is also not supported here.
If you don't like their settings: kick them.

iceeedr 04-26-2021 14:13

Re: Can anyone rearrange this plugin
 
Quote:

Originally Posted by kkkivi (Post 2745141)
i want to prevent non steam players doing this. This plugin wont be any benefit to non steams unlike it will unbenefit. So whats wrong?

You clearly did not read the forum rules!


All times are GMT -4. The time now is 19:58.

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