block cmds

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
Mero^
Membru, skill +1
Membru, skill +1
Posts: 132
Joined: 17 Dec 2017, 22:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: bromybro1
SteamID: bromybro1
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 3 times
Contact:

29 Sep 2021, 02:35

I'm looking for a plugin that blocks some admin commands in a specific time like at the night "11-9" at this time admins can't change the map for example
RoyalServer 2
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 917
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

29 Sep 2021, 16:38

this should work

Code: Select all

#include <amxmodx>
#include <amxmisc>

#pragma semicolon 1

new const g_szCommands[][] = 
{
    "amx_map",
    "amx_slay",
    "another_command"
};

new g_Cvar[2];

public plugin_init()
{
    register_plugin("Block admin commands", "1.0", "lexzor");

    for(new i = 0; i<sizeof(g_szCommands); i++)
        register_clcmd(g_szCommands[i], "block_commands", -1, "", -1);

    g_Cvar[0] = register_cvar("blockcmd_start", "20");
    g_Cvar[1] = register_cvar("blockcmd_end", "05");
}

public block_commands(id)
{
    new iHour;
    time(iHour, _, _);

    if ( iHour >= get_pcvar_num(g_Cvar[0]) || iHour < get_pcvar_num(g_Cvar[1]))
    {
        client_print(id, print_console, "[BLOCK COMMMAND] This command is blocked by server founder!");
        return PLUGIN_HANDLED;
    }

    return PLUGIN_CONTINUE;
}
cvar to set the start hour: blockcmd_start
end hour: blockcmd_end

you have just to put the commands here

Code: Select all

new const g_szCommands[][] = 
{
    "amx_map",
    "amx_slay",
    "another_command"
};
not tested, i don t know if it s working
Mero^
Membru, skill +1
Membru, skill +1
Posts: 132
Joined: 17 Dec 2017, 22:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: bromybro1
SteamID: bromybro1
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 3 times
Contact:

29 Sep 2021, 17:54

It works fine but can you add permissions
I mean, this plugin is applied to everyone except for have immunity
Mero^
Membru, skill +1
Membru, skill +1
Posts: 132
Joined: 17 Dec 2017, 22:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: bromybro1
SteamID: bromybro1
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 3 times
Contact:

29 Sep 2021, 20:08

Mero^ wrote:
29 Sep 2021, 17:54
It works fine but can you add permissions
I mean, this plugin is applied to everyone except for have immunity
i made it thanks :))
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 917
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

29 Sep 2021, 21:27

np, don t forget to put it above all plugins in plugins.ini
Mero^
Membru, skill +1
Membru, skill +1
Posts: 132
Joined: 17 Dec 2017, 22:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: bromybro1
SteamID: bromybro1
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 3 times
Contact:

30 Sep 2021, 03:17

lexz wrote:
29 Sep 2021, 21:27
np, don t forget to put it above all plugins in plugins.ini
lmao
It would be very nice if he do this idea in a plugin server_tasks
something like that "07:25" "amx_cmdisble" "amx_kick"
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 917
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

30 Sep 2021, 13:26

what do you exactly want ? a list with all disabled plugins ?
Mero^
Membru, skill +1
Membru, skill +1
Posts: 132
Joined: 17 Dec 2017, 22:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: bromybro1
SteamID: bromybro1
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 3 times
Contact:

30 Sep 2021, 16:39

lexz wrote:
30 Sep 2021, 13:26
what do you exactly want ? a list with all disabled plugins ?
nothing i'm okay :))
This was just a suggestion from me
You will control any cmd easily and you can set the time as you like in ini
"
ZackChoi
Membru, skill +1
Membru, skill +1
Posts: 162
Joined: 28 Dec 2019, 01:39
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Been thanked: 7 times

05 Oct 2021, 01:27

| Afiseaza codul
#include < amxmodx >
#include < amxmisc >

new Array: p_szSaveTime, Array: p_szCommands;
new p_szCount;

public plugin_precache()
{
	p_szSaveTime = ArrayCreate ( 8 );
	p_szCommands = ArrayCreate ( 512 );

	new p_szFile [ 256 ];
	get_configsdir ( p_szFile, charsmax ( p_szFile ) );
	add ( p_szFile, charsmax ( p_szFile ), "/server_cmds_block.ini" );

	new pointer_file = fopen ( p_szFile, "r" );

	if ( pointer_file )
	{
		new Line [ 512 ], Key [ 16 ], Value [ 512 ];

		while ( !feof ( pointer_file ) )
		{
			fgets ( pointer_file, Line, charsmax ( Line ) );

			trim ( Line );

			if ( Line [ 0 ] != '"' )
				continue;

			if ( parse ( Line, Key, charsmax ( Key ), Value, charsmax ( Value ) ) >= 2 )
			{
				ArrayPushString ( p_szSaveTime, Key );
				ArrayPushString ( p_szCommands, Value );

				server_print ( "PUSHING COMMAND ( %s @ %s )", Key, Value );
			}
		}

		fclose ( pointer_file );
	}

	p_szCount = ArraySize ( p_szSaveTime );
}

public plugin_init ( )
{
	new p_szData [ 64 ];

	for ( new i = 0; i < ArraySize ( p_szCommands ); i++ )
	{
		ArrayGetString ( p_szCommands, i, p_szData, charsmax ( p_szData ) );

		register_clcmd ( p_szData, "block_command" );
	}
}

public block_command ( id )
{
	new i, Time [ 8 ], NeedTime [ 8 ];
	get_time ( "%H:%M", Time, charsmax ( Time ) );

	for ( i = 0; i < p_szCount; i++ )
	{
		ArrayGetString ( p_szSaveTime, i, NeedTime, charsmax ( NeedTime ) )
		{
			if ( !equal ( Time, NeedTime ) )
			{
				console_print ( id, "Command blocked at this time - %s", Time );
				break;
			}
		}
	}
}
1. Create server_cmds_block.ini file in configs folder.
2. Add your commands after this example:

Code: Select all

"23:59" "amx_help"
Plugin is untested, but it should work fine.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests