Advertisement
ColdWar-Pawn

Open & Close Cells - For accg.

Dec 29th, 2012
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.68 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < fakemeta >
  5.  
  6. new const plugin_info[ 3 ][ ] =
  7. {
  8.     "Open & Close Cells",
  9.     "v0.1",
  10.     "+ColdWar"
  11. }
  12.  
  13.  
  14. public plugin_init() {
  15.     register_plugin( plugin_info[ 0 ] , plugin_info[ 1 ] , plugin_info[ 2 ] )
  16.    
  17.     register_clcmd( "say /close", "CmdCloseCells" );
  18.     register_clcmd( "say !close", "CmdCloseCells" );
  19.    
  20.     register_clcmd( "say /open", "CmdOpenCells" );
  21.     register_clcmd( "say !open", "CmdOpenCells" );
  22. }
  23.  
  24. public CmdOpenCells( client )
  25. {
  26.     if( ( get_user_team( client ) != 2 || !is_user_alive( client ) ) && !( get_user_flags( client ) & ADMIN_KICK ) )
  27.         return 1;
  28.        
  29.     new szName[ 32 ];
  30.     get_user_name( client, szName, sizeof szName - 1 );
  31.     client_print( 0, 3, "%s has opened the cells!", szName );
  32.    
  33.     new ent = -1
  34.  
  35.     while( (ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "func_door" ) ) )
  36.         dllfunc( DLLFunc_Use, ent, 0 );
  37.        
  38.     ent = -1
  39.    
  40.     while( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "func_door_rotating" ) ) )
  41.         dllfunc( DLLFunc_Use, ent, 0 );
  42.    
  43.     return 0;
  44. }
  45.  
  46. public CmdCloseCells( client )
  47. {
  48.     if( ( get_user_team( client ) != 2 || !is_user_alive( client ) ) && !( get_user_flags( client ) & ADMIN_KICK ) )
  49.         return 1;
  50.    
  51.     new szName[ 32 ];
  52.     get_user_name( client, szName, sizeof szName - 1 );
  53.     client_print( 0, 3, "%s has closed the cells!", szName );
  54.    
  55.     new ent = -1
  56.  
  57.     while( (ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "func_door" ) ) )
  58.         dllfunc( DLLFunc_Think, ent, 0 );
  59.        
  60.     ent = -1
  61.    
  62.     while( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "func_door_rotating" ) ) )
  63.         dllfunc( DLLFunc_Think, ent, 0 );
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement