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, g_pUnbindAll
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
g_pUnbindAll = register_cvar("unbindall", "0")
}
public client_authorized(id)
{
// Default Binds
if (get_pcvar_num(g_pDefaultBinds) == 0)
{
return PLUGIN_CONTINUE
}
else if (get_pcvar_num(g_pDefaultBinds) == 1)
{
if (get_pcvar_num(g_pUnbindAll) == 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
if (get_pcvar_num(g_pUnbindAll) == 1)
{
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()
}