Advertisement
iXdoctor

Admin Stack

Jul 16th, 2014
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.09 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < amxmisc >
  5. #include < fun >
  6.  
  7. #define ADMIN_FLAG  ADMIN_BAN
  8.  
  9.  
  10. public plugin_init()
  11. {
  12.     register_plugin( "Admin Stack( AMXX )", "1.0", "Xdoctor" );
  13.    
  14.     register_clcmd( "say", "CmdHandleSay" );
  15.    
  16.     register_clcmd( "say_team", "CmdHandleSay" );
  17. }
  18.  
  19. public CmdHandleSay( client )
  20. {
  21.     new szMsg[ 60 ], szArgs[ 2 ][ 40 ], iPlayer;
  22.    
  23.     read_argv( 1, szMsg, charsmax( szMsg ) );
  24.    
  25.     parse( szMsg, szArgs[ 0 ], charsmax( szArgs[] ), szArgs[ 1 ], charsmax( szArgs[] ) );
  26.    
  27.     if( equali( szArgs[ 0 ], "/stack" ) )
  28.     {
  29.         if( !get_user_flags( client ) && ADMIN_FLAG )
  30.             return ColorChat( client, "^1 this command can be used only by an admin^3." );
  31.        
  32.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  33.        
  34.         if( !iPlayer )
  35.             return ColorChat( client, "Target wasn't found !" );
  36.            
  37.         new ClientOrigin[ 3 ];
  38.        
  39.         get_user_origin( client, ClientOrigin, 1 );
  40.        
  41.         if( !contain( szArgs[ 0 ], "@all" ) )
  42.         {
  43.             ColorChat( client, "^4%s^1 You have ^3successfuly transfer ^4%s ^3to you !", GetUserName( client ), GetUserName( iPlayer ) );
  44.            
  45.             set_user_origin( iPlayer, ClientOrigin );
  46.         }
  47.            
  48.         else
  49.             if( contain( szArgs[ 0 ], "@all" ) )
  50.             {
  51.                 set_user_origin( 0, ClientOrigin );
  52.                
  53.                 ColorChat( client, "^4%s^1 You have ^3successfuly transfer every one to you !", GetUserName( client ) );
  54.             }
  55.         }
  56.    
  57.     return 0;
  58. }
  59.  
  60. stock GetUserName( const Index )
  61. {
  62.     static szName[ 32 ];
  63.        
  64.     get_user_name( Index, szName, charsmax( szName ) );
  65.            
  66.     return szName;
  67. }
  68.    
  69. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
  70. {
  71.     new msg[191], players[32], count = 1
  72.     static len
  73.     len = formatex(msg, charsmax(msg), "^1[ ^4AMXX ^1] " )
  74.     vformat(msg[len], charsmax(msg) - len, string, 3)
  75.     if(id)    players[0] = id
  76.     else    get_players(players,count,"ch")
  77.    
  78.     for (new i = 0; i < count; i++)
  79.     {
  80.         if(is_user_connected(players[i]))
  81.         {
  82.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
  83.             write_byte(players[i])
  84.             write_string(msg)
  85.             message_end()
  86.         }
  87.     }
  88.    
  89.     return 1;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement