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

server binds key for player


Post New Thread Reply   
 
Thread Tools Display Modes
codydbgt
Member
Join Date: Apr 2009
Old 11-08-2010 , 20:25   Re: server binds key for player
Reply With Quote #11

umm ya u can with a plugin- im new to the sourcemod API and not new to c++ and very not new to programing. so if u just give me a couple functions i can mess around with thanks and the trigger when the player enters the game and has finely spawned- or to make things simpler the command to send to the a console command to execute on the client side and im not sure how to detect who to send it to after they would put !bind in the chat.

thanks
__________________
codydbgt is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-08-2010 , 21:53   Re: server binds key for player
Reply With Quote #12

Quote:
Originally Posted by codydbgt View Post
umm ya u can with a plugin- im new to the sourcemod API and not new to c++ and very not new to programing. so if u just give me a couple functions i can mess around with thanks and the trigger when the player enters the game and has finely spawned- or to make things simpler the command to send to the a console command to execute on the client side and im not sure how to detect who to send it to after they would put !bind in the chat.

thanks
You can't. Bind is a restricted command. It is one of many that servers are not able to run on clients in most games.
psychonic is offline
snowyiet
Member
Join Date: Jan 2010
Old 09-10-2013 , 01:42   Re: server binds key for player
Reply With Quote #13

Binding worked with SourceOP in TF2 until a few months ago when SourceOP broke. Is it possible to make a menu like this in sourcemod? It was a real bind that wrote to clients .cfg

http://206.130.123.230/fortress/2012-08-08_00001.jpg
snowyiet is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-10-2013 , 01:46   Re: server binds key for player
Reply With Quote #14

I'm guessing after you chose from that list it would pop up with a dialogue message where you'd have to hit a button to confirm it binding the key. Am I right?
bl4nk is offline
snowyiet
Member
Join Date: Jan 2010
Old 09-10-2013 , 01:48   Re: server binds key for player
Reply With Quote #15

Quote:
Originally Posted by bl4nk View Post
I'm guessing after you chose from that list it would pop up with a dialogue message where you'd have to hit a button to confirm it binding the key. Am I right?
No, you just selected the key you want in that menu and it closes and your bind is set after that permanently, writes to cfg.
snowyiet is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-10-2013 , 15:07   Re: server binds key for player
Reply With Quote #16

Just found out the source to SourceOP has been released, so I see how DF did it. This would require an extension to do, as the SM menu API doesn't support what's required to pull it off.
bl4nk is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-10-2013 , 15:18   Re: server binds key for player
Reply With Quote #17

Quote:
Originally Posted by bl4nk View Post
Just found out the source to SourceOP has been released, so I see how DF did it. This would require an extension to do, as the SM menu API doesn't support what's required to pull it off.
IIRC, you shouldn't need an extension for it, just CreateDialog and the Kv natives.
psychonic is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-10-2013 , 21:52   Re: server binds key for player
Reply With Quote #18

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 1) {
        
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));

        
ShowBindMenu(iClientszCommandStringToInt(szMenuOpt));
    }

    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);
        
        
KvSavePosition(hKV);

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

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

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""I");
                
Format(szBuffersizeof(szBuffer), "bind i %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""J");
                
Format(szBuffersizeof(szBuffer), "bind j %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""K");
                
Format(szBuffersizeof(szBuffer), "bind k %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""L");
                
Format(szBuffersizeof(szBuffer), "bind l %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""M");
                
Format(szBuffersizeof(szBuffer), "bind m %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

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

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""P");
                
Format(szBuffersizeof(szBuffer), "bind p %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Q");
                
Format(szBuffersizeof(szBuffer), "bind q %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""R");
                
Format(szBuffersizeof(szBuffer), "bind r %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""S");
                
Format(szBuffersizeof(szBuffer), "bind s %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""T");
                
Format(szBuffersizeof(szBuffer), "bind t %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

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

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""W");
                
Format(szBuffersizeof(szBuffer), "bind w %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""X");
                
Format(szBuffersizeof(szBuffer), "bind x %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Y");
                
Format(szBuffersizeof(szBuffer), "bind y %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Z");
                
Format(szBuffersizeof(szBuffer), "bind z %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""=");
                
Format(szBuffersizeof(szBuffer), "bind = %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""[");
                
Format(szBuffersizeof(szBuffer), "bind [ %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""]");
                
Format(szBuffersizeof(szBuffer), "bind ] %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""\\");
                
Format(szBuffersizeof(szBuffer), "bind \\ %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg"";");
                
Format(szBuffersizeof(szBuffer), "bind semicolon %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

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

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg"",");
                
Format(szBuffersizeof(szBuffer), "bind , %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg"".");
                
Format(szBuffersizeof(szBuffer), "bind . %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""/");
                
Format(szBuffersizeof(szBuffer), "bind / %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Shift");
                
Format(szBuffersizeof(szBuffer), "bind shift %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""Ctrl");
                
Format(szBuffersizeof(szBuffer), "bind ctrl %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

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

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""Right Arrow");
                
Format(szBuffersizeof(szBuffer), "bind rightarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Down Arrow");
                
Format(szBuffersizeof(szBuffer), "bind downarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Left Arrow");
                
Format(szBuffersizeof(szBuffer), "bind leftarrow %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""Mouse Button 4");
                
Format(szBuffersizeof(szBuffer), "bind mouse4 %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""Mouse Button 5");
                
Format(szBuffersizeof(szBuffer), "bind mouse5 %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""Mouse Wheel Up");
                
Format(szBuffersizeof(szBuffer), "bind mwheelup %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Mouse Wheel Down");
                
Format(szBuffersizeof(szBuffer), "bind mwheeldown %s;cancelselect"szCommand);
                
KvSetString(hKV"command"szBuffer);

                
KvGoBack(hKV);
                
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);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"2"true);
                
KvSetString(hKV"msg""H-N");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 2"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"3"true);
                
KvSetString(hKV"msg""P-U");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 3"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"4"true);
                
KvSetString(hKV"msg""V-Z");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 4"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"5"true);
                
KvSetString(hKV"msg""Symbols");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 5"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
KvJumpToKey(hKV"6"true);
                
KvSetString(hKV"msg""Arrows");
                
Format(szBuffersizeof(szBuffer), "bindmenu %s 7"szCommand);
                
KvSetString(hKV"command"szBuffer);
                
                
KvGoBack(hKV);
                
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);
    }


Last edited by bl4nk; 01-10-2014 at 12:09. Reason: fixed.. thought i did this a long time ago
bl4nk is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-11-2013 , 12:31   Re: server binds key for player
Reply With Quote #19

Pretty sure you can do it in tf2, either by forcing the client to write out and then execute a text file cfg in soe convoluted manner, or just embed it in a map... Seen this happen not too long ago..peoplerunning around with all their f keys bound to connect to russian servers.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 09-11-2013 , 16:31   Re: server binds key for player
Reply With Quote #20

So CreateDialog menus are immune to valve anti-bind keys from server stuff?
__________________
...
Oshizu 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:52.


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