P1xeL

open 7:30

Jul 3rd, 2012
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.72 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < amxmisc >
  3. #include < fakemeta >
  4. #include < hamsandwich >
  5.  
  6. #pragma semicolon 1
  7.  
  8. #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
  9. #define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
  10.  
  11. enum _:Teams
  12. {
  13.     FM_TEAM_UNASSIGNED,
  14.     FM_TEAM_T,
  15.     FM_TEAM_CT,
  16.     FM_TEAM_SPECTATOR
  17. };
  18.  
  19. new bool:g_open;
  20.  
  21. public plugin_init() {
  22.     register_plugin( "Deluxe JailBreak - Addons", "0.0.1", "CreePs" );
  23.    
  24.     register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
  25.    
  26.     register_saycmd( "open", "cmdOpen", 0, "- open the jail's" );
  27. }
  28. public event_round_start()
  29. {
  30.     g_open = false;
  31.     set_task(60.0 * 1.5, "AutocmdOpen");
  32. }
  33.  
  34. public cmdOpen( client )
  35. {
  36.     if( ! is_user_can( client ) )
  37.         return;
  38.        
  39.     new ent = -1;
  40.    
  41.     while( ( ent = fm_find_ent_by_class( ent, "func_button" ) ) )
  42.     {                  
  43.         dllfunc( DLLFunc_Use, ent, 0 );
  44.     }  
  45.    
  46.     new name[ 32 ];
  47.     get_user_name( client, name, sizeof( name ) - 1 );
  48.     g_open = true;
  49.    
  50.     ColorChat( 0, "Guard:^4 %s^1 has open the jail's!", name );
  51. }
  52.  
  53. public AutocmdOpen()
  54. {
  55.     if(g_open == false)
  56.     {
  57.         new ent = -1;
  58.        
  59.         while( ( ent = fm_find_ent_by_class( ent, "func_button" ) ) )
  60.         {              
  61.             dllfunc( DLLFunc_Use, ent, 0 );
  62.         }
  63.        
  64.         //Do FD all
  65.     }
  66. }
  67.  
  68. bool:is_user_can( client )
  69. {
  70.     if( fm_get_user_team( client ) != FM_TEAM_CT )
  71.     {
  72.         ColorChat( client, "This command is only for ct's!" );
  73.         return false;
  74.     }
  75.    
  76.     if( ! is_user_alive( client ) )
  77.     {
  78.         ColorChat( client, "You need to be alive!" );
  79.         return false;
  80.     }
  81.    
  82.     return true;
  83. }
  84.        
  85. register_saycmd( saycommand[], function[], flags, info[] )
  86. {
  87.     new temp[ 64 ];
  88.     format( temp, 63, "say /%s", saycommand );
  89.     register_clcmd( temp, function, flags, info );
  90.     format( temp, 63, "say .%s", saycommand );
  91.     register_clcmd( temp, function, flags, info );
  92.     format( temp, 63, "say_team /%s", saycommand );
  93.     register_clcmd( temp, function, flags, info );
  94.     format( temp, 63, "say_team .%s", saycommand );
  95.     register_clcmd( temp, function, flags, info );
  96. }
  97.  
  98. stock fm_get_user_team( client )
  99. {
  100.     return get_pdata_int( client, 114 );
  101. }
  102.  
  103. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
  104.     new msg[191], players[32], count = 1;
  105.    
  106.     static len;
  107.     len = formatex(msg, charsmax(msg), "^x01[^x04 Deluxe JailBreak^x01 ] ");
  108.     vformat(msg[len], charsmax(msg) - len, string, 3);
  109.    
  110.     if(id)
  111.         players[0] = id;
  112.     else
  113.         get_players(players,count,"ch");
  114.    
  115.     for (new i = 0; i < count; i++)
  116.     {
  117.         if(is_user_connected(players[i]))
  118.         {
  119.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
  120.             write_byte(players[i]);
  121.             write_string(msg);
  122.             message_end();
  123.         }
  124.     }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment