Advertisement
ISRaiyaN

Teleport Player - New

Oct 27th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.28 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < amxmisc >
  3. #include < fakemeta >
  4. #include < engine >
  5. #include < cstrike >
  6. #include < colorchat >
  7.  
  8. #define MaxPlayers get_maxplayers()
  9.  
  10. new Float: Origin[3];
  11.  
  12. new Prefix[] = "AMXX";
  13.  
  14. public plugin_init() {
  15.     register_plugin( "Teleport", "1.0", "ISRaiyaN" )
  16.    
  17.     register_clcmd( "say", "Teleport" )
  18. }
  19.  
  20. public Teleport( id )
  21. {
  22.     new Cmd[ 192 ], szArgs[ 3 ][ 32 ];
  23.    
  24.     read_argv( 1, Cmd, charsmax( Cmd ) )
  25.    
  26.     parse( Cmd, szArgs[ 0 ], 33, szArgs[ 1 ], 32, szArgs[ 2 ], 32 )
  27.    
  28.     if( equali( szArgs[ 0 ], "!tp" ) )
  29.     {
  30.         if(!( get_user_flags(id) & ADMIN_LEVEL_C ))
  31.         {
  32.             ColorChat( id, RED, "^3[ ^1%s ^3] ^1You don't have ^3Access ^1to this ^4Command^1!", Prefix )
  33.             return 1;
  34.         }
  35.        
  36.         new player1 = cmd_target( id, szArgs[ 1 ], 32 )
  37.         new player2 = cmd_target( id, szArgs[ 2 ], 32 )
  38.  
  39.         GetTP( player2 )
  40.        
  41.         if( equali( szArgs[ 1 ], "@t" ) )
  42.         {
  43.             for (new i=1; i <=MaxPlayers; i++)
  44.             {
  45.                 if( is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T )
  46.                     TP( i )
  47.             }
  48.             ColorChat( 0, RED, "^3[ ^1%s ^3] ^1ADMIN: ^3%s ^1Has ^3^"^4Teleported^3^" ^4All Terrorists ^1To ^3%s", Prefix, GetName( id ), GetName( player2 ) )
  49.            
  50.             return 1;
  51.         }
  52.         if( equali( szArgs[ 1 ], "@ct" ) )
  53.         {
  54.             for (new i=1; i <=MaxPlayers; i++)
  55.             {
  56.                 if( is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT )
  57.                     TP( i )
  58.             }
  59.             ColorChat( 0, RED, "^3[ ^1%s ^3] ^1ADMIN: ^3%s ^1Has ^3^"^4Teleported^3^" ^4All Counter-Terrorists ^1To ^3%s", Prefix, GetName( id ), GetName( player2 ) )
  60.            
  61.             return 1;
  62.         }
  63.         if( equali( szArgs[ 1 ], "@spec" ) )
  64.         {
  65.             for (new i=1; i <=MaxPlayers; i++)
  66.             {
  67.                 if( is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_SPECTATOR )
  68.                     TP( i )
  69.             }
  70.             ColorChat( 0, RED, "^3[ ^1%s ^3] ^1ADMIN: ^3%s ^1Has ^3^"^4Teleported^3^" ^4All Spectators ^1To ^3%s", Prefix, GetName( id ), GetName( player2 ) )
  71.            
  72.             return 1;
  73.         }
  74.         if( equali( szArgs[ 1 ], "@all" ) )
  75.         {
  76.             for (new i=1; i <=MaxPlayers; i++)
  77.             {
  78.                 if( is_user_alive(i) )
  79.                     TP( i )
  80.             }
  81.             ColorChat( 0, RED, "^3[ ^1%s ^3] ^1ADMIN: ^3%s ^1Has ^3^"^4Teleported^3^" ^4All Players ^1To ^3%s", Prefix, GetName( id ), GetName( player2 ) )
  82.            
  83.             return 1;
  84.         }
  85.         else
  86.         {
  87.             if( !player1 )
  88.             {
  89.                 ColorChat( id, RED, "^3[ ^1%s ^3] Error: ^1This player ( ^3%s ^1) was ^4Not Found^1 or There are more than^4 1 ^1player with that name.", Prefix, szArgs[ 1 ] )
  90.                 return 1;
  91.             }
  92.             if( !player2 )
  93.             {
  94.                 ColorChat( id, RED, "^3[ ^1%s ^3] Error: ^1This player ( ^3%s ^1) was ^4Not Found^1 or There are more than^4 1 ^1player with that name.", Prefix, szArgs[ 2 ] )
  95.                 return 1;
  96.             }
  97.             if( !is_user_alive( player1 ) )
  98.             {
  99.                 ColorChat( id, RED, "^3[ ^1%s ^3] Error: ^1This action could not perform on ^3^"^4Dead Client^3^"^1.", Prefix )
  100.                 return 1;
  101.             }
  102.             else
  103.             {
  104.                 TP( player1 )
  105.                 ColorChat( 0, RED, "^3[ ^1%s ^3] ^1ADMIN: ^3%s ^1Has ^3^"^4Teleported^3^" ^3%s ^1To ^3%s", Prefix, GetName( id ), GetName( player1 ), GetName( player2 ) )
  106.                 return 1;
  107.             }
  108.  
  109.         }
  110.     }  
  111.     return 0;
  112. }
  113.  
  114. stock TP( player )
  115.     entity_set_origin( player, Origin );
  116.  
  117. stock GetTP( player )
  118.     entity_get_vector( player, EV_VEC_origin, Origin );
  119.    
  120. stock GetName( player )
  121. {
  122.     new szName[ 32 ];
  123.     get_user_name( player, szName, charsmax( szName ) );
  124.    
  125.     return szName;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement