Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

lala

By: a guest on Feb 1st, 2012  |  syntax: None  |  size: 5.16 KB  |  hits: 83  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <cstrike>
  5.  
  6. #define PLUGIN "SwapTeams&Scores"
  7. #define VERSION "1.0"
  8. #define AUTHOR "73"
  9.  
  10. new roundnumber = 0, ttpp, ctpp, ttsp, ctsp
  11. new bool:mitad
  12. new bool:score
  13.  
  14. public plugin_init()
  15. {
  16.         register_plugin(PLUGIN, VERSION, AUTHOR)
  17.        
  18.         register_event("TeamScore","Team_Score","a")
  19.         register_event("HLTV", "round_start", "a", "1=0", "2=0")
  20.         register_logevent("RoundEnd", 2, "1=Round_End" );
  21.         register_message(get_user_msgid("TeamScore"), "message_teamscore")
  22.         //register_event("TextMsg", "event_game_restart", "a","2=#Game_will_restart_in")  
  23. }
  24.  
  25. public Team_Score()
  26. {
  27.         new Team[2]
  28.         read_data(1, Team, sizeof(Team)-1)
  29.        
  30.         if (Team[0] == 'C')
  31.         ctpp = read_data(2)
  32.         else
  33.         ttpp = read_data(2)
  34. }
  35.  
  36. public round_start()
  37. {
  38.         score=false;
  39.         //mitad = false;
  40. }
  41.  
  42. /*public event_game_restart()
  43. {
  44.         score=true;
  45. }*/
  46.  
  47. public RoundEnd()
  48. {
  49.         roundnumber++;
  50.         score=true;
  51.        
  52.         if (roundnumber==5)
  53.         {
  54.                 ctsp = ttpp
  55.                 ttsp = ctpp
  56.                 mitad = true
  57.                 ttpp = 0
  58.                 ctpp = 0
  59.                 set_task(2.0, "cambio_lado")
  60.         }
  61. }
  62.  
  63. public message_teamscore()
  64. {
  65.         new szTeam[2]
  66.         get_msg_arg_string(1, szTeam, charsmax(szTeam))
  67.        
  68.         if(score)
  69.         {
  70.                 switch(szTeam[0])
  71.                 {
  72.                         case 'T': set_msg_arg_int(2, ARG_SHORT, ttpp)
  73.                         case 'C': set_msg_arg_int(2, ARG_SHORT, ctpp)
  74.                 }
  75.         }
  76.        
  77.         if((score) && (mitad))
  78.         {
  79.                 switch(szTeam[0])
  80.                 {
  81.                         case 'T': set_msg_arg_int(2, ARG_SHORT, ttpp + ttsp)
  82.                         case 'C': set_msg_arg_int(2, ARG_SHORT, ctpp + ctsp)
  83.                 }
  84.         }
  85. }
  86.  
  87. public cambio_lado()
  88. {
  89.         server_cmd("sv_restart 1")
  90.         set_task(0.1, "CmdSwapTeams")
  91.         //set_task(0.1, "CmdSwapScores",_,_,_,"b")
  92.         client_print(0, print_chat, "Cambio de Lado Teams & Scores.");
  93. }
  94.  
  95. public CmdSwapTeams()
  96. {
  97.     for( new i = 1; i <= get_maxplayers( ); i++ )
  98.     {
  99.         if( is_user_connected( i ) )
  100.         {
  101.             switch( cs_get_user_team( i ) )
  102.             {
  103.                 case CS_TEAM_T: cs_set_user_team( i, CS_TEAM_CT );            
  104.                 case CS_TEAM_CT: cs_set_user_team( i, CS_TEAM_T );
  105.             }
  106.         }
  107.     }
  108. }
  109.  
  110. /*public CmdSwapScores()
  111. {
  112.                 cs_set_team_score(CS_TEAM_T,ttpp + ttsp)
  113.                 cs_set_team_score(CS_TEAM_CT,ctpp + ctsp)
  114. }*/
  115.  
  116. //lol
  117. /*stock cs_set_team_score(CsTeams:team, const score)
  118. {    
  119.     new TeamName[10];
  120.    
  121.     switch(team)
  122.     {
  123.         case CS_TEAM_T: copy(TeamName , 9 , "TERRORIST");
  124.         case CS_TEAM_CT: copy(TeamName , 9 , "CT");
  125.     }    
  126.    
  127.     message_begin(MSG_ALL , get_user_msgid("TeamScore") , {0,0,0});
  128.     write_string(TeamName);
  129.     write_short(score);
  130.     message_end();
  131. }*/
  132.  
  133. //---------------------------------------------------------------------------------------------------------
  134.  
  135. //default
  136. /*stock cs_set_team_score( team , score )
  137. {    
  138.     new buffer[10];    
  139.    
  140.     switch(team)
  141.     {        
  142.         case 1: copy(buffer , 9 , "TERRORIST");
  143.         case 2: copy(buffer , 9 , "CT");
  144.        
  145.         default: return 0;    
  146.     }    
  147.    
  148.     message_begin(MSG_ALL , get_user_msgid("TeamScore") , {0,0,0});
  149.     write_string(buffer);
  150.     //write_byte(score); bug -1
  151.     write_short(score);
  152.     message_end();
  153.    
  154.     return 1;
  155. }*/
  156.  
  157. //csTeams
  158. /*stock cs_set_team_score(CsTeams:team, score)
  159. {    
  160.     new TeamName[10];
  161.    
  162.     switch(team)
  163.     {
  164.         case CS_TEAM_T: copy(TeamName , 9 , "TERRORIST");
  165.         case CS_TEAM_CT: copy(TeamName , 9 , "CT");
  166.     }    
  167.    
  168.     message_begin(MSG_ALL , get_user_msgid("TeamScore") , {0,0,0});
  169.     write_string(TeamName);
  170.     write_short(score);
  171.     message_end();
  172. }*/
  173.  
  174. //Bugsy
  175. /*stock cs_set_team_score( CsTeams:cstTeam , iScore )
  176. {    
  177.     if ( !( CS_TEAM_T <= cstTeam <= CS_TEAM_CT ) )
  178.         return 0;
  179.  
  180.     message_begin( MSG_ALL , get_user_msgid("TeamScore") , {0,0,0} );
  181.     write_string( cstTeam == CS_TEAM_T ? "TERRORIST" : "CT" );
  182.     write_byte( iScore );
  183.     message_end();
  184.    
  185.     return 1;
  186. }*/
  187.  
  188. //---------------------------------------------------------------------------------------------------------
  189.  
  190. //'-_-'
  191. /*stock cs_set_team_score( CsTeams:cstTeam , const iScore )
  192. {    
  193.     if ( !( CS_TEAM_T <= cstTeam <= CS_TEAM_CT ) )
  194.         return 0;
  195.        
  196.     new players[32], num
  197.     get_players(players, num)
  198.     new player
  199.     for(new i = 0; i < num; i++)
  200.     {
  201.             player = players[i]
  202.             message_begin(MSG_ONE , get_user_msgid("TeamScore") ,_ ,player );
  203.             write_string( cstTeam == CS_TEAM_T ? "TERRORIST" : "CT" );
  204.             write_short( iScore );
  205.             message_end();
  206.     }
  207.     return 1;
  208. }*/
  209.  
  210. //'-_-' #2
  211. /*stock cs_set_team_score(CsTeams:Team , score)
  212. {
  213.         read_data(1, Team)
  214.         //score = read_data(2)
  215.  
  216.         new players[32], num
  217.         get_players(players, num)
  218.  
  219.         for(new i = 0; i < num; i++)
  220.         {
  221.                 if (is_user_connected(players[i]))
  222.                 {
  223.                         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("TeamScore") ,_ ,players[i]);
  224.                         write_string( Team == CS_TEAM_T ? "TERRORIST" : "CT" );
  225.                         write_short(score);
  226.                         message_end();
  227.                 }
  228.         }
  229.        
  230.         return 1;
  231. }*/
  232.  
  233. //lalala
  234. /*stock cs_set_team_score(CsTeams:team, const score)
  235. {
  236.     message_begin(MSG_BROADCAST , get_user_msgid("TeamScore"));
  237.     write_string(team == CS_TEAM_T ? "TERRORIST" : "CT" );
  238.     write_short(score);
  239.     message_end();
  240. }*/