Modify No-Console (Solved)

Coding Help/Re-API Supported
User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

Modify No-Console (Solved)

#1

Post by ArminC » 6 years ago

Hi! I got the No-Console plugin and I want to change it, with your help, of course :)

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <reapi>

new const g_szBinds[][] =
{
	"bind ^"TAB^" ^"+showscores^"",
	"bind ^"ENTER^" ^"+attack^"",
	"bind ^"ESCAPE^" ^"cancelselect^"",
	"bind ^"SPACE^" ^"+jump^"",
	"bind ^"'^" ^"+moveup^"",
	"bind ^"+^" ^"sizeup^"",
	"bind ^",^" ^"buyammo1^"",
	"bind ^"-^" ^"sizedown^"",
	"bind ^".^" ^"buyammo2^"",
	"bind ^"/^" ^"+movedown^"",
	"bind ^"0^" ^"slot10^"",
	"bind ^"1^" ^"slot1^"",
	"bind ^"2^" ^"slot2^"",
	"bind ^"3^" ^"slot3^"",
	"bind ^"4^" ^"slot4^"",
	"bind ^"5^" ^"slot5^"",
	"bind ^"6^" ^"slot6^"",
	"bind ^"7^" ^"slot7^"",
	"bind ^"8^" ^"slot8^"",
	"bind ^"9^" ^"slot9^"",
	"bind ^";^" ^"+mlook^"",
	"bind ^"=^" ^"sizeup^"",
	"bind ^"[^" ^"invprev^"",
	"bind ^"]^" ^"invnext^"",
	"bind ^"`^" ^"toggleconsole^"",
	"bind ^"a^" ^"+moveleft^"",
	"bind ^"b^" ^"buy^"",
	"bind ^"c^" ^"radio3^"",
	"bind ^"d^" ^"+moveright^"",
	"bind ^"e^" ^"+use^"",
	"bind ^"f^" ^"impulse 100^"",
	"bind ^"g^" ^"drop^"",
	"bind ^"h^" ^"+commandmenu^"",
	"bind ^"j^" ^"cheer^"",
	"bind ^"k^" ^"+voicerecord^"",
	"bind ^"l^" ^"showbriefing^"",
	"bind ^"m^" ^"chooseteam^"",
	"bind ^"n^" ^"nightvision^"",
	"bind ^"o^" ^"buyequip^"",
	"bind ^"q^" ^"lastinv^"",
	"bind ^"r^" ^"+reload^"",
	"bind ^"s^" ^"+back^"",
	"bind ^"t^" ^"impulse 201^"",
	"bind ^"u^" ^"messagemode2^"",
	"bind ^"v^" ^"+moveup^"",
	"bind ^"w^" ^"+forward^"",
	"bind ^"x^" ^"radio2^"",
	"bind ^"y^" ^"messagemode^"",
	"bind ^"z^" ^"radio1^"",
	"bind ^"~^" ^"toggleconsole^"",
	"bind ^"UPARROW^" ^"+forward^"",
	"bind ^"DOWNARROW^" ^"+back^"",
	"bind ^"LEFTARROW^" ^"+left^"",
	"bind ^"RIGHTARROW^" ^"+right^"",
	"bind ^"ALT^" ^"+strafe^"",
	"bind ^"CTRL^" ^"+duck^"",
	"bind ^"SHIFT^" ^"+speed^"",
	"bind ^"F1^" ^"autobuy^"",
	"bind ^"F2^" ^"rebuy^"",
	"bind ^"F5^" ^"snapshot^"",
	"bind ^"F6^" ^"save quick^"",
	"bind ^"F7^" ^"load quick^"",
	"bind ^"F10^" ^"quit prompt^"",
	"bind ^"INS^" ^"+klook^"",
	"bind ^"PGDN^" ^"+lookdown^"",
	"bind ^"PGUP^" ^"+lookup^"",
	"bind ^"END^" ^"centerview^"",
	"bind ^"MWHEELDOWN^" ^"invnext^"",
	"bind ^"MWHEELUP^" ^"invprev^"",
	"bind ^"MOUSE1^" ^"+attack^"",
	"bind ^"MOUSE2^" ^"+attack2^"",
	"bind ^"PAUSE^" ^"pause^""
}

new g_pCvarAllowAdmins

public plugin_init()
{
	register_plugin("No Console", "1.0", "Raheem")

	// HookChains
	RegisterHookChain(RG_CBasePlayer_PreThink, "Fw_PreThink_Pre", 0)

	// Pointer Cvars
	g_pCvarAllowAdmins = register_cvar("block_admin_console", "0")
}

public client_authorized(id)
{
	if (get_pcvar_num(g_pCvarAllowAdmins) == 0 && is_user_admin(id))
		return
	
	Send_Cmd(id, "unbindall")

	for (new i = 0; i <= charsmax(g_szBinds); i++)
	{
		Send_Cmd(id, g_szBinds[i])
	}
}

public Fw_PreThink_Pre(id)
{
	if (get_pcvar_num(g_pCvarAllowAdmins) == 0 && is_user_admin(id))
		return

	if (is_user_connected(id))
	{
		Send_Cmd(id, "hideconsole")
	}
}

stock Send_Cmd(id, szText[])
{
	message_begin(MSG_ONE, SVC_DIRECTOR, {0, 0, 0}, id)
	write_byte(strlen(szText) + 2)
	write_byte(10)
	write_string(szText)
	message_end()
}
So first of all can someone explain me how it works? When the player connect, it give every command/binds set in the first lines [gzBinds] (to admin and players too) [that are the default binds], then depending on the cvar it hide the console or not (for a member & member+admin) I don't exactly know how it works in order to plan my request..

First.. I want to change it in order that when the cvar is 1 to hide to everyone the console and if it is 0 to don't hide console and if the cvar is 2 to apply only to non-admins

Second.. if want a second cvar that if it is 1 to apply every command I set and it if is 0 to stop binding the players (this I consider as the seconds list, custom commmands) -- this list to apply after default list (see Third) !!
My commands that want to apply:

Code: Select all

bind "v" "+setlaser
bind "c" "+dellaser
etc..
-- but this I want to be separate from default binds list (gzBinds) -- this I want like a custom list, 2 list with defaults and custom =>>

Third.. A third cvar that if it is 1 at enter, it give the players any command/bind set in list 1 (wich I consider it as default binds)

Thanks.. I hope I don't "freeze" your brain with my hard/bad explanation :lol:
PS: I come here after some unsucesfull request on other forum.. (from my country).. (It was deleted :? )
Last edited by ArminC 6 years ago, edited 1 time in total.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#2

Post by ArminC » 6 years ago

Anyone?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#3

Post by Raheem » 6 years ago

HEY, Welcome to your second home :D.

First i explain you how this plugin works.

1. Why i think to code something like that?
  • Because someone requested it here. Basically he was need to block exec command in console which can't be blocked at all as server never know that user used this command. status command can be detected by server but exec can not. So i think to do something evil... TO block console at all.
2. How it's working?
  • It's idea simply based on hiding console. So my code will always send to player this command: hideconsole this command hide console so if player try to open his console while he in your server it will be closed very fast before even he see it. What if player binds one of his key before he enter your server like:
    bind b "exec anything.cfg"? And when he enter your server he pressed b??? So he do it without opening console... So here come idea to when player connecting to my server i unbind all his keys and bind it again to default values. I don't unbind and hide admin console as he admin so he will never abuse these commands.
3. It's Slow hacking???
  • In fact yes it's slow hacking but useful slow hacking that not harm client much. This aims only to give power for server owners.. Server owner is the boss who decide who open his console and who not.
OK that's it and now try ReExplain as i don't understand most of your request :lol:
Explain with examples so i can understand better.
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#4

Post by ArminC » 6 years ago

Ok. Let's re explain :)

So I have that plugin on the server.

- When the player connect on the server it will be given the default binds from the gzBinds, let's name it Default List (nr1)
Here I want a cvar that if it is set on "0" it won't exec the binds/commands from gzBinds on the player at connect; if "1" exec the commands on the players; if "2" exec only on the non-admins

- After that I wana place some commands/binds of my own (not default one! like bind v +Setlaser) on the player (AFTER STEP 1, NOT BEFORE, Like I want to replace default binds set before with custom one), thus here I want a separate list like gzBinds2, let's name it Custom List (nr2) -- I want 2 list because first I want for the player to have a default bind list then apply some usefull commands

- I want to change the hideconsole cvar from apply to all and ignore the admins (1 & 0)
Like value "0" don't hide at all (for anyone), "1" hide for all players, "2" hide for non-admins

It's more clear? :)

PS: That code it's working anymore, will it be pateched, do you know anything :) ? Did appear until now any better exploits?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 6 years ago

OK. I do this update so i consider version is 1.1 now.

Cvars:
  • block_admin_console 2 Who to block him from using console inside your server? 0 = Allow all | 1 = Block all | 2 = Allow admins only
  • bind_default_binds Apply default binds at? 0 = No one | 1 = All players | 2 = All players but not admins
  • bind_useful_binds Apply useful binds at? 0 = No one | 1 = All players | 2 = All players but not admins
-NOTE: You can add more useful binds as you need in:
    1. new const g_szUsefulBinds[][] =
    2. {
    3.     "bind ^"v^" ^"+setlaser^"",
    4.     "bind ^"c^" ^"+dellaser^""
    5. }
Code:
  • Code: Select all

    #include <amxmodx>
    #include <amxmisc>
    #include <reapi>
    
    new const g_szDefaultBinds[][] =
    {
    	"bind ^"TAB^" ^"+showscores^"",
    	"bind ^"ENTER^" ^"+attack^"",
    	"bind ^"ESCAPE^" ^"cancelselect^"",
    	"bind ^"SPACE^" ^"+jump^"",
    	"bind ^"'^" ^"+moveup^"",
    	"bind ^"+^" ^"sizeup^"",
    	"bind ^",^" ^"buyammo1^"",
    	"bind ^"-^" ^"sizedown^"",
    	"bind ^".^" ^"buyammo2^"",
    	"bind ^"/^" ^"+movedown^"",
    	"bind ^"0^" ^"slot10^"",
    	"bind ^"1^" ^"slot1^"",
    	"bind ^"2^" ^"slot2^"",
    	"bind ^"3^" ^"slot3^"",
    	"bind ^"4^" ^"slot4^"",
    	"bind ^"5^" ^"slot5^"",
    	"bind ^"6^" ^"slot6^"",
    	"bind ^"7^" ^"slot7^"",
    	"bind ^"8^" ^"slot8^"",
    	"bind ^"9^" ^"slot9^"",
    	"bind ^";^" ^"+mlook^"",
    	"bind ^"=^" ^"sizeup^"",
    	"bind ^"[^" ^"invprev^"",
    	"bind ^"]^" ^"invnext^"",
    	"bind ^"`^" ^"toggleconsole^"",
    	"bind ^"a^" ^"+moveleft^"",
    	"bind ^"b^" ^"buy^"",
    	"bind ^"c^" ^"radio3^"",
    	"bind ^"d^" ^"+moveright^"",
    	"bind ^"e^" ^"+use^"",
    	"bind ^"f^" ^"impulse 100^"",
    	"bind ^"g^" ^"drop^"",
    	"bind ^"h^" ^"+commandmenu^"",
    	"bind ^"j^" ^"cheer^"",
    	"bind ^"k^" ^"+voicerecord^"",
    	"bind ^"l^" ^"showbriefing^"",
    	"bind ^"m^" ^"chooseteam^"",
    	"bind ^"n^" ^"nightvision^"",
    	"bind ^"o^" ^"buyequip^"",
    	"bind ^"q^" ^"lastinv^"",
    	"bind ^"r^" ^"+reload^"",
    	"bind ^"s^" ^"+back^"",
    	"bind ^"t^" ^"impulse 201^"",
    	"bind ^"u^" ^"messagemode2^"",
    	"bind ^"v^" ^"+moveup^"",
    	"bind ^"w^" ^"+forward^"",
    	"bind ^"x^" ^"radio2^"",
    	"bind ^"y^" ^"messagemode^"",
    	"bind ^"z^" ^"radio1^"",
    	"bind ^"~^" ^"toggleconsole^"",
    	"bind ^"UPARROW^" ^"+forward^"",
    	"bind ^"DOWNARROW^" ^"+back^"",
    	"bind ^"LEFTARROW^" ^"+left^"",
    	"bind ^"RIGHTARROW^" ^"+right^"",
    	"bind ^"ALT^" ^"+strafe^"",
    	"bind ^"CTRL^" ^"+duck^"",
    	"bind ^"SHIFT^" ^"+speed^"",
    	"bind ^"F1^" ^"autobuy^"",
    	"bind ^"F2^" ^"rebuy^"",
    	"bind ^"F5^" ^"snapshot^"",
    	"bind ^"F6^" ^"save quick^"",
    	"bind ^"F7^" ^"load quick^"",
    	"bind ^"F10^" ^"quit prompt^"",
    	"bind ^"INS^" ^"+klook^"",
    	"bind ^"PGDN^" ^"+lookdown^"",
    	"bind ^"PGUP^" ^"+lookup^"",
    	"bind ^"END^" ^"centerview^"",
    	"bind ^"MWHEELDOWN^" ^"invnext^"",
    	"bind ^"MWHEELUP^" ^"invprev^"",
    	"bind ^"MOUSE1^" ^"+attack^"",
    	"bind ^"MOUSE2^" ^"+attack2^"",
    	"bind ^"PAUSE^" ^"pause^""
    }
    
    new const g_szUsefulBinds[][] =
    {
    	"bind ^"v^" ^"+setlaser^"",
    	"bind ^"c^" ^"+dellaser^""
    }
    
    new g_pCvarAllowAdmins, g_pDefaultBinds, g_pUsefulBinds
    
    public plugin_init()
    {
    	register_plugin("No Console", "1.1", "Raheem")
    
    	// HookChains
    	RegisterHookChain(RG_CBasePlayer_PreThink, "Fw_PreThink_Pre", 0)
    
    	// Pointer Cvars
    	g_pCvarAllowAdmins = register_cvar("block_admin_console", "2")
    	g_pDefaultBinds = register_cvar("bind_default_binds", "2")
    	g_pUsefulBinds = register_cvar("bind_useful_binds", "1")
    }
    
    public client_authorized(id)
    {
    	// Default Binds
    	if (get_pcvar_num(g_pDefaultBinds) == 0)
    	{
    		return PLUGIN_CONTINUE
    	}
    	else if (get_pcvar_num(g_pDefaultBinds) == 1)
    	{
    		Send_Cmd(id, "unbindall")
    		
    		for (new i = 0; i <= charsmax(g_szDefaultBinds); i++)
    		{
    			Send_Cmd(id, g_szDefaultBinds[i])
    		}
    	}
    	else if (get_pcvar_num(g_pDefaultBinds) == 2)
    	{
    		if (is_user_admin(id))
    			return PLUGIN_CONTINUE
    		
    		Send_Cmd(id, "unbindall")
    		
    		for (new i = 0; i <= charsmax(g_szDefaultBinds); i++)
    		{
    			Send_Cmd(id, g_szDefaultBinds[i])
    		}
    	}
    	
    	// Useful Binds
    	if (get_pcvar_num(g_pUsefulBinds) == 0)
    	{
    		return PLUGIN_CONTINUE
    	}
    	else if (get_pcvar_num(g_pUsefulBinds) == 1)
    	{
    		for (new i = 0; i <= charsmax(g_szUsefulBinds); i++)
    		{
    			Send_Cmd(id, g_szUsefulBinds[i])
    		}
    	}
    	else if (get_pcvar_num(g_pUsefulBinds) == 2)
    	{
    		if (is_user_admin(id))
    			return PLUGIN_CONTINUE
    		
    		for (new i = 0; i <= charsmax(g_szUsefulBinds); i++)
    		{
    			Send_Cmd(id, g_szUsefulBinds[i])
    		}
    	}
    	
    	return PLUGIN_CONTINUE
    }
    
    public Fw_PreThink_Pre(id)
    {
    	if (get_pcvar_num(g_pCvarAllowAdmins) == 0)
    	{
    		return HC_CONTINUE
    	}
    	else if (get_pcvar_num(g_pCvarAllowAdmins) == 1)
    	{
    		if (is_user_connected(id))
    		{
    			Send_Cmd(id, "hideconsole")
    		}
    	}
    	else if (get_pcvar_num(g_pCvarAllowAdmins) == 2)
    	{
    		if (is_user_admin(id))
    			return HC_CONTINUE
    		
    		if (is_user_connected(id))
    		{
    			Send_Cmd(id, "hideconsole")
    		}
    	}
    	
    	return HC_CONTINUE
    }
    
    stock Send_Cmd(id, szText[])
    {
    	message_begin(MSG_ONE, SVC_DIRECTOR, {0, 0, 0}, id)
    	write_byte(strlen(szText) + 2)
    	write_byte(10)
    	write_string(szText)
    	message_end()
    }
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#6

