Всем привет! Попался под руку плагин bestheadshot.amxx, суть в том что в конце мапы показывает лучшего хедшотера мапы.
Скажите как изменить его что бы он показывал того кто сделал больше всего фрагов а не хедшотов.
Код
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "And the Winner with Most Headshot Is..."
#define VERSION "1.5"
#define AUTHOR "Luqqas' alias lucas_7_94"
new g_mostheadshots[33], cvar_logs
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg","Event_DeathMsg","a","3=1")
register_event("30","event_intermission","a")
cvar_logs = register_cvar("amx_headshots_logs", "0")
register_cvar("Best Player Headshot", AUTHOR, FCVAR_SERVER|FCVAR_PROTECTED)
}
public client_disconnect( id ) g_mostheadshots[ id ] = 0
public event_intermission( ) 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
}
}
static szName[32]
get_user_name(iBestPlayerHeadshot,szName,charsmax(szName))
ChatColor(0, "!g[!yWinner!g]!y Победителем на этой карте становится !g%s!y сделал !g%d!y Headshot%s",szName, g_mostheadshots[iBestPlayerHeadshot], g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : ".")
ChatColor(0, "!g[!yWinner!g]!y Победителем на этой карте становится !g%s!y сделал !g%d!y Headshot%s",szName, g_mostheadshots[iBestPlayerHeadshot], g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : ".")
ChatColor(0, "!g[!yWinner!g]!y Победителем на этой карте становится !g%s!y сделал !g%d!y Headshot%s",szName, g_mostheadshots[iBestPlayerHeadshot], g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : ".")
if(get_pcvar_num(cvar_logs)) {
static mapname[32]
get_mapname(mapname, sizeof mapname - 1)
log_to_file("best_headshot.log", "Map %s | Best Player: %s | Headshot's: %d", mapname, szName, g_mostheadshots[iBestPlayerHeadshot])
}
//return PLUGIN_HANDLED
}
public Event_DeathMsg( ) // Thanks Asd' (Fraan') From the help in this code :)
{
new iAttack = read_data( 1 )
new iVictim = read_data( 2 )
new iHead = read_data( 3 )
if( iVictim && iHead )
g_mostheadshots[ iAttack ]++
}
stock ChatColor(const id, const input[], any:...) // Подключаем сток,который будет читать наши цветные сообщения.
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}