Raised This Month: $51 Target: $400
 12% 

server binds key for player


Post New Thread Reply   
 
Thread Tools Display Modes
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-11-2013 , 16:58   Re: server binds key for player
Reply With Quote #21

There's another method to rebind keys, but both involve the client actually pressing a button (via the mouse or a specific keyboard button). You can't forcefully rebind keys like you use to be able to in pre-Source days.
bl4nk is offline
snowyiet
Member
Join Date: Jan 2010
Old 09-19-2013 , 03:10   Re: server binds key for player
Reply With Quote #22

Quote:
Originally Posted by bl4nk View Post
Ah, I thought it existed already, but couldn't find it due to the name. This should effectively do the same thing that SourceOP does. Type "sm_bindcommand <command>" into console, and it should pop up with the same list asking to bind the given command.

PHP Code:
#pragma semicolon 1

#include <sourcemod>

public OnPluginStart() {
    
RegConsoleCmd("sm_bindcommand"Command_Bind);
    
RegConsoleCmd("bindmenu"Command_BindMenu);
}

public 
Action:Command_Bind(iClientiArgCount) {
    if (
iArgCount 2) {
        
ReplyToCommand(iClient"[SM] Usage: sm_bindcommand <command>");
        return 
Plugin_Handled;
    }

    
decl String:szCommand[32];
    
GetCmdArg(1szCommandsizeof(szCommand));

    
ShowBindMenu(iClientszCommand0);

    return 
Plugin_Handled;
}

public 
Action:Command_BindMenu(iClientiArgCount) {
    if (
iArgCount 1) {
        
decl String:szCommand[32], String:szMenuOpt[2];
        
GetCmdArg(1szCommandsizeof(szCommand));
        
GetCmdArg(2szMenuOptsizeof(szMenuOpt));

        new 
iMenuOpt StringToInt(szMenuOpt);
        if (
iMenuOpt || iMenuOpt 8) {
            
iMenuOpt 0;
        }

        
ShowBindMenu(iClientszCommandiMenuOpt);
    }

    return 
Plugin_Handled;
}

