Modify No-Console (Solved)

Coding Help/Re-API Supported
User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

Modify No-Console (Solved)

#1

Post by ArminC » 1 Year 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 on 26 Feb 2018, 15:19, edited 1 time in total.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#2

Post by ArminC » 1 Year Ago

Anyone?

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1864
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#3

Post by Raheem » 1 Year 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.
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#4

Post by ArminC » 1 Year 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
Egypt
Posts: 1864
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#5

Post by Raheem » 1 Year 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()
    }
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#6

Post by ArminC » 1 Year 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
Egypt
Posts: 1864
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#7

Post by Raheem » 1 Year 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
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#8

Post by ArminC » 1 Year 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
Egypt
Posts: 1864
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 98 times
Age: 21
Contact:

#9

Post by Raheem » 1 Year 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?
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#10

Post by ArminC » 1 Year 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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests