Участник
Пользователь
- Сообщения
- 52
- Реакции
- 60
- Помог
- 2 раз(а)
Код:
#include <amxmodx>
#include <csx>
#include <reapi>
#define _SEND_AUDIO rg_send_audio
const MIN_FRAGS = 10;
new bool:g_bBlock[33];
new g_iFragStats[33];
#define FRAGS 0
//#define DEATHS 1
//#define HS 2
//#define TK 3
//#define SHOTS 4
//#define HITS 5
//#define DAMAGE 6
#define RANK 7
#define ASSIST HIT_RIGHTLEG + 1
#define SKILL ASSIST + 1
#define GAMETIME SKILL + 1
#define LASTCON GAMETIME + 1
#define ARRSIZE_STATS RANK + 1
#define ARRSIZE_BODY LASTCON + 1
new const SOUND__ERROR[] = "buttons/button2.wav"
public plugin_init() {
register_plugin("Voice and say controller", "1.0", "unknown");
register_event("HLTV", "Round_Start", "a", "1=0", "2=0");
register_clcmd("say", "clcmd_Say");
register_clcmd("say_team", "clcmd_Say");
RegisterHookChain(RG_CSGameRules_CanPlayerHearPlayer, "CanPlayerHearPlayer_Pre");
}
public CanPlayerHearPlayer_Pre(iReceiver, iSender) {
if(g_bBlock[iSender]) {
SetHookChainReturn(ATYPE_BOOL, false)
return HC_SUPERCEDE
}
return HC_CONTINUE
}
public clcmd_Say(id) {
if(g_bBlock[id]) {
client_print_color(id, print_team_default, "^4[Online] ^1Доступ к текстовому и голосовому чатам ^4закрыт^1!");
client_print_color(id, print_team_default, "^4[Online] ^1Необходимо набрать ^3%i^4/^3%i ^1фрагов", g_iFragStats[id], MIN_FRAGS);
_SEND_AUDIO(id, SOUND__ERROR)
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public Round_Start() {
new players[32], pnum;
get_players(players, pnum, "ch");
for(new i, id; i < pnum; ++i) {
id = players[i];
if(get_access(id)) {
g_bBlock[id] = false;
}
else {
g_bBlock[id] = true;
client_print_color(id, print_team_default, "^4[Online] ^1Доступ к текстовому и голосовому чатам ^4закрыт^1!");
client_print_color(id, print_team_default, "^4[Online] ^1Необходимо набрать ^3%i^4/^3%i ^1фрагов", g_iFragStats[id], MIN_FRAGS);
}
}
}
public client_putinserver(id) {
if(!get_access(id)) {
g_bBlock[id] = true;
}
}
bool:get_access(id) {
new st[ARRSIZE_STATS], bh[ARRSIZE_BODY];
if(!get_user_stats(id, st, bh)) {
return false;
}
else {
g_iFragStats[id] = st[FRAGS];
return (st[FRAGS] < MIN_FRAGS) ? false : true;
}
}
Последнее редактирование: