#include <amxmodx>
#include <reapi>
#include <aes_v>
enum any:CVARS {
BONUS_FOR_WINTEAM_ROUND,
Float:EXP_FOR_WINTEAM_ROUND,
WITHDRAWING_BONUS_LOSERS_ROUND,
Float:WITHDRAWING_EXP_LOSERS_ROUND,
BONUS_FOR_WINTEAM_MAP,
Float:EXP_FOR_WINTEAM_MAP,
WITHDRAWING_BONUS_LOSERS_MAP,
Float:WITHDRAWING_EXP_LOSERS_MAP
}
new g_Cvar[CVARS];
new g_MinPlayers;
public plugin_init() {
register_plugin("", "", "");
RegisterHookChain(RG_RoundEnd, "RoundEnd_Post", true);
RegisterHookChain(RG_CSGameRules_GoToIntermission, "CSGameRules_GoToIntermission_Post", true);
RegisterCvars();
AutoExecConfig(true, "aes_exp_on_win");
}
public OnConfigsExecuted() {
bind_pcvar_num(get_cvar_pointer("aes_xp_goal_min_players"), g_MinPlayers);
}
public RoundEnd_Post(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay) {
if(status != WINSTATUS_CTS && status != WINSTATUS_TERRORISTS){
return HC_CONTINUE;
}
if(get_playersnum() < g_MinPlayers) {
return HC_CONTINUE;
}
new players[MAX_PLAYERS], num;
get_players(players, num, "ch");
for(new i, player; i < num; i++) {
player = players[i];
switch(get_member(player, m_iTeam)) {
case TEAM_CT: {
if(status == WINSTATUS_CTS) {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы получили ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за победу в раунде!",
g_Cvar[EXP_FOR_WINTEAM_ROUND], g_Cvar[BONUS_FOR_WINTEAM_ROUND]
);
aes_add_player_exp_f(player, g_Cvar[EXP_FOR_WINTEAM_ROUND]);
aes_add_player_bonus_f(player, g_Cvar[BONUS_FOR_WINTEAM_ROUND]);
} else {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы потеряли ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за проигрыш в раунде!",
g_Cvar[WITHDRAWING_EXP_LOSERS_ROUND], g_Cvar[WITHDRAWING_BONUS_LOSERS_ROUND]
);
aes_add_player_exp_f(player, -g_Cvar[WITHDRAWING_EXP_LOSERS_ROUND]);
aes_add_player_bonus_f(player, -g_Cvar[WITHDRAWING_BONUS_LOSERS_ROUND]);
}
}
case TEAM_TERRORIST: {
if(status == WINSTATUS_TERRORISTS) {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы получили ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за победу в раунде!",
g_Cvar[EXP_FOR_WINTEAM_ROUND], g_Cvar[BONUS_FOR_WINTEAM_ROUND]
);
aes_add_player_exp_f(player, g_Cvar[EXP_FOR_WINTEAM_ROUND]);
aes_add_player_bonus_f(player, g_Cvar[BONUS_FOR_WINTEAM_ROUND]);
} else {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы потеряли ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за проигрыш в раунде!",
g_Cvar[WITHDRAWING_EXP_LOSERS_ROUND], g_Cvar[WITHDRAWING_BONUS_LOSERS_ROUND]
);
aes_add_player_exp_f(player, -g_Cvar[WITHDRAWING_EXP_LOSERS_ROUND]);
aes_add_player_bonus_f(player, -g_Cvar[WITHDRAWING_BONUS_LOSERS_ROUND]);
}
}
}
}
return HC_CONTINUE;
}
public CSGameRules_GoToIntermission_Post() {
if(get_playersnum() < g_MinPlayers) {
return HC_CONTINUE;
}
new players[MAX_PLAYERS], num;
get_players(players, num, "ch");
new NumTerroristsWins = get_member_game(m_iNumTerroristWins);
new NumCTWin = get_member_game(m_iNumCTWins);
for(new i, player; i < num; i++) {
player = players[i];
switch(get_member(player, m_iTeam)) {
case TEAM_CT: {
if(NumCTWin > NumTerroristsWins) {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы получили ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за победу на карте!",
g_Cvar[EXP_FOR_WINTEAM_MAP], g_Cvar[BONUS_FOR_WINTEAM_MAP]
);
aes_add_player_exp_f(player, g_Cvar[EXP_FOR_WINTEAM_MAP]);
aes_add_player_bonus_f(player, g_Cvar[BONUS_FOR_WINTEAM_MAP]);
} else {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы потеряли ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за проигрыш на карте!",
g_Cvar[WITHDRAWING_EXP_LOSERS_MAP], g_Cvar[WITHDRAWING_BONUS_LOSERS_MAP]
);
aes_add_player_exp_f(player, -g_Cvar[WITHDRAWING_EXP_LOSERS_MAP]);
aes_add_player_bonus_f(player, -g_Cvar[WITHDRAWING_BONUS_LOSERS_MAP]);
}
}
case TEAM_TERRORIST: {
if(NumTerroristsWins > NumCTWin) {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы получили ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за победу на карте!",
g_Cvar[EXP_FOR_WINTEAM_MAP], g_Cvar[BONUS_FOR_WINTEAM_MAP]
);
aes_add_player_exp_f(player, g_Cvar[EXP_FOR_WINTEAM_MAP]);
aes_add_player_bonus_f(player, g_Cvar[BONUS_FOR_WINTEAM_MAP]);
} else {
client_print_color(player, print_team_red,
"[^4STATS^1] Вы потеряли ^3[^4%0.0f Опыта^3] [^4%d Бонусов^3] ^1за проигрыш на карте!",
g_Cvar[WITHDRAWING_EXP_LOSERS_MAP], g_Cvar[WITHDRAWING_BONUS_LOSERS_MAP]
);
aes_add_player_exp_f(player, -g_Cvar[WITHDRAWING_EXP_LOSERS_MAP]);
aes_add_player_bonus_f(player, -g_Cvar[WITHDRAWING_BONUS_LOSERS_MAP]);
}
}
}
}
return HC_CONTINUE;
}
RegisterCvars() {
bind_pcvar_num(
create_cvar(
.name = "aes_bonus_winteam",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Количество бонусов, которое будет выдаваться выигравшей команде за раунд",
.has_min = true,
.min_val = 0.0
), g_Cvar[BONUS_FOR_WINTEAM_ROUND]
);
bind_pcvar_float(
create_cvar(
.name = "aes_exp_winteam",
.string = "5.0",
.flags = FCVAR_SERVER,
.description = "Количество опыта, которое будет выдаваться выигравшей команде за раунд",
.has_min = true,
.min_val = 0.0
), g_Cvar[EXP_FOR_WINTEAM_ROUND]
);
bind_pcvar_num(
create_cvar(
.name = "aes_withdrawing_bonus_loser_team",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Количество бонусов, которое будет отниматься у проигравшей команды за раунд",
.has_min = true,
.min_val = 0.0
), g_Cvar[WITHDRAWING_BONUS_LOSERS_ROUND]
);
bind_pcvar_float(
create_cvar(
.name = "aes_withdrawing_exp_loser_team",
.string = "5.0",
.flags = FCVAR_SERVER,
.description = "Количество опыта, которое будет отниматься у проигравшей команды за раунд",
.has_min = true,
.min_val = 0.0
), g_Cvar[WITHDRAWING_EXP_LOSERS_ROUND]
);
bind_pcvar_num(
create_cvar(
.name = "aes_bonus_winteam_map",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Количество бонусов, которое будет выдаваться выигравшей команде на текущей карте",
.has_min = true,
.min_val = 0.0
), g_Cvar[BONUS_FOR_WINTEAM_MAP]
);
bind_pcvar_float(
create_cvar(
.name = "aes_exp_winteam_map",
.string = "5.0",
.flags = FCVAR_SERVER,
.description = "Количество опыта, которое будет выдаваться выигравшей команде на текущей карте",
.has_min = true,
.min_val = 0.0
), g_Cvar[EXP_FOR_WINTEAM_MAP]
);
bind_pcvar_num(
create_cvar(
.name = "aes_withdrawing_bonus_loser_team_map",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Количество бонусов, которое будет отниматься у проигравшей команды на текущей карте",
.has_min = true,
.min_val = 0.0
), g_Cvar[WITHDRAWING_BONUS_LOSERS_MAP]
);
bind_pcvar_float(
create_cvar(
.name = "aes_withdrawing_exp_loser_team_map",
.string = "5.0",
.flags = FCVAR_SERVER,
.description = "Количество опыта, которое будет отниматься у проигравшей команды на текущей карте",
.has_min = true,
.min_val = 0.0
), g_Cvar[WITHDRAWING_EXP_LOSERS_MAP]
);
}