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()
}
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
-- 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
PS: I come here after some unsucesfull request on other forum.. (from my country).. (It was deleted )