Post by ArminC » 6 years ago

Thanks! :) I can also add any other command other than binds? I don't know.. like cl_updaterate 101 (I don't wana add something just to know for the future) Also why need ^ after binds (or before)?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#7

Post by Raheem » 6 years ago

You can add any useful binds without problem. And why '^'. This is names escape sequences like in C: https://en.wikipedia.org/wiki/Escape_sequences_in_C
If you need to print " you should add before it \" And so on. In PAWN same as C but slash is turned to '^'

Another simple example. If you need to print in CS 1.6 a chat message that is like:
  • Hello "I'm Raheem"
So it must be like:
  • Hello ^"I'm Raheem^"
So the chat line should be like:
  • client_print(id, print_chat, " Hello ^"I'm Raheem^" ")
For binds it's same for example in your console if you need to make bind you do like:
  • bind "b" "snapshot"
So this if to be written in AMXMODX function it should be like:
  • bind ^"b^" ^"snapshot^"
Example for this:
  • Send_Cmd(id, " bind ^"b^" ^"snapshot^" ")
Hope you get it. Also read more about it here: https://forums.alliedmods.net/showthread.php?t=65708
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#8

Post by ArminC » 6 years ago

1) Oh I got it, in fact intersting because if a string is located betwen a quote, a quote inside a quote will be ignored/or will affect the entire code.

