HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include < amxmodx >
  2. #include < amxmisc >
  3. #include < hamsandwich >
  4.  
  5. #define TAG "^x04[AMXX]^x01"
  6. #define FCVARS (FCVAR_SERVER | FCVAR_PROTECTED)
  7.  
  8. static const dates[ ][ ] =
  9. {
  10. "Headshot Verseny...",
  11. "1.8",
  12. "Keszitette: Luggas | Forditotta: Chris"
  13. }
  14.  
  15. new const name_cvar[ ][ ] = {
  16. "amx_headshots_logs",
  17. "amx_headshots_saymode"
  18. }
  19.  
  20. new const value_cvar[ ][ ] = {
  21. "1",
  22. "0"
  23. }
  24.  
  25. /* Enums */
  26. enum
  27. {
  28. CVAR_LOGS = 0,
  29. CVAR_SAYMODE,
  30. }
  31.  
  32. enum
  33. {
  34. PLUGIN_NAME,
  35. PLUGIN_VERSION,
  36. PLUGIN_AUTHOR
  37. }
  38. /* Enums End*/
  39.  
  40. new cvars[2]
  41.  
  42. new g_mostheadshots[33]
  43.  
  44. public plugin_init() {
  45. register_plugin( dates[PLUGIN_NAME], dates[PLUGIN_VERSION], dates[PLUGIN_AUTHOR])
  46.  
  47. register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" );
  48.  
  49. register_event( "30" , "event_intermission" , "a" );
  50.  
  51. register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
  52.  
  53. cvars[0] = register_cvar( name_cvar[CVAR_LOGS] , value_cvar[CVAR_LOGS] );
  54. cvars[1] = register_cvar( name_cvar[CVAR_SAYMODE], value_cvar[CVAR_SAYMODE]);
  55.  
  56.  
  57. register_cvar( "Best Player Headshot | SQL" , dates[PLUGIN_AUTHOR] , FCVARS );
  58.  
  59. register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_will_restart_in");
  60.  
  61. register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing" );
  62.  
  63. }
  64.  
  65. public Event_GameRestart( ) arrayset( g_mostheadshots, 0, 33 )
  66. public client_disconnect( id ) g_mostheadshots[ id ] = 0
  67. public event_intermission( ) set_task( 0.1, "BestHeadPlayer")
  68.  
  69. public event_round_start( )
  70. {
  71. if( get_pcvar_num( cvars[1] ) )
  72. set_task(0.1, "BestHeadPlayer");
  73. }
  74. public BestHeadPlayer( )
  75. {
  76. new iPlayers[ 32 ], iNum
  77. get_players( iPlayers, iNum )
  78.  
  79. if( !iNum )
  80. {
  81. return;
  82. }
  83.  
  84. new iBestPlayerHeadshot = iPlayers[ 0 ]
  85.  
  86. for(new i = 1, id; i < iNum; i++)
  87. {
  88. id = iPlayers[ i ]
  89.  
  90. if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ])
  91. {
  92. iBestPlayerHeadshot = id
  93. }
  94. }
  95.  
  96. new szName[ 32 ]
  97. get_user_name( iBestPlayerHeadshot , szName , charsmax(szName) )
  98. if(g_mostheadshots[ iBestPlayerHeadshot ] > 0)
  99. Color( 0, "[AMXX] A nyertes pedig nemmas mint: %s összesen %d fejessel" , TAG , szName , g_mostheadshots[ iBestPlayerHeadshot ] , g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : "." )
  100. else
  101. Color( 0, "[AMXX] Senki nem nyert ezen a mapon!", TAG )
  102.  
  103. if( !cvars[1] && cvars[0] && g_mostheadshots[ iBestPlayerHeadshot ] > 0) {
  104. static mapname[ 32 ]
  105. get_mapname(mapname, sizeof mapname - 1)
  106.  
  107. static Steam[ 32 ]
  108. get_user_authid( iBestPlayerHeadshot, Steam, charsmax(Steam))
  109.  
  110. log_to_file( "best_headshot.log" , "Map %s | Legjobb jatekos: %s | Fejesek: %d | STEAM ID: %s" , mapname , szName , g_mostheadshots[ iBestPlayerHeadshot ], Steam)
  111. }
  112. return
  113. }
  114.  
  115. public Event_DeathMsg( )
  116. {
  117. new iAttack = read_data( 1 )
  118.  
  119. if ( read_data( 2 ) != iAttack )
  120. g_mostheadshots[ iAttack ]++
  121.  
  122. return PLUGIN_HANDLED
  123. }
  124.  
  125. stock Color( const id , const input[ ] , any:... )
  126. {
  127. new count = 1, players[ 32 ]
  128. static msg[ 191 ]
  129. vformat( msg , 190 , input , 3 )
  130.  
  131. replace_all( msg , 190 , "^x04" , "^4") // Green Color
  132. replace_all( msg, 190 , "^x01" , "^1") // Default Color
  133. replace_all( msg, 190 , "!team" , "^3") // Team Color
  134. replace_all( msg, 190 , "!team2" , "^0") // Team2 Color
  135.  
  136. if ( id ) players[ 0 ] = id; else get_players( players , count , "ch" )
  137. {
  138. for (new i = 0; i < count; i++)
  139. {
  140. if (is_user_connected( players[ i ] ))
  141. {
  142. message_begin( MSG_ONE_UNRELIABLE , get_user_msgid("SayText") , _ , players[ i ] )
  143. write_byte( players[ i ] );
  144. write_string( msg );
  145. message_end( );
  146. }
  147. }
  148. }
  149. }
  150. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  151. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  152. */
  153.