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

check prefix of fps_max or any other command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Meelo
Member
Join Date: Aug 2010
Old 04-03-2021 , 16:54   check prefix of fps_max or any other command
Reply With Quote #1

Hey like 2 months ago you helped me with the fps_max checking but now some players found another way to increase their fps using third-party programms/cheats which uses prefixes

So i use this code from: https://forums.alliedmods.net/showthread.php?t=330652
but also i need to check if player type in console any prefix like: xxxfps_max "value" ks12_fps_max "value" because as far i know the command always ends at fps_max so everything before it is a cheat command

PHP Code:
public fpsid , const cvar[] , const value[] )
{
    new 
iCount bool:bInvalid;
    new 
iLen strlenvalue );
    
    for ( new 
iLen i++ )
    {
        if ( 
value] == '.' )
        {
            if ( ++
iCount )
            {
                
bInvalid true;
                break;
            }
        }
    }
    
    if ( 
bInvalid || ( str_to_floatvalue ) > 99.5 ) )
{
    if ( 
bInvalid )
        
client_printid print_chat "* Please fix your fps_max value, %s is formatted incorrectly." value );
    else
        
client_printid print_chat "* Please lower your fps_max value less than or equal to 95.5" );
        
    
user_killid );    

Meelo is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 04-03-2021 , 21:23   Re: check prefix of fps_max or any other command
Reply With Quote #2

Spoiler
__________________

Last edited by DJEarthQuake; 04-08-2021 at 16:44.
DJEarthQuake is offline
Meelo
Member
Join Date: Aug 2010
Old 04-04-2021 , 11:09   Re: check prefix of fps_max or any other command
Reply With Quote #3

But code i put here is kinda better, Bugsy helped me with it

i need to check if someone type fps_max with any prefix in console
Meelo is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-04-2021 , 15:37   Re: check prefix of fps_max or any other command
Reply With Quote #4

Are you sure their external cmds are possible to hook in .sma? They have option to print their value of fps_max as 99.5 but they are obviously using more fps ingame
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Meelo
Member
Join Date: Aug 2010
Old 04-04-2021 , 19:37   Re: check prefix of fps_max or any other command
Reply With Quote #5

I'm sure that you can't check their external commands values, but it's possible to check if someone type in console any text or any command even if it's not the cs command. There are some anticheats which are checking cheats commands, the problem is when people can make their own prefixes.

but as i said as far i know what cheat some ppl use on my server they can make their own prefix but can't change the whole command so every prefix before fps_max even if it's one char like ffps_max/4fps_max is illegal

that's why i need to know how to check if someone write command (especially fps_max) with prefix
Meelo is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 04-04-2021 , 20:00   Re: check prefix of fps_max or any other command
Reply With Quote #6

Code:
#include < amxmodx >
#include < amxmisc >

public client_command ( iEntity ) {
	if ( is_user_connected ( iEntity ) && !is_user_bot ( iEntity ) ) {
		if ( is_user_admin ( iEntity ) )	return PLUGIN_HANDLED;

		new szCommandString [ 32 ];
		read_argv ( 1, szCommandString, charsmax ( szCommandString ) );
		
		if ( containi ( szCommandString, "fps" ) != -1 ) {
			is_user_alive ( iEntity ) ? user_silentkill ( iEntity ) : client_print ( iEntity, print_console, "You can't modify fps_max value" );
			return PLUGIN_CONTINUE;
		}
	}

	return PLUGIN_CONTINUE;
}
you can try this way
__________________
LondoN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-04-2021 , 20:12   Re: check prefix of fps_max or any other command
Reply With Quote #7

The ternary operator is not intended to be used that way and it makes your code hard to read. Please stop trying to be "fancy" with your code and use normal if/else statements and add a new line even if the "then" part is only a single line. Especially in Scripting Help.
__________________

Last edited by fysiks; 04-04-2021 at 20:20.
fysiks is offline
Meelo
Member
Join Date: Aug 2010
Old 04-07-2021 , 08:10   Re: check prefix of fps_max or any other command
Reply With Quote #8

Quote:
Originally Posted by LondoN View Post
Code:
#include < amxmodx >
#include < amxmisc >

public client_command ( iEntity ) {
	if ( is_user_connected ( iEntity ) && !is_user_bot ( iEntity ) ) {
		if ( is_user_admin ( iEntity ) )	return PLUGIN_HANDLED;

		new szCommandString [ 32 ];
		read_argv ( 1, szCommandString, charsmax ( szCommandString ) );
		
		if ( containi ( szCommandString, "fps" ) != -1 ) {
			is_user_alive ( iEntity ) ? user_silentkill ( iEntity ) : client_print ( iEntity, print_console, "You can't modify fps_max value" );
			return PLUGIN_CONTINUE;
		}
	}

	return PLUGIN_CONTINUE;
}
you can try this way

I didn't test it but i think it will catch everyone who type any command with "fps" in it's name so it can't work this way

Maybe make an exclude for fps_max only? I don't want to block legal commands for people.

Last edited by Meelo; 04-07-2021 at 08:17. Reason: idea
Meelo is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-07-2021 , 08:15   Re: check prefix of fps_max or any other command
Reply With Quote #9

parse it, check if first arg is equal to 'name' and continue..
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Meelo
Member
Join Date: Aug 2010
Old 04-07-2021 , 08:59   Re: check prefix of fps_max or any other command
Reply With Quote #10

ANyway, LondoN's code isn't working;/
Meelo is offline
Reply


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 16:18.


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