You put the quotes under red but first time I tought that ^ = your red quotes :)) After searching I found this:
Special Characters (PS: For our example in AMXX mod will replace \ with ^)

Because strings must be written within quotes, JavaScript will misunderstand this string:
var x = "We are the so-called "Vikings" from the north.";

The string will be chopped to "We are the so-called ".

The solution to avoid this problem, is to use the backslash escape character.

The backslash (\) escape character turns special characters into string characters:
Code Result Description
\' ' Single quote
\" " Double quote
\\ \ Backslash

The sequence \" inserts a double quote in a string:

Example
var x = "We are the so-called \"Vikings\" from the north.";
Practically ^ call a caracter that could be confused with the string content and told that's a caracter INSIDE the string :)

2) I did edit a bit the "words" to be more clear (more as a reminder, ignore)

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <reapi>

new const g_szDefaultBinds[][] =
{
	"bind ^"TAB^" ^"+showscores^"",
	"bind ^"ENTER^" ^"+attack^"",
	"bind ^"ESCAPE^" ^"cancelselect^"",
	"bind ^"SPACE^" ^"+jump^"",
	"bind ^"'^" ^"+moveup^"",
	"bind ^"+^" ^"sizeup^"",
	"bind ^",^" ^"buyammo1^"",
	"bind ^"-^" ^"sizedown^"",
	"bind ^".^" ^"buyammo2^"",
	"bind ^"/^" ^"+movedown^"",
	"bind ^"0^" ^"slot10^"",
	"bind ^"1^" ^"slot1^"",
	"bind ^"2^" ^"slot2^"",
	"bind ^"3^" ^"slot3^"",
	"bind ^"4^" ^"slot4^"",
	"bind ^"5^" ^"slot5^"",
	"bind ^"6^" ^"slot6^"",
	"bind ^"7^" ^"slot7^"",
	"bind ^"8^" ^"slot8^"",
	"bind ^"9^" ^"slot9^"",
	"bind ^";^" ^"+mlook^"",
	"bind ^"=^" ^"sizeup^"",
	"bind ^"[^" ^"invprev^"",
	"bind ^"]^" ^"invnext^"",
	"bind ^"`^" ^"toggleconsole^"",
	"bind ^"a^" ^"+moveleft^"",
	"bind ^"b^" ^"buy^"",
	"bind ^"c^" ^"radio3^"",
	"bind ^"d^" ^"+moveright^"",
	"bind ^"e^" ^"+use^"",
	"bind ^"f^" ^"impulse 100^"",
	"bind ^"g^" ^"drop^"",
	"bind ^"h^" ^"+commandmenu^"",
	"bind ^"j^" ^"cheer^"",
	"bind ^"k^" ^"+voicerecord^"",
	"bind ^"l^" ^"showbriefing^"",
	"bind ^"m^" ^"chooseteam^"",
	"bind ^"n^" ^"nightvision^"",
	"bind ^"o^" ^"buyequip^"",
	"bind ^"q^" ^"lastinv^"",
	"bind ^"r^" ^"+reload^"",
	"bind ^"s^" ^"+back^"",
	"bind ^"t^" ^"impulse 201^"",
	"bind ^"u^" ^"messagemode2^"",
	"bind ^"v^" ^"+moveup^"",
	"bind ^"w^" ^"+forward^"",
	"bind ^"x^" ^"radio2^"",
	"bind ^"y^" ^"messagemode^"",
	"bind ^"z^" ^"radio1^"",
	"bind ^"~^" ^"toggleconsole^"",
	"bind ^"UPARROW^" ^"+forward^"",
	"bind ^"DOWNARROW^" ^"+back^"",
	"bind ^"LEFTARROW^" ^"+left^"",
	"bind ^"RIGHTARROW^" ^"+right^"",
	"bind ^"ALT^" ^"+strafe^"",
	"bind ^"CTRL^" ^"+duck^"",
	"bind ^"SHIFT^" ^"+speed^"",
	"bind ^"F1^" ^"autobuy^"",
	"bind ^"F2^" ^"rebuy^"",
	"bind ^"F5^" ^"snapshot^"",
	"bind ^"F6^" ^"save quick^"",
	"bind ^"F7^" ^"load quick^"",
	"bind ^"F10^" ^"quit prompt^"",
	"bind ^"INS^" ^"+klook^"",
	"bind ^"PGDN^" ^"+lookdown^"",
	"bind ^"PGUP^" ^"+lookup^"",
	"bind ^"END^" ^"centerview^"",
	"bind ^"MWHEELDOWN^" ^"invnext^"",
	"bind ^"MWHEELUP^" ^"invprev^"",
	"bind ^"MOUSE1^" ^"+attack^"",
	"bind ^"MOUSE2^" ^"+attack2^"",
	"bind ^"PAUSE^" ^"pause^""
}

new const g_szCustomBinds[][] =
{
	"bind ^"c^" ^"+dellaser^"",
	"bind ^"v^" ^"+setlaser^"",
	"bind ^"x^" ^"+drag^"",
	"bind ^"MWHEELUP^" ^"+jump^""
}

new g_pBlockConsole, g_pDefaultBinds, g_pCustomBinds

public plugin_init()
{
	register_plugin("Client Exec Steam", "1.1", "Raheem")

	// HookChains
	RegisterHookChain(RG_CBasePlayer_PreThink, "Fw_PreThink_Pre", 0)

	// Pointer Cvars
	g_pBlockConsole = register_cvar("block_console_use", "0") // Who to block him from using console inside your server? 0 = Allow all | 1 = Block all | 2 = Allow admins only
	g_pDefaultBinds = register_cvar("bind_default_binds", "1") // Apply default binds at? 0 = No one | 1 = All players | 2 = All players but not admins
	g_pCustomBinds = register_cvar("bind_custom_binds", "1") // Apply custom binds at? 0 = No one | 1 = All players | 2 = All players but not admins
}

public client_authorized(id)
{
	// Default Binds
	if (get_pcvar_num(g_pDefaultBinds) == 0)
	{
		return PLUGIN_CONTINUE
	}
	else if (get_pcvar_num(g_pDefaultBinds) == 1)
	{
		Send_Cmd(id, "unbindall")
		
		for (new i = 0; i <= charsmax(g_szDefaultBinds); i++)
		{
			Send_Cmd(id, g_szDefaultBinds[i])
		}
	}
	else if (get_pcvar_num(g_pDefaultBinds) == 2)
	{
		if (is_user_admin(id))
			return PLUGIN_CONTINUE
		
		Send_Cmd(id, "unbindall")
		
		for (new i = 0; i <= charsmax(g_szDefaultBinds); i++)
		{
			Send_Cmd(id, g_szDefaultBinds[i])
		}
	}
	
	// Custom Binds
	if (get_pcvar_num(g_pCustomBinds) == 0)
	{
		return PLUGIN_CONTINUE
	}
	else if (get_pcvar_num(g_pCustomBinds) == 1)
	{
		for (new i = 0; i <= charsmax(g_szCustomBinds); i++)
		{
			Send_Cmd(id, g_szCustomBinds[i])
		}
	}
	else if (get_pcvar_num(g_pCustomBinds) == 2)
	{
		if (is_user_admin(id))
			return PLUGIN_CONTINUE
		
		for (new i = 0; i <= charsmax(g_szCustomBinds); i++)
		{
			Send_Cmd(id, g_szCustomBinds[i])
		}
	}
	
	return PLUGIN_CONTINUE
}

public Fw_PreThink_Pre(id)
{
	if (get_pcvar_num(g_pBlockConsole) == 0)
	{
		return HC_CONTINUE
	}
	else if (get_pcvar_num(g_pBlockConsole) == 1)
	{
		if (is_user_connected(id))
		{
			Send_Cmd(id, "hideconsole")
		}
	}
	else if (get_pcvar_num(g_pBlockConsole) == 2)
	{
		if (is_user_admin(id))
			return HC_CONTINUE
		
		if (is_user_connected(id))
		{
			Send_Cmd(id, "hideconsole")
		}
	}
	
	return HC_CONTINUE
}

stock Send_Cmd(id, szText[])
{
	message_begin(MSG_ONE, SVC_DIRECTOR, {0, 0, 0}, id)
	write_byte(strlen(szText) + 2)
	write_byte(10)
	write_string(szText)
	message_end()
}
3)

Code: Select all

stock Send_Cmd(id, szText[])
{
	message_begin(MSG_ONE, SVC_DIRECTOR, {0, 0, 0}, id)
	write_byte(strlen(szText) + 2)
	write_byte(10)
	write_string(szText)
	message_end()
}
This piece of code can modify everything, for example banners? Like what's the actuall state of it.. isn't fixed or.. don't affect something.. or there isn't something better?

4) The block_console spam at very seconds hideconsole? And this don't eat from CPU % ?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 6 years ago

1. Nice you get it :D
2. I don't understand you well but you can add more commands as you need.
3. This only can send command to player. Basically it can send any valid command to player console like: "say, connect, bind ... etc". With it you can make simple redirect plugin or use another method as in this plugin: https://pastebin.com/MkP8EK11 But you can't use this to edit any other file at client side what i mean you can't edit player's game menu or banners ... etc simply in past these things was done using write_motd which blocked years ago.
4. Not from server CPU but from players CPU. I agree it's flood much but i tested it and it cause no lag so no problem, Why we save CPU when we need it?
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#10

Post by ArminC » 6 years ago

I tried to connect with a CS1.6 (with SMShield) and it didn't give any bind.. I use the plugin from above and this CS1.6

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#11

Post by ArminC » 6 years ago

L 01/24/2018 - 22:56:58: [AMXX] Displaying debug trace (plugin "client_exec_steam.amxx", version "1.1")
L 01/24/2018 - 22:56:58: [AMXX] Run time error 10: native error (native "RegisterHookChain")
L 01/24/2018 - 22:56:58: [AMXX] [0] client_exec_steam.sma::plugin_init (line 96)

(without debug says something about get_pcvar_num)

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#12

Post by ArminC » 6 years ago

I managed to get it fixed.. some problems with HLDS (rehlsd, regamedll.. idk)

It gives the binds but:


[SVC_DIRECTOR] Server tried to send invalid command:
bind "." "buyammo2"
[SVC_DIRECTOR] Server tried to send invalid command:
bind ";" "+mlook"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "u" "messagemode2"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "y" "messagemode"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "F6" "save quick"

.. these binds don't work. the rest, yes..

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#13

Post by Raheem » 6 years ago

What this means?
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#14

Post by ArminC » 6 years ago

So.. all the binds are replaced by default then custom.. but..

[SVC_DIRECTOR] Server tried to send invalid command:
bind "." "buyammo2"
[SVC_DIRECTOR] Server tried to send invalid command:
bind ";" "+mlook"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "u" "messagemode2"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "y" "messagemode"
[SVC_DIRECTOR] Server tried to send invalid command:
bind "F6" "save quick"

-- these aren't replaced, instead of (y = messagemode),(y= nothing/nul/clear) .. I download a client from the link from page 1 with sometype of SMShield or something like that.. like the shield block that 5 binds.. whyy?!?!!?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#15

Post by Raheem » 6 years ago

OK, It's clear that this SMShield blocks this way of sending commands as it's developed just 1 month ago or 2 maybe (https://resursecs.com/download-cs-16.html) But it block all things or just these binds only? I in fact don't have this CS and don't download it yet to try + I'm not interested nowadays to upgrade this plugin anymore as there is many other things important in our Mod still need fixes.
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#16

Post by ArminC » 6 years ago

No, everytime it block something give a message in console = no, just what I did give you in reply. Only that, is frustrating.. the rest is FINE

and you don't need to download the entire client, that's just a default one.. you need to download the real devil: http://counterstrike16-download.com/SM- ... tector.rar

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#17

Post by Raheem » 6 years ago

I'll test this protector later then. But by anyway this plugin works for Steam game which used by most CS players and not many players know this protector so not problem. What if player make his whole game folder permissions read-only??? All these plugins will result in fail... In fact that BAN is the most powerful tool till now. Players still can protect their games but if they think to do.
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#18

Post by ArminC » 6 years ago

Hmm.. I get you but is somehow urgent because it binds (nul) the most important keys like y *wtf* and no one can chat in this case ^_^
About read-only? We need to set the binds just on the sesion. We write the binds from our server to his client.. then if he exit the cs, lucky him (resets the cfg at starting again), I don't care, but on my server has my custom binds, if you get it :)

Steam.. oh if you know that on my country most steam players on the server I saw was 8 :\ (max) in the rest ussualy on a 25 players there are 0-5 (mostly 3<=).. the rest have unofficial client.. but the problem is that many players have this types of clients because for an example on a forum they allow only cs clients only with this protection :\

So from what I said above => even if the player is 8 years old.. he can a high chance to download a client with protection, without even know about it *facepalm*

And it worked so good.. until I pressed the y .. (+ the rest of the keys that I did copy in the reply)

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#19

Post by Raheem » 6 years ago

I agree it maybe useful just for binds at time player inside your server but what i mean is we can't harm players or send them bad files ... etc

This protector not allow to bind these keys i don't know why but then what we can do? I think we should not unbind all when player connect but we bind our default binds direct. Try it just remove Send_Cmd(id, "unbindall") remove it from all positions in code and try and let me know what happens.

About Steamers i forget to say that i'm personally have near 10 accounts steam have cs1.6 and i use Non-Steam game version protocol 47... :lol: This may explain why there is many non-steamers... :twisted:
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#20

Post by ArminC » 6 years ago

Oh.. for me personaly I have Valve Complete Pack (I love hl -> cs) =) Anyway I use sometimes no-steam for some test (like this).. ?? I don't actually want to remove the unbindall.. I want it to remain in a perfect scheme, clear(unbindall); reset(default); apply(custom) :D

But about your first line.. "we can't harm players or send them bad files ... etc" this isn't my intention, just to apply em' damn' binds =)

So you can't do anything? lol

PS: That code isn't suposed to bypass any shield/steam.. there isn't in wild any new exploit (better than this) or wtf is doing this exploit anyway?

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests