Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- #include < amxmisc >
- #define MENU_PREFIX "\d[ \yAMXX\d ] "
- enum _: iData
- {
- iCategory[ 33 ],
- iBind[ 33 ],
- iCommand[ 33 ]
- }
- new const szKeys [ ] [ ] =
- {
- "a", "b", "c", "d",
- "e", "f", "g", "h",
- "i", "j", "k", "l",
- "m", "n", "o", "p",
- "q", "r", "s", "t",
- "u"
- }
- new const BindsTemp [ ] [ iData ] =
- {
- { "Bunnyhop", "Auto On/Off Bhop", "/bhop" },
- { "Public", "ResetScore", "/rs" },
- { "Everything", "Open Top15", "/top15" }
- }
- new iOption[ 33 ], iKeyOption[ 33 ];
- public plugin_init()
- {
- register_plugin( "Set Key Binds", "1.0", "Xdoctor" );
- register_saycmd( "setbinds", "CmdBinds" );
- }
- public CmdBinds( client )
- {
- new szMenu[ 128 ];
- formatex( szMenu, charsmax( szMenu ), "%s Set Binds Menu", MENU_PREFIX );
- new Menu = menu_create( szMenu, "CmdBindsHandler" );
- formatex( szMenu, charsmax( szMenu ), "\rCategory %s\w:\y Bind\w:\y %s", BindsTemp[ iOption[ client ] ] );
- menu_additem( Menu, szMenu );
- formatex( szMenu, charsmax( szMenu ), "\rBind Key\w: \d[ \y%s\d ]", szKeys[ iKeyOption[ client ] ] );
- menu_additem( Menu, szMenu );
- menu_additem( Menu, "Activate Bind" );
- menu_display( client, Menu, 0 );
- return 1;
- }
- public CmdBindsHandler( client, Menu, Item )
- {
- if( Item >= MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- switch( Item )
- {
- case 0:
- {
- if( iOption[ client ] >= charsmax( BindsTemp ) )
- iOption[ client ] = 0
- else
- iOption[ client ] += 1;
- }
- case 1:
- {
- if( iKeyOption[ client ] >= charsmax( szKeys ) )
- iKeyOption[ client ] = 0;
- else
- iKeyOption[ client ]++;
- }
- case 2:
- {
- ColorChat( client, "^4%s^1 Your bind^4 %s^1 is on key: ^4%s", GetUserName( client ), BindsTemp[ iOption[ client ] ][ iBind ], szKeys[ iOption[ client ] ] );
- client_cmd( client, "bind %s ^"say %s ^"", szKeys[ iOption[ client ] ], BindsTemp[ iOption[ client ] ][ iCommand ] );
- return 1;
- }
- }
- return 1;
- }
- stock GetUserName( const Index )
- {
- new szName[ 32 ];
- get_user_name( Index, szName, charsmax( szName ) );
- return szName;
- }
- stock register_saycmd( const cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1 )
- {
- new i, j;
- new szString[ 64 ];
- new const szSayTypes[ ][ ] = { "say", "say_team" };
- new const szTypes[ ][ ] = { "/", "!", "." }
- for( i = 0 ; i < sizeof szSayTypes ; i ++ )
- {
- for( j = 0 ; j < sizeof szTypes ; j ++ )
- {
- formatex( szString, sizeof szString - 1, "%s %s%s", szSayTypes[ i ], szTypes[ j ], cmd );
- register_clcmd( szString, function, flags, info, FlagManager );
- }
- }
- }
- stock ColorChat(const id,const string[],any:...)
- {
- new msg[191], players[32], count = 1;
- static len; len = formatex(msg,charsmax(msg),"^1[ ^4AMXX ^1] ");
- vformat(msg[len],charsmax(msg) - len,string,3);
- static msgSayText;
- if (!msgSayText)
- msgSayText = get_user_msgid("SayText");
- if(id) players[0] = id;
- else get_players(players,count,"ch");
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE,msgSayText,.player = players[i]);
- write_byte(players[i]); // Sender ID
- write_string(msg); // String 1
- message_end();
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement