- #include < amxmodx > 
- #include < amxmisc > 
- #include < hamsandwich > 
- #include < colorchat > 
-   
- #define TAG "^x04[AMXX]^x01" 
- #define FCVARS (FCVAR_SERVER | FCVAR_PROTECTED) 
-   
- static const dates[ ][ ] = 
- { 
- "Headshot Verseny...", 
- "1.8", 
- "Keszitette: Luggas | Forditotta: Chris" 
- } 
-   
- new const name_cvar[ ][ ] = { 
- "amx_headshots_logs", 
- "amx_headshots_saymode" 
- } 
-   
- new const value_cvar[ ][ ] = { 
- "1", 
- "0" 
- } 
-   
- /* Enums */ 
- enum 
- { 
- CVAR_LOGS = 0, 
- CVAR_SAYMODE, 
- } 
-   
- enum 
- { 
- PLUGIN_NAME, 
- PLUGIN_VERSION, 
- PLUGIN_AUTHOR 
- } 
- /* Enums End*/ 
-   
- new cvars[2] 
-   
- new g_mostheadshots[33] 
-   
- public plugin_init() { 
- register_plugin( dates[PLUGIN_NAME], dates[PLUGIN_VERSION], dates[PLUGIN_AUTHOR]) 
-   
- register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" ); 
-   
- register_event( "30" , "event_intermission" , "a" ); 
-   
- register_event("HLTV", "event_round_start", "a", "1=0", "2=0"); 
-   
- cvars[0] = register_cvar( name_cvar[CVAR_LOGS] , value_cvar[CVAR_LOGS] ); 
- cvars[1] = register_cvar( name_cvar[CVAR_SAYMODE], value_cvar[CVAR_SAYMODE]); 
-   
-   
- register_cvar( "Best Player Headshot | SQL" , dates[PLUGIN_AUTHOR] , FCVARS ); 
-   
- register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_will_restart_in"); 
-   
- register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing" ); 
-   
- } 
-   
- public Event_GameRestart( ) arrayset( g_mostheadshots, 0, 33 ) 
- public client_disconnect( id ) g_mostheadshots[ id ] = 0 
- public event_intermission( ) set_task( 0.1, "BestHeadPlayer") 
-   
- public event_round_start( ) 
- { 
- if( get_pcvar_num( cvars[1] ) ) 
- set_task(0.1, "BestHeadPlayer"); 
- } 
- public BestHeadPlayer( ) 
- {	 
- new iPlayers[ 32 ], iNum 
- get_players( iPlayers, iNum ) 
-   
- if( !iNum ) 
- { 
- return; 
- } 
-   
- new iBestPlayerHeadshot = iPlayers[ 0 ] 
-   
- for(new i = 1, id; i < iNum; i++) 
- { 
- id = iPlayers[ i ] 
-   
- if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ]) 
- { 
- iBestPlayerHeadshot = id 
- } 
- } 
-   
- new szName[ 32 ] 
- get_user_name( iBestPlayerHeadshot , szName , charsmax(szName) ) 
- if(g_mostheadshots[ iBestPlayerHeadshot ] > 0) 
- ColorChat(0, GREEN, "[Just]^1 A nyertes pedig nem mas mint:^4 %s^1 osszesen^4 %d^1 fejessel!" , TAG , szName , g_mostheadshots[ iBestPlayerHeadshot ] , g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : "." ) 
- else 
- ColorChat(0, GREEN, "[Just]^1 Senki nem nyert ebben a korben!", TAG ) 
-   
- if( !cvars[1] && cvars[0] && g_mostheadshots[ iBestPlayerHeadshot ] > 0) { 
- static mapname[ 32 ] 
- get_mapname(mapname, sizeof mapname - 1) 
-   
- static Steam[ 32 ] 
- get_user_authid( iBestPlayerHeadshot, Steam, charsmax(Steam)) 
-   
- log_to_file( "best_headshot.log" , "Palya %s | Legjobb jatekos: %s | Fejesek: %d | STEAM ID: %s" , mapname , szName , g_mostheadshots[ iBestPlayerHeadshot ], Steam) 
- } 
- return 
- } 
-   
- public Event_DeathMsg( ) 
- { 
- new iAttack = read_data( 1 ) 
-   
- if ( read_data( 2 ) != iAttack ) 
- g_mostheadshots[ iAttack ]++ 
-   
- return PLUGIN_HANDLED 
- }