ShowBindMenu(iClient, const String:szCommand[], iMenuOpt) {
    if (
iClient && IsClientConnected(iClient)) {
        new 
Handle:hKV CreateKeyValues("menu");
        
KvSetString(hKV"title""Bind menu, hit ESC");
        
KvSetNum(hKV"level"1);
        
KvSetColor(hKV"color"1282550255);
        
KvSetNum(hKV"time"20);
        
        
decl String:szBuffer[192];
        
Format(szBuffersizeof(szBuffer), "Bind Menu.\nPick a key to bind %s to."szCommand);
        
KvSetString(hKV"msg"szBuffer);

        switch (
iMenuOpt) {
            case 
1: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""A");
                
Format(szBuffersizeof(szBuffer), "bind a %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""B");
                
Format(szBuffersizeof(szBuffer), "bind b %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""C");
                
Format(szBuffersizeof(szBuffer), "bind c %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""D");
                
Format(szBuffersizeof(szBuffer), "bind d %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""E");
                
Format(szBuffersizeof(szBuffer), "bind e %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""F");
                
Format(szBuffersizeof(szBuffer), "bind f %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""G");
                
Format(szBuffersizeof(szBuffer), "bind g %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"8"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
2: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""H");
                
Format(szBuffersizeof(szBuffer), "bind h %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""I");
                
Format(szBuffersizeof(szBuffer), "bind i %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""J");
                
Format(szBuffersizeof(szBuffer), "bind j %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""K");
                
Format(szBuffersizeof(szBuffer), "bind k %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""L");
                
Format(szBuffersizeof(szBuffer), "bind l %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""M");
                
Format(szBuffersizeof(szBuffer), "bind m %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""N");
                
Format(szBuffersizeof(szBuffer), "bind n %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"8"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
3: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""O");
                
Format(szBuffersizeof(szBuffer), "bind o %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""P");
                
Format(szBuffersizeof(szBuffer), "bind p %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Q");
                
Format(szBuffersizeof(szBuffer), "bind q %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""R");
                
Format(szBuffersizeof(szBuffer), "bind r %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""S");
                
Format(szBuffersizeof(szBuffer), "bind s %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""T");
                
Format(szBuffersizeof(szBuffer), "bind t %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""U");
                
Format(szBuffersizeof(szBuffer), "bind u %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"8"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
4: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""V");
                
Format(szBuffersizeof(szBuffer), "bind v %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""W");
                
Format(szBuffersizeof(szBuffer), "bind w %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""X");
                
Format(szBuffersizeof(szBuffer), "bind x %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Y");
                
Format(szBuffersizeof(szBuffer), "bind y %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Z");
                
Format(szBuffersizeof(szBuffer), "bind z %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
5: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""-");
                
Format(szBuffersizeof(szBuffer), "bind - %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""=");
                
Format(szBuffersizeof(szBuffer), "bind = %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""[");
                
Format(szBuffersizeof(szBuffer), "bind [ %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""]");
                
Format(szBuffersizeof(szBuffer), "bind ] %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""\\");
                
Format(szBuffersizeof(szBuffer), "bind \\ %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg"";");
                
Format(szBuffersizeof(szBuffer), "bind semicolon %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""More >>");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 6"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"8"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
6: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""'");
                
Format(szBuffersizeof(szBuffer), "bind ' %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg"",");
                
Format(szBuffersizeof(szBuffer), "bind , %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg"".");
                
Format(szBuffersizeof(szBuffer), "bind . %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""/");
                
Format(szBuffersizeof(szBuffer), "bind / %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Shift");
                
Format(szBuffersizeof(szBuffer), "bind shift %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""Ctrl");
                
Format(szBuffersizeof(szBuffer), "bind ctrl %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""Alt");
                
Format(szBuffersizeof(szBuffer), "bind alt %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"8"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
7: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""Up Arrow");
                
Format(szBuffersizeof(szBuffer), "bind uparrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""Right Arrow");
                
Format(szBuffersizeof(szBuffer), "bind rightarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Down Arrow");
                
Format(szBuffersizeof(szBuffer), "bind downarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Left Arrow");
                
Format(szBuffersizeof(szBuffer), "bind leftarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            case 
8: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""Mouse Button 3");
                
Format(szBuffersizeof(szBuffer), "bind mouse3 %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""Mouse Button 4");
                
Format(szBuffersizeof(szBuffer), "bind mouse4 %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Mouse Button 5");
                
Format(szBuffersizeof(szBuffer), "bind mouse5 %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Mouse Wheel Up");
                
Format(szBuffersizeof(szBuffer), "bind mwheelup %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Mouse Wheel Down");
                
Format(szBuffersizeof(szBuffer), "bind mwheeldown %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""<< Back");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 0"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
            default: {
                
KvJumpToKey(hKV"1"true);
                
KvSetString(hKV"msg""A-G");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 1"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""H-N");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 2"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""P-U");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 3"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""V-Z");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 4"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Symbols");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 5"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""Arrows");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 7"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvJumpToKey(hKV"7"true);
                
KvSetString(hKV"msg""Mouse Buttons");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 8"szCommand);
                
KvSetString(hKV"command"szBuffer);
            }
        }

        
CreateDialog(iClienthKVDialogType_Menu);
        
CloseHandle(hKV);
    }


This compiles without any errors but it doesn't work. It would be really nice if there was a working plugin like this for sourcemod.
snowyiet is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 09-20-2013 , 06:07   Re: server binds key for player
Reply With Quote #23

We should trash this thread and remove all data from here.
This stuff can be used for all blocked commands

Some people might abuse it!
__________________
...

Last edited by Oshizu; 09-20-2013 at 06:07.
Oshizu is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-20-2013 , 06:37   Re: server binds key for player
Reply With Quote #24

Quote:
Originally Posted by Oshizu View Post
We should trash this thread and remove all data from here.
This stuff can be used for all blocked commands

Some people might abuse it!
This is a Valve-provided method to do it.
__________________
asherkin is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 09-20-2013 , 07:05   Re: server binds key for player
Reply With Quote #25

I assume it would be fine to use it in my plugin that i might publish in future
__________________
...

Last edited by Oshizu; 09-20-2013 at 07:07.
Oshizu is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-20-2013 , 09:10   Re: server binds key for player
Reply With Quote #26

Are you able to execute any command on the client after a client clicks the button this way?
Could be used to redirect players to other servers without requiring them to have askconnect_accept bound.

Does csgo support the "valve style" esc-menu?
__________________
Peace-Maker is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-20-2013 , 09:35   Re: server binds key for player
Reply With Quote #27

Quote:
Originally Posted by Peace-Maker View Post
Does csgo support the "valve style" esc-menu?
According to the CSGO Quirks page, no. Except that it's the only Valve game that SourceMod supports that apparently doesn't.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 09-20-2013 , 09:35   Re: server binds key for player
Reply With Quote #28

Quote:
Originally Posted by Peace-Maker View Post
Are you able to execute any command on the client after a client clicks the button this way?
Could be used to redirect players to other servers without requiring them to have askconnect_accept bound.

Does csgo support the "valve style" esc-menu?
Possibly any command
I've been able to execute 'quit' command with it

There's some weird bug thought
I can't make more than one option to showup in menu
Or i've probatly missed sometihng.
__________________
...

Last edited by Oshizu; 09-20-2013 at 09:38.
Oshizu is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-20-2013 , 09:59   Re: server binds key for player
Reply With Quote #29

So does this bug's details look correct?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-20-2013 , 10:02   Re: server binds key for player
Reply With Quote #30

Quote:
Originally Posted by Powerlord View Post
According to the CSGO Quirks page, no. Except that it's the only Valve game that SourceMod supports that apparently doesn't.
They broke the vgui resources required for it on L4D iirc, maybe L4D2. It doesn't work on those or anything newer, same reason that sm's "top say" doesn't work on them.
psychonic is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode