daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include < amxmodx >
  2.  
  3. #define PLUGIN "AutoRRound"
  4. #define VERSION "1.2"
  5. #define AUTHOR "syRex"
  6.  
  7. #define HUD_MESSAGES
  8. #define MAX_COUNT 1
  9.  
  10. new g_Count
  11.  
  12. public plugin_precache()    precache_generic("sound/autorestart/sunet.mp3");
  13.  
  14. public plugin_init()
  15. {
  16.    register_plugin( PLUGIN, VERSION, AUTHOR )
  17.    register_event( "TextMsg", "event_gamecomencing", "a", "2&#Game_C" )
  18.    
  19.    register_event( "HLTV", "event_newround", "a", "1=0","2=0" )
  20.    state START_FUNCTION
  21. }
  22.  
  23. public event_gamecomencing() g_Count = 0
  24.  
  25. public event_newround() < BLOCK_FUNCTION > { }
  26. public event_newround() < START_FUNCTION >
  27. {
  28.     if(g_Count++ == MAX_COUNT) {
  29.         server_cmd("sv_restart 1");
  30.  
  31.         new Players[32], Num;
  32.         get_players(Players, Num);
  33.         new iSeconds = 2;
  34.  
  35.         new x = clamp((iSeconds * (1<<12)), 0, 0xFFFF);
  36.  
  37.         for(new i = 0; i < Num; i++)
  38.         {
  39.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, Players[i]);
  40.             write_short(x);
  41.             write_short(x);
  42.             write_short(0x0001);
  43.             write_byte(0);
  44.             write_byte(127);
  45.             write_byte(255);
  46.             write_byte(255);
  47.             message_end();
  48.  
  49.             SendCMD("mp3 play sound/autorestart/sunet.mp3", Players[i]);
  50.         }
  51.  
  52.  
  53.         #if defined HUD_MESSAGES
  54.         set_task(1.0, "show_messages");
  55.         #endif
  56.         state BLOCK_FUNCTION
  57.     }
  58. }
  59.  
  60. public show_messages() {
  61.     Print(0, "^x04Live^x01 #^x04 Live^x01 #^x04 Live^x01 #^x04 Live");
  62.  
  63.     new Players = get_playersnum();
  64.     new Max = get_maxplayers();
  65.     Print(0, "^x04[Auto Restart]^x01 We have^x03 %d^x01 /^x03 %d^x01 players", Players, Max);
  66.  
  67.     new map[32];
  68.     get_mapname(map, charsmax(map));
  69.     Print(0, "^x04[Auto Restart]^x01 We're playing on^x03 %s", map);
  70.     Print(0, "^x04Live^x01 #^x04 Live^x01 #^x04 Live^x01 #^x04 Live");
  71.    
  72. }
  73.  
  74. stock SendCMD(const text[], Player=0)
  75. {
  76.     message_begin(MSG_ONE, 51, _, Player);
  77.     write_byte(strlen(text) + 2);
  78.     write_byte(10);
  79.     write_string(text);
  80.     message_end();
  81. }
  82.  
  83. stock Print(const id, const input[], any:...) {
  84.     new count = 1, players[32];
  85.     static msg[191];
  86.     vformat(msg, 190, input, 3);
  87.    
  88.     if(id) players[0] = id;
  89.     else get_players(players, count, "ch"); {
  90.         for(new i = 0; i < count; i++) {
  91.             if(is_user_connected(players[i])) {
  92.                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  93.                 write_byte(players[i]);
  94.                 write_string(msg);
  95.                 message_end();
  96.             }
  97.         }
  98.     }
  99. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top