Скриптер
Участник
Пользователь
- Сообщения
- 458
- Реакции
- 263
- Помог
- 9 раз(а)
malniata, если кт и тт останутся 1х1, то у последнего оставшегося звука не будет.
Код:
#include <amxmodx>
#include <reapi>
#if AMXX_VERSION_NUM < 183
new MaxClients;
#endif
// to /cstrike/sound
new const MUSIC_FILE[] = "lasthuman.wav"; // sound .wav
new bool: g_alreadyPlayed[3];
public plugin_precache()
{
precache_sound(MUSIC_FILE);
}
public plugin_init()
{
register_plugin("Last Players","0.2","alabamaster1337 & dev-cs");
RegisterHookChain(RG_CBasePlayer_Killed, "HC_CBasePlayer_Killed_Post", true);
RegisterHookChain(RH_SV_DropClient, "HookDropClient", .post=true);
RegisterHookChain(RG_CSGameRules_RestartRound, "GameRules_RestartRound", .post=true);
#if AMXX_VERSION_NUM < 183
MaxClients = get_maxplayers();
#endif
}
public GameRules_RestartRound()
for (new i; i < 3; i++)
g_alreadyPlayed[i] = false;
public HookDropClient()
check_last_players();
// amx-x.ru
public HC_CBasePlayer_Killed_Post()
check_last_players();
check_last_players() {
new players[TeamName], playerId[TeamName];
for (new id = 1; id <= MaxClients; id++)
{
if (is_user_alive(id) && (TEAM_UNASSIGNED < get_member(id, m_iTeam) < TEAM_SPECTATOR))
{
players[get_member(id, m_iTeam)]++;
playerId[get_member(id, m_iTeam)] = id;
}
}
new untitled = -1;
if (!g_alreadyPlayed[0] && (players[TEAM_CT] < 2 > players[TEAM_TERRORIST]))
{
rg_send_audio([playerId[TEAM_CT], MUSIC_FILE);
rg_send_audio([playerId[TEAM_TERRORIST], MUSIC_FILE);
untitled = 0;
}
else if (!g_alreadyPlayed[1] && players[TEAM_CT] == 1 && players[TEAM_TERRORIST] > 1)
{
rg_send_audio([playerId[TEAM_CT], MUSIC_FILE);
untitled = 1;
}
else if (!g_alreadyPlayed[2] && players[TEAM_TERRORIST] == 1 && players[TEAM_CT] > 1)
{
rg_send_audio([playerId[TEAM_TERRORIST], MUSIC_FILE);
untitled = 2;
}
if (untitled == -1)
return;
g_alreadyPlayed[untitled] = true;
}