Участник
Пользователь
- Сообщения
- 1,082
- Реакции
- 58
- Помог
- 11 раз(а)
тоже самое,Code_0xABC, можно по подробнее что делает данный сток?
VIP_TIME(18, 6)
с 18:00 по 6:00ааа, понял, с помощью этого можно быстро настроить время начала и концатоже самое
#include <amxmodx>
#include <hamsandwich>
enum CVARS {
WEEKEND_MODE[32],
NIGHT_MODE[32],
GIVE_FLAG[4],
HAVE_FLAG[4]
};
new g_eCvars[CVARS];
enum FlagsVIP {
GIVE,
HAVE
};
new g_eFlagsVIP[FlagsVIP];
new g_szSelectedMode[32];
public plugin_init() {
register_plugin("Night & Weekend VIP", "0.0.1", "Albertio");
RegisterHam(Ham_Spawn, "player", "PlayerSpawn_Post", true);
RegisterCvars();
AutoExecConfig(true, "night_weekend_vip");
if(g_eCvars[WEEKEND_MODE][0] != EOS)
if(UTIL_IsWeekendMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[WEEKEND_MODE]);
if(g_eCvars[NIGHT_MODE][0] != EOS && g_szSelectedMode[0] == EOS)
if(UTIL_IsNightMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[NIGHT_MODE]);
g_eFlagsVIP[GIVE] = read_flags(g_eCvars[GIVE_FLAG]);
g_eFlagsVIP[HAVE] = read_flags(g_eCvars[HAVE_FLAG]);
}
public client_putinserver(id) {
if(is_user_bot(id) || is_user_hltv(id))
return;
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
}
public PlayerSpawn_Post(id) {
if(g_szSelectedMode[0] != EOS && ~get_user_flags(id) & g_eFlagsVIP[HAVE] && is_user_alive(id)) {
client_cmd(id, "vipmenu");
client_print_color(id, print_team_default, "^1Вам выдана бесплатная^4 VIP,^1 причина:^4 %s^1.", g_szSelectedMode);
}
}
stock bool:UTIL_IsWeekendMode() {
new szTime[4];
get_time("%u", szTime, charsmax(szTime));
return bool:(str_to_num(szTime) >= 6);
}
stock bool:UTIL_IsNightMode() {
new szTime[4];
get_time("%H", szTime, charsmax(szTime));
new iTime = str_to_num(szTime);
return bool:(0 <= iTime <= 6 || 18 <= iTime <= 24);
}
stock UTIL_IssueVIP(const iPlayer) {
if(~get_user_flags(iPlayer) & g_eFlagsVIP[HAVE]) {
remove_user_flags(iPlayer, ADMIN_USER);
set_user_flags(iPlayer, g_eFlagsVIP[GIVE]);
}
}
public RegisterCvars() {
bind_pcvar_string(create_cvar(
"nwv_weekend_mode",
"Выходные дни",
FCVAR_NONE,
"Режим выходной випки. Что бы выключить, оставьте поле пустым."),
g_eCvars[WEEKEND_MODE],
charsmax(g_eCvars[WEEKEND_MODE])
);
bind_pcvar_string(create_cvar(
"nwv_night_mode",
"Ночной режим",
FCVAR_NONE,
"Режим ночной випки. Что бы выключить, оставьте поле пустым."),
g_eCvars[NIGHT_MODE],
charsmax(g_eCvars[NIGHT_MODE])
);
bind_pcvar_string(create_cvar(
"nwv_give_flag",
"t",
FCVAR_NONE,
"Флаг, который выдается VIP'у"),
g_eCvars[GIVE_FLAG],
charsmax(g_eCvars[GIVE_FLAG])
);
bind_pcvar_string(create_cvar(
"nwv_have_flag",
"u",
FCVAR_NONE,
"При наличии этого флага, не выдается VIP"),
g_eCvars[HAVE_FLAG],
charsmax(g_eCvars[HAVE_FLAG])
);
}
return bool:(0 <= iTime <= 6 || 18 <= iTime <= 24);
, а время уже больше 18:30, и получается что привилегия не выдается.public client_putinserver(id) {
if(is_user_bot(id) || is_user_hltv(id))
return;
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
}
if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
public client_putinserver(id) {
if(is_user_bot(id) || is_user_hltv(id))
return;
if(g_eCvars[WEEKEND_MODE][0] != EOS)
if(UTIL_IsWeekendMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[WEEKEND_MODE]);
if(g_eCvars[NIGHT_MODE][0] != EOS && g_szSelectedMode[0] == EOS)
if(UTIL_IsNightMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[NIGHT_MODE]);
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
}
public client_putinserver(id) {
if(is_user_bot(id) || is_user_hltv(id))
return;
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
}
@CSGameRules_CleanUpMap_Post() {
if(g_eCvars[WEEKEND_MODE][0] != EOS)
if(UTIL_IsWeekendMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[WEEKEND_MODE]);
if(g_eCvars[NIGHT_MODE][0] != EOS && g_szSelectedMode[0] == EOS)
if(UTIL_IsNightMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[NIGHT_MODE]);
}
public PlayerSpawn_Post(id) {
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
if(g_szSelectedMode[0] != EOS && ~get_user_flags(id) & g_eFlagsVIP[HAVE] && is_user_alive(id)) {
client_cmd(id, "vipmenu");
client_print_color(id, print_team_default, "^1Вам выдана бесплатная^4 VIP,^1 причина:^4 %s^1.", g_szSelectedMode);
}
}
register_event("HLTV", "OnRoundStart", "a", "1=0", "2=0")
public OnRoundStart() {
if(g_eCvars[WEEKEND_MODE][0] != EOS)
if(UTIL_IsWeekendMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[WEEKEND_MODE]);
if(g_eCvars[NIGHT_MODE][0] != EOS && g_szSelectedMode[0] == EOS)
if(UTIL_IsNightMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[NIGHT_MODE]);
}
public plugin_init() {
register_plugin("Bonus NW", "0.0.1", "Albertio");
register_event("HLTV", "OnRoundStart", "a", "1=0", "2=0");
RegisterHam(Ham_Spawn, "player", "PlayerSpawn_Post", true);
RegisterCvars();
AutoExecConfig(true, "plugin-bonus_nw");
g_eFlagsVIP[GIVE] = read_flags(g_eCvars[GIVE_FLAG]);
g_eFlagsVIP[HAVE] = read_flags(g_eCvars[HAVE_FLAG]);
}
public client_putinserver(id) {
if(is_user_bot(id) || is_user_hltv(id))
return;
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
}
public OnRoundStart() {
if(g_eCvars[WEEKEND_MODE][0] != EOS)
if(UTIL_IsWeekendMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[WEEKEND_MODE]);
if(g_eCvars[NIGHT_MODE][0] != EOS && g_szSelectedMode[0] == EOS)
if(UTIL_IsNightMode())
copy(g_szSelectedMode, charsmax(g_szSelectedMode), g_eCvars[NIGHT_MODE]);
}
public PlayerSpawn_Post(id) {
if(equali(g_szSelectedMode, g_eCvars[WEEKEND_MODE]))
UTIL_IssueVIP(id);
else if(equali(g_szSelectedMode, g_eCvars[NIGHT_MODE]))
UTIL_IssueVIP(id);
if(g_szSelectedMode[0] != EOS && ~get_user_flags(id) & g_eFlagsVIP[HAVE] && is_user_alive(id)) {
client_print_color(id, print_team_default, "^1Вам выдана бесплатная^4 VIP,^1 причина:^4 %s^1.", g_szSelectedMode);
}
}