Да, я также установил для плагина значение 777.neow1, на плагин тоже выставил права?
22 Авг 2024
Спасибо, это сработалоneow1
Код:#include <amxmodx> #include <amxmisc> #include <reapi> #include <free_vip> //#include <next_client_api> // Recommendation for using NextClientServerApi 1.4.0 or later //#include <authemu> // Using version 5.2.12.525 or later #include <nvault> //#define INFINITE_ROUND // Using for CSDM, GG, DD and more... #if defined INFINITE_ROUND #define TASK_INFINITE 7022024 #endif #define Plugin_Name "[GM] Free Vip" #define Plugin_Version "1.6.3" #define Plugin_Author "[GM] NWC" #define GetCvarDesc(%0) fmt("%l", %0) #define SettingsDir "/plugins/gm_plugins/free_vip/vips.ini" #define setarg_int(%0,%1) setarg(%0,0,%1) #pragma semicolon 1 enum _:PCVAR { cvar_sendChat, cvar_showHud, cvar_szHud[128], cvar_iFreq } enum _ePlayersData { pd_szAuthid[MAX_AUTHID_LENGTH], pd_bitFlags, pd_bitSetFlags, pd_bitClientsSetFlags, pd_bitTestsSetFlags, bool: pd_bSet, bool: pd_bHSet, bool: pd_bNSet, bool: pd_bCSet, pd_iEnd, pd_iTestEnd, pd_iFreq, TypeClient: pd_bitAdvClient, TypeClient: pd_bitClient, bool: pd_bEnd } enum { FV_NONE, FV_NIGHTS, FV_HOLLIDAYS, FV_GIFTS, FV_TEST, FV_CLIENTS, FV_STEAM, FV_IP, FV_NAME } enum _aTempData { temp_iStart, temp_iEnd, temp_bitFlags, temp_szArg[MAX_AUTHID_LENGTH + 1] } enum _eFreeData { bool: bNight, bool: bHolliday, bitNightsFlags, bitHollidayFlags, szIgnorNightsFlags[64], szIgnorHollidayFlags[64], } enum _eForwards { fwd_StartHolliday, fwd_EndHolliday, fwd_StartNight, fwd_EndNight, fwd_SetGifts, fwd_RemoveGifts, fwd_SetVipTest, fwd_RemoveVipTest, fwd_SetClients, fwd_RemoveClients } enum any: TypeClient (<<=1) { Client_None = 0, Client_NonSteam = 1, Client_Steam, Client_GS, Client_Next, Client_All } enum _TrieData { td_iAutoClear, td_iLength, td_bitFlags, td_szIgnor[64] } enum _eVipTest { vt_iAutoClear, vt_iLength, vt_bitFlags, vt_szIgnorFlags[64] } new g_playersData[MAX_PLAYERS + 1][_ePlayersData], g_eFreeVip[_eFreeData], g_eVipTest[_eVipTest], g_pCvar[PCVAR], g_eForwards[_eForwards]; new g_iType, g_iGiftType; new Array: g_aNightsSettings, Array: g_aHollidaySettings, Array: g_aGifts, Array: g_aClients, Trie: g_tTestsCmds; new g_syncHud; new const g_szTestsFile[] = "fv_tests_data"; new g_hTestsVault = INVALID_HANDLE; #if !defined _authemu_included new Trie: g_tGsClients; #endif public plugin_init() { register_plugin(Plugin_Name, Plugin_Version, Plugin_Author); register_dictionary("gm_free_vip.txt"); g_syncHud = CreateHudSyncObj(); g_aNightsSettings = ArrayCreate(_aTempData); g_aHollidaySettings = ArrayCreate(_aTempData); g_aGifts = ArrayCreate(_aTempData); g_aClients = ArrayCreate(_aTempData); g_tTestsCmds = TrieCreate(); #if !defined _authemu_included g_tGsClients = TrieCreate(); #endif RegisterHooks(); RegisterForwards(); RegisterCmds(); CreateCvars(); #if defined INFINITE_ROUND if (LoadSettings(0)) set_task_ex(120.0, "@RoundEnd_Pre", TASK_INFINITE, .flags = SetTask_Repeat); #else LoadSettings(0); #endif } public plugin_cfg() { if ((g_hTestsVault = nvault_open(g_szTestsFile)) == INVALID_HANDLE) { set_fail_state(fmt("FV_CANT_OPEN_NVAULT_FILE", g_szTestsFile)); } else { if (g_eVipTest[vt_iAutoClear]) nvault_prune(g_hTestsVault, 0, get_systime() - g_eVipTest[vt_iAutoClear]); } #if !defined _authemu_included load_gsclient(); #endif } public plugin_end() { if (g_hTestsVault != INVALID_HANDLE) nvault_close(g_hTestsVault); #if !defined _authemu_included write_gsclient(); #endif #if defined INFINITE_ROUND remove_task(TASK_INFINITE); #endif } public plugin_natives() { register_native("fv_is_holliday", "native_fv_is_holliday"); register_native("fv_is_nights", "native_fv_is_nights"); register_native("fv_is_user_gifts", "native_fv_is_user_gifts"); register_native("fv_get_holliday_flags", "native_fv_get_holliday_flags"); register_native("fv_get_nights_flags", "native_fv_get_nights_flags"); register_native("fv_get_gifts_flags", "native_fv_get_gifts_flags"); register_native("fv_get_ignor_flags_holliday", "native_fv_get_ignor_flags_holliday"); register_native("fv_get_ignor_flags_nights", "native_fv_get_ignor_flags_nights"); register_native("fv_get_time_end_gifts", "native_fv_get_time_end_gifts"); register_native("fv_get_user_flags", "native_fv_get_user_flags"); register_native("fv_get_viptest_flags", "native_fv_get_viptest_flags"); register_native("fv_is_user_gsclient", "native_fv_is_user_gsclient"); register_native("fv_get_ignor_flags_viptest", "native_fv_get_ignor_flags_viptest"); register_native("fv_is_user_viptest", "native_fv_is_user_viptest"); } public ReloadSettings(iPlayer, level, cid) { if (!cmd_access(iPlayer, level, cid, 1)) { return PLUGIN_HANDLED; } ArrayClear(g_aNightsSettings); ArrayClear(g_aHollidaySettings); ArrayClear(g_aGifts); ArrayClear(g_aClients); TrieClear(g_tTestsCmds); console_print(iPlayer, "reload settings"); LoadSettings(iPlayer); return PLUGIN_CONTINUE; } public LoadSettings(iPlayer) { static szFile[PLATFORM_MAX_PATH]; if (szFile[0] == EOS) { get_localinfo("amxx_configsdir", szFile, charsmax(szFile)); strcat(szFile, SettingsDir, PLATFORM_MAX_PATH); } new INIParser: hParser = INI_CreateParser(), bool: iRet = true; INI_SetReaders(hParser, "ReadSettings", "ReadSection"); if (!INI_ParseFile(hParser, szFile)) { set_fail_state("%l %l", "FV_FILE_CANT", file_exists(szFile) ? "FV_READ" : "FV_FIND", szFile); iRet = false; } if (iPlayer) console_print(iPlayer, "reload settings end.^nSize Gift: %i | Size Night: %i | Size Holliday: %i | Size Clients: %i", ArraySize(g_aGifts), ArraySize(g_aNightsSettings), ArraySize(g_aHollidaySettings), ArraySize(g_aClients)); INI_DestroyParser(hParser); return iRet; } public client_putinserver(iPlayer) { g_playersData[iPlayer][pd_bitFlags] = get_user_flags(iPlayer); } public client_authorized(iPlayer, const szAuthid[]) { copy(g_playersData[iPlayer][pd_szAuthid], MAX_AUTHID_LENGTH - 1, szAuthid); if (is_user_steam(iPlayer)) { g_playersData[iPlayer][pd_bitClient] |= Client_Steam; } #if defined _authemu_included if (is_user_authemu(iPlayer)) { g_playersData[iPlayer][pd_bitClient] |= Client_GS; } #else if (TrieKeyExists(g_tGsClients, szAuthid)) { g_playersData[iPlayer][pd_bitClient] |= Client_GS; TrieDeleteKey(g_tGsClients, szAuthid); } #endif if (!g_playersData[iPlayer][pd_bitClient]) g_playersData[iPlayer][pd_bitClient] |= Client_NonSteam; new szData[1]; if (nvault_lookup(g_hTestsVault, szAuthid, szData, 1, g_playersData[iPlayer][pd_iTestEnd])) { if (g_playersData[iPlayer][pd_iTestEnd] > get_systime()) { if (!UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eVipTest[vt_szIgnorFlags])) { g_playersData[iPlayer][pd_bitTestsSetFlags] = add_user_flags(iPlayer, g_eVipTest[vt_bitFlags]); ExecuteForward(g_eForwards[fwd_SetVipTest], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_iTestEnd], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitTestsSetFlags]); } } } } #if defined _next_client_api_included public ncl_client_api_ready(iPlayer) { if (ncl_is_using_nextclient(iPlayer) == NCL_USING_VERIFICATED) g_playersData[iPlayer][pd_bitClient] |= Client_Next; } #endif public client_disconnected(iPlayer) { arrayset(g_playersData[iPlayer], 0, _ePlayersData); } @CBasePlayer_OnSpawnEquip_Post(const iPlayer) { new bitFlags; if (g_playersData[iPlayer][pd_iTestEnd] < get_systime() && g_playersData[iPlayer][pd_bitTestsSetFlags]) { remove_user_flags(iPlayer, g_playersData[iPlayer][pd_bitTestsSetFlags]); g_playersData[iPlayer][pd_bEnd] = true; SendAdvert(iPlayer, FV_TEST); ExecuteForward(g_eForwards[fwd_RemoveVipTest], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitSetFlags]); g_playersData[iPlayer][pd_bitTestsSetFlags] = 0; } if (IsGift(iPlayer, g_playersData[iPlayer][pd_bitSetFlags])) { g_playersData[iPlayer][pd_bSet] = true; bitFlags = add_user_flags(iPlayer, g_playersData[iPlayer][pd_bitSetFlags]); if (bitFlags) g_playersData[iPlayer][pd_bitSetFlags] = bitFlags; SendAdvert(iPlayer, FV_GIFTS); } else if (g_playersData[iPlayer][pd_bSet]) { ExecuteForward(g_eForwards[fwd_RemoveGifts], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitSetFlags]); remove_user_flags(iPlayer, g_playersData[iPlayer][pd_bitSetFlags]); g_playersData[iPlayer][pd_bEnd] = true; g_playersData[iPlayer][pd_bSet] = false; SendAdvert(iPlayer, FV_GIFTS); } if (IsClients(iPlayer, g_playersData[iPlayer][pd_bitAdvClient], bitFlags)) { g_playersData[iPlayer][pd_bCSet] = true; bitFlags = add_user_flags(iPlayer, bitFlags); if (bitFlags) g_playersData[iPlayer][pd_bitClientsSetFlags] = bitFlags; SendAdvert(iPlayer, FV_CLIENTS); ExecuteForward(g_eForwards[fwd_SetClients], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitClientsSetFlags]); } else if (g_playersData[iPlayer][pd_bCSet]) { g_playersData[iPlayer][pd_bEnd] = true; remove_user_flags(iPlayer, g_playersData[iPlayer][pd_bitClientsSetFlags]); g_playersData[iPlayer][pd_bCSet] = false; ExecuteForward(g_eForwards[fwd_RemoveClients], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitClientsSetFlags]); SendAdvert(iPlayer, FV_CLIENTS); } if (!g_eFreeVip[bHolliday] && g_playersData[iPlayer][pd_bHSet]) { g_playersData[iPlayer][pd_bEnd] = true; SendAdvert(iPlayer, FV_HOLLIDAYS); remove_user_flags(iPlayer, g_eFreeVip[bitHollidayFlags]); add_user_flags(iPlayer, g_playersData[iPlayer][pd_bitFlags] | g_playersData[iPlayer][pd_bitSetFlags]); g_playersData[iPlayer][pd_bHSet] = false; } if (!g_eFreeVip[bNight] && g_playersData[iPlayer][pd_bNSet]) { g_playersData[iPlayer][pd_bEnd] = true; SendAdvert(iPlayer, FV_NIGHTS); remove_user_flags(iPlayer, g_eFreeVip[bitNightsFlags]); add_user_flags(iPlayer, g_playersData[iPlayer][pd_bitFlags] | g_playersData[iPlayer][pd_bitSetFlags]); g_playersData[iPlayer][pd_bNSet] = false; } if (g_eFreeVip[bHolliday] && !g_playersData[iPlayer][pd_bHSet]) { SendAdvert(iPlayer, FV_HOLLIDAYS); if (!UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorHollidayFlags])) { add_user_flags(iPlayer, g_eFreeVip[bitHollidayFlags]); g_playersData[iPlayer][pd_bHSet] = true; } } else if (g_eFreeVip[bNight] && !g_playersData[iPlayer][pd_bNSet]) { SendAdvert(iPlayer, FV_NIGHTS); if (!UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorNightsFlags])) { add_user_flags(iPlayer, g_eFreeVip[bitNightsFlags]); g_playersData[iPlayer][pd_bNSet] = true; } } --g_playersData[iPlayer][pd_iFreq]; if (g_playersData[iPlayer][pd_iFreq] < 0 && g_pCvar[cvar_iFreq]) g_playersData[iPlayer][pd_iFreq] = g_pCvar[cvar_iFreq]; return HC_CONTINUE; } @RoundEnd_Pre() { if (IsHolliday(g_eFreeVip[bitHollidayFlags], g_eFreeVip[szIgnorHollidayFlags])) { if (g_eFreeVip[bNight]) { g_eFreeVip[bNight] = false; ExecuteForward(g_eForwards[fwd_EndNight], _, g_eFreeVip[bitNightsFlags], g_eFreeVip[szIgnorNightsFlags]); } g_eFreeVip[bHolliday] = true; } else if (IsNight(g_eFreeVip[bitNightsFlags], g_eFreeVip[szIgnorNightsFlags])) { if (g_eFreeVip[bHolliday]) { g_eFreeVip[bHolliday] = false; ExecuteForward(g_eForwards[fwd_EndHolliday], _, g_eFreeVip[bitHollidayFlags], g_eFreeVip[szIgnorHollidayFlags]); } g_eFreeVip[bNight] = true; } else if (g_eFreeVip[bHolliday] || g_eFreeVip[bNight]) { if (g_eFreeVip[bHolliday]) { ExecuteForward(g_eForwards[fwd_EndHolliday], _, g_eFreeVip[bitHollidayFlags], g_eFreeVip[szIgnorHollidayFlags]); } if (g_eFreeVip[bNight]) { ExecuteForward(g_eForwards[fwd_EndNight], _, g_eFreeVip[bitNightsFlags], g_eFreeVip[szIgnorNightsFlags]); } g_eFreeVip[bHolliday] = false; g_eFreeVip[bNight] = false; } } public ReloadAdmins() { new szData[1], TypeClient: bitClient; for (new iPlayer = 1; iPlayer <= MaxClients; iPlayer++) { bitClient = g_playersData[iPlayer][pd_bitClient]; arrayset(g_playersData[iPlayer], 0, _ePlayersData); get_user_authid(iPlayer, g_playersData[iPlayer][pd_szAuthid], MAX_AUTHID_LENGTH - 1); g_playersData[iPlayer][pd_bitClient] = bitClient; if (nvault_lookup(g_hTestsVault, g_playersData[iPlayer][pd_szAuthid], szData, 1, g_playersData[iPlayer][pd_iTestEnd])) { if (g_playersData[iPlayer][pd_iTestEnd] > get_systime()) { if (!UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eVipTest[vt_szIgnorFlags])) g_playersData[iPlayer][pd_bitTestsSetFlags] = add_user_flags(iPlayer, g_eVipTest[vt_bitFlags]); } } } } public clcmd_say_handler(iPlayer) { new szTemp[196], szMsg[128]; read_args(szTemp, charsmax(szTemp)); remove_quotes(szTemp); if (!UTIL_IsDefaultChatCmd(szTemp, charsmax(szTemp))) return PLUGIN_CONTINUE; if (!TrieKeyExists(g_tTestsCmds, szTemp)) return PLUGIN_CONTINUE; if (g_playersData[iPlayer][pd_iTestEnd] && !g_eVipTest[vt_iAutoClear]) { formatex(szMsg, charsmax(szMsg), "%l", "FV_YOU_CANT_USE_VIPTEST"); format_msg(szMsg, charsmax(szMsg)); client_print_color(iPlayer, print_team_red, "%l %s", "FV_PREFIX", szMsg); return PLUGIN_HANDLED; } if (UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eVipTest[vt_szIgnorFlags])) { formatex(szMsg, charsmax(szMsg), "%l", "FV_YOU_CANT_HAVE_VIPTEST"); format_msg(szMsg, charsmax(szMsg)); client_print_color(iPlayer, print_team_red, "%l %s", "FV_PREFIX", szMsg); return PLUGIN_HANDLED; } new iTimeStamp = get_systime(); if (g_playersData[iPlayer][pd_iTestEnd] < iTimeStamp) { if (g_playersData[iPlayer][pd_iTestEnd] + g_eVipTest[vt_iAutoClear] < iTimeStamp) { g_playersData[iPlayer][pd_iTestEnd] = iTimeStamp + g_eVipTest[vt_iLength]; SaveUserNVault(iPlayer); SendAdvert(iPlayer, FV_TEST); g_playersData[iPlayer][pd_bitTestsSetFlags] = add_user_flags(iPlayer, g_eVipTest[vt_bitFlags]); ExecuteForward(g_eForwards[fwd_SetVipTest], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], g_playersData[iPlayer][pd_iTestEnd], g_playersData[iPlayer][pd_bitFlags], g_playersData[iPlayer][pd_bitTestsSetFlags]); return PLUGIN_HANDLED; } else { new szTimeOut[32]; format_time(szTimeOut, charsmax(szTimeOut), "%d.%m.%y %H:%M:%S", g_playersData[iPlayer][pd_iTestEnd] + g_eVipTest[vt_iAutoClear]); formatex(szMsg, charsmax(szMsg), "%l", "FV_TIMEOUT_VIP"); format_msg(szMsg, charsmax(szMsg)); replace_all(szMsg, charsmax(szMsg), "[timeout]", szTimeOut); client_print_color(iPlayer, print_team_red, "%l %s", "FV_PREFIX", szMsg); return PLUGIN_HANDLED; } } else { new szEnd[32]; format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M:%S", g_playersData[iPlayer][pd_iTestEnd]); formatex(szMsg, charsmax(szMsg), "%l", "FV_YOU_HAVE_VIPTEST"); format_msg(szMsg, charsmax(szMsg)); replace_all(szMsg, charsmax(szMsg), "[endtime]", szEnd); client_print_color(iPlayer, print_team_red, "%l %s", "FV_PREFIX", szMsg); return PLUGIN_HANDLED; } } public bool: ReadSettings(INIParser: hParser, szBuffer[]) { if (g_iType == FV_NONE) return true; new aTempData[_aTempData]; if (!parse_settings(szBuffer, aTempData[temp_iStart], aTempData[temp_iEnd], aTempData[temp_bitFlags], aTempData[temp_szArg])) { return true; } if (g_iType == FV_HOLLIDAYS) ArrayPushArray(g_aHollidaySettings, aTempData); else if (g_iType == FV_NIGHTS) ArrayPushArray(g_aNightsSettings, aTempData); else if (g_iType == FV_GIFTS) ArrayPushArray(g_aGifts, aTempData); else if (g_iType == FV_CLIENTS) ArrayPushArray(g_aClients, aTempData); return true; } public bool: ReadSection(INIParser: hParser, const szSection[]) { switch (szSection[0]) { case 'H': {g_iType = FV_HOLLIDAYS;} case 'N': {g_iType = FV_NIGHTS;} case 'G': { switch (szSection[10]) { case 'S': {g_iGiftType = FV_STEAM;} case 'N': {g_iGiftType = FV_IP;} case 'I': {g_iGiftType = FV_NAME;} default: {g_iType = FV_NONE; log_amx("%l", "FV_BAD_SECTION", szSection);} } g_iType = FV_GIFTS; } case 'T': {g_iType = FV_TEST;} case 'C': {g_iType = FV_CLIENTS;} default: {g_iType = FV_NONE; log_amx("%l", "FV_BAD_SECTION", szSection);} } return true; } #if !defined _authemu_included public SetStatusGSClient(const iPlayer) { g_playersData[iPlayer][pd_bitClient] |= Client_GS; } #endif RegisterHooks() { #if !defined _authemu_included register_clcmd("gsc_user", "SetStatusGSClient"); #endif #if !defined INFINITE_ROUND RegisterHookChain(RG_RoundEnd, "@RoundEnd_Pre", .post = false); #endif RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "@CBasePlayer_OnSpawnEquip_Post", .post = true); } RegisterForwards() { g_eForwards[fwd_StartHolliday] = CreateMultiForward("FV_StartHolliday", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_STRING); g_eForwards[fwd_EndHolliday] = CreateMultiForward("FV_EndHolliday", ET_IGNORE, FP_CELL, FP_STRING); g_eForwards[fwd_StartNight] = CreateMultiForward("FV_StartNights", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_STRING); g_eForwards[fwd_EndNight] = CreateMultiForward("FV_EndNights", ET_IGNORE, FP_CELL, FP_STRING); g_eForwards[fwd_SetGifts] = CreateMultiForward("FV_SetGifts", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL); g_eForwards[fwd_RemoveGifts] = CreateMultiForward("FV_RemoveGifts", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL); g_eForwards[fwd_SetVipTest] = CreateMultiForward("FV_SetVipTest", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL); g_eForwards[fwd_RemoveVipTest] = CreateMultiForward("FV_RemoveVipTest", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL); g_eForwards[fwd_SetClients] = CreateMultiForward("FV_SetClients", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL); g_eForwards[fwd_RemoveClients] = CreateMultiForward("FV_RemoveClients", ET_IGNORE, FP_CELL, FP_STRING, FP_CELL, FP_CELL); } RegisterCmds() { register_concmd("amx_reloadadmins", "ReloadAdmins"); register_clcmd("say_team", "clcmd_say_handler"); register_clcmd("say", "clcmd_say_handler"); register_clcmd("fv_reload_vips", "ReloadSettings", ADMIN_RCON, GetCvarDesc("FV_RELOAD_VIPS")); } CreateCvars() { bind_pcvar_num(create_cvar("fv_send_chat", "1", .description = GetCvarDesc("FV_CVAR_SEND_CHAT"), .has_min = true, .min_val = 0.0, .has_max = true, .max_val = 1.0), g_pCvar[cvar_sendChat] ); bind_pcvar_num(create_cvar("fv_show_hud", "1", .description = GetCvarDesc("FV_CVAR_SHOW_HUD"), .has_min = true, .min_val = 0.0, .has_max = true, .max_val = 1.0), g_pCvar[cvar_showHud] ); bind_pcvar_num(create_cvar("fv_freq_msg", "3", .description = GetCvarDesc("FV_CVAR_FREQ_MSG"), .has_min = true, .min_val = 0.0), g_pCvar[cvar_iFreq] ); bind_pcvar_string(create_cvar("fv_hud_settings", "0 255 0 -1.0 0.75 0 0.0 6.0 0.1 0.2", .description = GetCvarDesc("FV_CVAR_HUD_SETTINGS")), g_pCvar[cvar_szHud], charsmax(g_pCvar[cvar_szHud]) ); create_cvar("fv_version", Plugin_Version, (FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED)); AutoExecConfig(true, "cvars", "gm_plugins/free_vip"); } stock bool: IsGift(const iPlayer, &bitFlags) { new iSize = ArraySize(g_aGifts); if (!iSize) return false; new aTempData[_aTempData]; new szIp[MAX_IP_LENGTH], szName[MAX_NAME_LENGTH]; get_user_ip(iPlayer, szIp, charsmax(szIp)); get_user_name(iPlayer, szName, charsmax(szName)); for (new i; i < iSize; i++) { ArrayGetArray(g_aGifts, i, aTempData); switch (aTempData[temp_szArg][0]) { case 'S': {if (strcmp(aTempData[temp_szArg][1], g_playersData[iPlayer][pd_szAuthid]) != 0) continue;} case 'N': {if (strcmp(aTempData[temp_szArg][1], szIp) != 0) continue;} case 'I': {if (strcmp(aTempData[temp_szArg][1], szName) != 0) continue;} } if (UTIL_IsTimeWithin(aTempData[temp_iStart], aTempData[temp_iEnd])) { if (!g_playersData[iPlayer][pd_bSet]) { ExecuteForward(g_eForwards[fwd_SetGifts], _, iPlayer, g_playersData[iPlayer][pd_szAuthid], aTempData[temp_iStart], aTempData[temp_iEnd], get_user_flags(iPlayer), aTempData[temp_bitFlags]); bitFlags = aTempData[temp_bitFlags]; g_playersData[iPlayer][pd_iEnd] = aTempData[temp_iEnd]; } return true; } } return false; } stock bool: IsClients(const iPlayer, &TypeClient: bitType, &bitFlags) { new iSize = ArraySize(g_aClients); if (!iSize) return false; new aTempData[_aTempData]; for (new i; i < iSize; i++) { ArrayGetArray(g_aClients, i, aTempData); switch (aTempData[temp_iStart]) { case 1: { if (g_playersData[iPlayer][pd_bitClient] != Client_Steam) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = Client_Steam; bitFlags = aTempData[temp_bitFlags]; return true; } case 2: { if (g_playersData[iPlayer][pd_bitClient] != Client_GS) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = Client_GS; bitFlags = aTempData[temp_bitFlags]; return true; } case 3: { if (g_playersData[iPlayer][pd_bitClient] != Client_Next) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = Client_Next; bitFlags = aTempData[temp_bitFlags]; return true; } case 4: { if (g_playersData[iPlayer][pd_bitClient] != (Client_Steam | Client_GS)) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = (Client_Steam | Client_GS); bitFlags = aTempData[temp_bitFlags]; return true; } case 5: { if (g_playersData[iPlayer][pd_bitClient] != (Client_Steam | Client_Next)) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = (Client_Steam | Client_Next); bitFlags = aTempData[temp_bitFlags]; return true; } case 6: { if (g_playersData[iPlayer][pd_bitClient] != Client_NonSteam) continue; if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = Client_NonSteam; bitFlags = aTempData[temp_bitFlags]; return true; } case 7: { if (g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer) & ~g_playersData[iPlayer][pd_bitClientsSetFlags], aTempData[temp_szArg])) continue; else if (!g_playersData[iPlayer][pd_bCSet] && UTIL_IsIgnorFlags(get_user_flags(iPlayer), aTempData[temp_szArg])) continue; bitType = Client_All; bitFlags = aTempData[temp_bitFlags]; return true; } } } return false; } stock bool: IsNight(&bitFlags, szIgnor[]) { new aTempData[_aTempData]; new iWeekDay = UTIL_GetWeekDay(); ArrayGetArray(g_aNightsSettings, --iWeekDay, aTempData); if (get_systime() < aTempData[temp_iStart]) { if (!iWeekDay) ArrayGetArray(g_aNightsSettings, 6, aTempData); else ArrayGetArray(g_aNightsSettings, --iWeekDay, aTempData); } if (!aTempData[temp_iStart]) return false; if (UTIL_IsTimeWithin(aTempData[temp_iStart], aTempData[temp_iEnd])) { if (!g_eFreeVip[bNight]) { ExecuteForward(g_eForwards[fwd_StartNight], _, aTempData[temp_iStart], aTempData[temp_iEnd], aTempData[temp_bitFlags], aTempData[temp_szArg]); bitFlags = aTempData[temp_bitFlags]; copy(szIgnor, charsmax(aTempData[temp_szArg]), aTempData[temp_szArg]); } return true; } return false; } stock bool: IsHolliday(&bitFlags, szIgnor[]) { new iSize = ArraySize(g_aHollidaySettings); if (!iSize) return false; new aTempData[_aTempData]; for (new i; i < iSize ;i++) { ArrayGetArray(g_aHollidaySettings, i, aTempData); if (!UTIL_IsTimeWithin(aTempData[temp_iStart], aTempData[temp_iEnd])) continue; if (!g_eFreeVip[bHolliday]) { ExecuteForward(g_eForwards[fwd_StartHolliday], _, aTempData[temp_iStart], aTempData[temp_iEnd], aTempData[temp_bitFlags], aTempData[temp_szArg]); bitFlags = aTempData[temp_bitFlags]; copy(szIgnor, charsmax(aTempData[temp_szArg]), aTempData[temp_szArg]); } return true; } return false; } stock bool: SendAdvert(const iPlayer, const iType) { if (iType != FV_TEST && !g_playersData[iPlayer][pd_bEnd]) { if (g_playersData[iPlayer][pd_iFreq]) return false; if (g_playersData[iPlayer][pd_iFreq] < 0) return false; } g_playersData[iPlayer][pd_bEnd] = false; new szOther[32], szFlags[32]; switch (iType) { case FV_GIFTS: { get_flags(g_playersData[iPlayer][pd_bitSetFlags], szFlags, charsmax(szFlags)); if (szFlags[0] == EOS) return false; if (g_playersData[iPlayer][pd_bSet]) { SendChat(iPlayer, szFlags, 0); ShowHud(iPlayer, szFlags, 0); } else { SendChat(iPlayer, szFlags, 1); ShowHud(iPlayer, szFlags, 1); } } case FV_HOLLIDAYS: { if (g_eFreeVip[bHolliday]) { UTIL_GetOtherFlags(iPlayer, g_eFreeVip[bitHollidayFlags], szOther); get_flags(g_eFreeVip[bitHollidayFlags], szFlags, charsmax(szFlags)); if (szOther[0] != EOS && !UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorHollidayFlags])) { SendChat(iPlayer, szOther, 2); ShowHud(iPlayer, szOther, 2); } else { SendChat(iPlayer, szFlags, 3); ShowHud(iPlayer, szFlags, 3); } } else { UTIL_GetOtherFlags(iPlayer, g_eFreeVip[bitHollidayFlags], szOther); get_flags(g_eFreeVip[bitHollidayFlags], szFlags, charsmax(szFlags)); if (szOther[0] != EOS && !UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorHollidayFlags])) { SendChat(iPlayer, szOther, 4); ShowHud(iPlayer, szOther, 4); } else { SendChat(iPlayer, szFlags, 5); ShowHud(iPlayer, szFlags, 5); } } } case FV_NIGHTS: { if (g_eFreeVip[bNight]) { UTIL_GetOtherFlags(iPlayer, g_eFreeVip[bitNightsFlags], szOther); get_flags(g_eFreeVip[bitNightsFlags], szFlags, charsmax(szFlags)); if (szOther[0] != EOS && !UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorNightsFlags])) { SendChat(iPlayer, szOther, 6); ShowHud(iPlayer, szOther, 6); } else { SendChat(iPlayer, szFlags, 7); ShowHud(iPlayer, szFlags, 7); } } else { UTIL_GetOtherFlags(iPlayer, g_eFreeVip[bitNightsFlags], szOther); get_flags(g_eFreeVip[bitNightsFlags], szFlags, charsmax(szFlags)); if (szOther[0] != EOS && !UTIL_IsIgnorFlags(get_user_flags(iPlayer), g_eFreeVip[szIgnorNightsFlags])) { SendChat(iPlayer, szOther, 8); ShowHud(iPlayer, szOther, 8); } else { SendChat(iPlayer, szFlags, 9); ShowHud(iPlayer, szFlags, 9); } } } case FV_CLIENTS: { get_flags(g_playersData[iPlayer][pd_bitClientsSetFlags], szFlags, charsmax(szFlags)); if (g_playersData[iPlayer][pd_bitAdvClient] == Client_Steam) { SendChat(iPlayer, szFlags, 10); ShowHud(iPlayer, szFlags, 10); } else if (g_playersData[iPlayer][pd_bitAdvClient] == Client_GS) { SendChat(iPlayer, szFlags, 11); ShowHud(iPlayer, szFlags, 11); } else if (g_playersData[iPlayer][pd_bitAdvClient] == Client_Next) { SendChat(iPlayer, szFlags, 12); ShowHud(iPlayer, szFlags, 12); } else if (g_playersData[iPlayer][pd_bitAdvClient] == (Client_Steam | Client_GS)) { SendChat(iPlayer, szFlags, 13); ShowHud(iPlayer, szFlags, 13); } else if (g_playersData[iPlayer][pd_bitAdvClient] == (Client_Steam | Client_Next)) { SendChat(iPlayer, szFlags, 14); ShowHud(iPlayer, szFlags, 14); } else if (g_playersData[iPlayer][pd_bitAdvClient] == Client_NonSteam) { SendChat(iPlayer, szFlags, 15); ShowHud(iPlayer, szFlags, 15); } else if (g_playersData[iPlayer][pd_bitAdvClient] == Client_All) { SendChat(iPlayer, szFlags, 16); ShowHud(iPlayer, szFlags, 16); } else { SendChat(iPlayer, szFlags, 17); ShowHud(iPlayer, szFlags, 17); } } case FV_TEST: { UTIL_GetOtherFlags(iPlayer, g_eVipTest[vt_bitFlags], szOther); get_flags(g_playersData[iPlayer][pd_bitTestsSetFlags], szFlags, charsmax(szFlags)); if (!g_playersData[iPlayer][pd_bitTestsSetFlags]) { SendChat(iPlayer, szOther, 18); ShowHud(iPlayer, szOther, 18); } else { SendChat(iPlayer, szFlags, 19); ShowHud(iPlayer, szFlags, 19); } } } return true; } stock bool: ShowHud(const iPlayer, const szFlags[], const iMsg) { if (!g_pCvar[cvar_showHud]) return false; new szMsg[192], szEnd[24]; switch (iMsg) { case 0: { format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M", g_playersData[iPlayer][pd_iEnd]); formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_GIFTS"); } case 1: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_REMOVE_GIFTS");} // ------------------------------------------------------------------------------- case 2: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_HOLLIDAY");} case 3: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_NOSET_HOLLIDAY");} case 4: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_REMOVE_HOLLIDAY");} case 5: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_NOREMOVE_HOLIDAY");} // ------------------------------------------------------------------------------- case 6: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_NIGHTS");} case 7: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_NOSET_NIGHTS");} case 8: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_REMOVE_NIGHTS");} case 9: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_NOREMOVE_NIGHTS");} // ------------------------------------------------------------------------------- case 10: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_STEAM");} case 11: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_GSCLIENT");} case 12: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_NEXTCLIENT");} case 13: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_STEAM_GSCLIENT");} case 14: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_STEAM_NEXTCLIENT");} case 15: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_NONSTEAM");} case 16: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_ALL");} case 17: {formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_REMOVE_CLIENTS");} // ------------------------------------------------------------------------------- case 18: { format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M", g_playersData[iPlayer][pd_iTestEnd]); formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_SET_VIPTEST"); } case 19: { format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M:%S", g_playersData[iPlayer][pd_iTestEnd] + g_eVipTest[vt_iAutoClear]); formatex(szMsg, charsmax(szMsg), "%l", "FV_HUD_REMOVE_VIPTEST"); } } replace_all(szMsg, charsmax(szMsg), "[flags]", szFlags); replace_all(szMsg, charsmax(szMsg), "[endtime]", szEnd); new iRed, iGreen, iBlue, Float: x, Float: y, effects, Float: flFxTime, Float: flHoldTime, Float: flFadeInTime, Float: flFadeOut; UTIL_ReadHudSettings(g_pCvar[cvar_szHud], iRed, iGreen, iBlue, x, y, effects, flFxTime, flHoldTime, flFadeInTime, flFadeOut); set_hudmessage(iRed, iGreen, iBlue, x, y, effects, flFxTime, flHoldTime, flFadeInTime, flFadeOut, -1); ShowSyncHudMsg(iPlayer, g_syncHud, szMsg); return true; } stock bool: SendChat(const iPlayer, const szFlags[], const iMsg) { if (!g_pCvar[cvar_sendChat]) return false; new szMsg[192], szEnd[24]; switch (iMsg) { case 0: { formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_GIFTS"); format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M", g_playersData[iPlayer][pd_iEnd]); } case 1: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_REMOVE_GIFTS");} // ------------------------------------------------------------------------------- case 2: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_HOLLIDAY");} case 3: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_NOSET_HOLLIDAY");} case 4: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_REMOVE_HOLLIDAY");} case 5: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_NOREMOVE_HOLIDAY");} // ------------------------------------------------------------------------------- case 6: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_NIGHTS");} case 7: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_NOSET_NIGHTS");} case 8: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_REMOVE_NIGHTS");} case 9: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_NOREMOVE_NIGHTS");} // ------------------------------------------------------------------------------- case 10: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_STEAM");} case 11: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_GSCLIENT");} case 12: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_NEXTCLIENT");} case 13: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_STEAM_GSCLIENT");} case 14: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_STEAM_NEXTCLIENT");} case 15: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_NONSTEAM");} case 16: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_ALL");} case 17: {formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_REMOVE_CLIENTS");} // ------------------------------------------------------------------------------- case 18: { format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M", g_playersData[iPlayer][pd_iTestEnd]); formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_SET_VIPTEST"); } case 19: { format_time(szEnd, charsmax(szEnd), "%d.%m.%y %H:%M:%S", g_playersData[iPlayer][pd_iTestEnd] + g_eVipTest[vt_iAutoClear]); formatex(szMsg, charsmax(szMsg), "%l", "FV_CHAT_REMOVE_VIPTEST"); } } format_msg(szMsg, charsmax(szMsg)); replace_all(szMsg, charsmax(szMsg), "[flags]", szFlags); replace_all(szMsg, charsmax(szMsg), "[endtime]", szEnd); client_print_color(iPlayer, print_team_default, "%l %s", "FV_PREFIX", szMsg); return true; } stock format_msg(szMsg[], const iSize) { replace_all(szMsg, iSize, "!g", "^4"); replace_all(szMsg, iSize, "!t", "^3"); replace_all(szMsg, iSize, "!d", "^1"); } stock bool: parse_settings(const szBuffer[], any:... ) { enum { arg_one = 1, arg_two, arg_three, arg_four } new szStart[24], szEnd[24], szFlags[32], szIgnor[64], szAuthid[MAX_AUTHID_LENGTH + 1]; new iEnd; static iWeekDay; switch (g_iType) { case FV_HOLLIDAYS: { parse(szBuffer, szStart, charsmax(szStart), szEnd, charsmax(szEnd), szFlags, charsmax(szFlags), szIgnor, charsmax(szIgnor)); if (replace_all(szEnd, charsmax(szEnd), ".", " ") == 2) iEnd = parse_time(szEnd, "%d %m %y %H:%M"); else iEnd = parse_time(szEnd, "%d %m %H:%M"); if (get_systime() > iEnd) return false; if (!szFlags[0]) return false; if (replace_all(szEnd, charsmax(szEnd), ".", " ") == 2) setarg_int(arg_one, parse_time(szStart, "%d %m %y %H:%M")); else setarg_int(arg_one, parse_time(szStart, "%d %m %H:%M")); setarg_int(arg_two, iEnd); for (new iter; ;iter++) { if (szIgnor[iter] == EOS) break; setarg(arg_four, iter, szIgnor[iter]); } } case FV_NIGHTS: { parse(szBuffer, szStart, charsmax(szStart), szEnd, charsmax(szEnd), szFlags, charsmax(szFlags), szIgnor, charsmax(szIgnor)); if (++iWeekDay > 7) iWeekDay = 1; if (szStart[0] == EOS) return true; new iTime, iDay = UTIL_GetWeekDay(); if ((iDay == 1 && iWeekDay == 7) || (iWeekDay == (iDay - 1))) iTime = -86400; else if (iWeekDay >= iDay) iTime = 86400 * (iWeekDay - iDay); else iTime = 86400 * (7 + iWeekDay - iDay); iEnd = parse_time(szEnd, "%H:%M") + iTime; new iStart = parse_time(szStart, "%H:%M") + iTime; setarg_int(arg_one, iStart); if (iEnd < iStart) setarg_int(arg_two, iEnd + 86400); else setarg_int(arg_two, iEnd); for (new iter; ;iter++) { if (szIgnor[iter] == EOS) break; setarg(arg_four, iter, szIgnor[iter]); } } case FV_GIFTS: { parse(szBuffer, szAuthid, charsmax(szAuthid), szStart, charsmax(szStart), szEnd, charsmax(szEnd), szFlags, charsmax(szFlags)); iEnd = parse_time(szEnd, "%d.%m.%y %H:%M"); if (get_systime() > iEnd) return false; if (!szFlags[0]) return false; setarg_int(arg_one, parse_time(szStart, "%d.%m.%y %H:%M")); setarg_int(arg_two, iEnd); switch (g_iGiftType) { case FV_STEAM: {setarg(arg_four, 0, 'S');} case FV_IP: {setarg(arg_four, 0, 'I');} case FV_NAME: {setarg(arg_four, 0, 'N');} } for (new iter = 1; ;iter++) { if (szAuthid[iter] == EOS) break; setarg(arg_four, iter, szAuthid[iter]); } } case FV_TEST: { new szCmd[128]; parse(szBuffer, szCmd, charsmax(szCmd), szStart, charsmax(szStart), szEnd, charsmax(szEnd), szFlags, charsmax(szFlags), szIgnor, charsmax(szIgnor)); if (!szEnd[0] || !szFlags[0] || !szCmd[0]) return false; new szRegCmd[16], iPos; while (iPos != -1) { iPos = argparse(szCmd, iPos, szRegCmd, charsmax(szRegCmd)); if (szRegCmd[0]) TrieSetCell(g_tTestsCmds, szRegCmd, 1, false); } g_eVipTest[vt_iAutoClear] = str_to_num(szStart) * 60; g_eVipTest[vt_iLength] = str_to_num(szEnd) * 60; g_eVipTest[vt_bitFlags] = read_flags(szFlags); copy(g_eVipTest[vt_szIgnorFlags], charsmax(g_eVipTest[vt_szIgnorFlags]), szIgnor); return false; } case FV_CLIENTS: { parse(szBuffer, szStart, charsmax(szStart), szFlags, charsmax(szFlags), szIgnor, charsmax(szIgnor)); if (!szFlags[0]) return false; setarg_int(arg_two, 0); switch (szStart[0]) { case 'S', 's': { if (szStart[6] == 'N' || szStart[6] == 'n') setarg_int(arg_one, 5); else if (szStart[6] == 'G' || szStart[6] == 'g') setarg_int(arg_one, 4); else setarg_int(arg_one, 1); } case 'G', 'g': { if (szStart[9] == 'S' || szStart[9] == 's') setarg_int(arg_one, 4); else setarg_int(arg_one, 2); } case 'N', 'n': { if (szStart[1] == 'O' || szStart[1] == 'o') setarg_int(arg_one, 6); else if (szStart[11] == 'S' || szStart[11] == 's') setarg_int(arg_one, 5); else setarg_int(arg_one, 3); } case 'A', 'a': { setarg_int(arg_one, 7); } default: {return false;} } for (new iter; ;iter++) { if (szIgnor[iter] == EOS) break; setarg(arg_four, iter, szIgnor[iter]); } } } setarg_int(arg_three, read_flags(szFlags)); return true; } stock SaveUserNVault(const iPlayer) { if(!is_user_bot(iPlayer) && !is_user_hltv(iPlayer)) nvault_set(g_hTestsVault, g_playersData[iPlayer][pd_szAuthid], "1"); } #if !defined _authemu_included stock bool: write_gsclient() { new dir[128]; get_datadir(dir, charsmax(dir)); format(dir, charsmax(dir), "%s/%s", dir, "fv_gsclient.ini"); new file = fopen(dir, "w+t"); if (!file) { log_amx(fmt("%l", "FV_GSCLIENT_LIST_NOT_FOUND")); return false; } new szAuthid[MAX_AUTHID_LENGTH]; for (new iPlayer = 1; iPlayer <= MaxClients; iPlayer++) { if (!is_user_connected(iPlayer)) continue; if (g_playersData[iPlayer][pd_bitClient] & Client_GS) { get_user_authid(iPlayer, szAuthid, charsmax(szAuthid)); fprintf(file, "^"%s^"^n", szAuthid); } } fclose(file); return true; } stock bool: load_gsclient() { new dir[128]; get_datadir(dir, charsmax(dir)); format(dir, charsmax(dir), "%s/%s", dir, "fv_gsclient.ini"); new file = fopen(dir, "rt"); if (!file) { log_amx(fmt("%l", "FV_GSCLIENT_LIST_NOT_FOUND")); return false; } new szBuffer[256], szAuthid[MAX_AUTHID_LENGTH]; while (!feof(file)) { fgets(file, szBuffer, charsmax(szBuffer)); argparse(szBuffer, 0, szAuthid, charsmax(szAuthid)); remove_quotes(szAuthid); TrieSetCell(g_tGsClients, szAuthid, 1, true); } fclose(file); return true; } #endif public bool: native_fv_is_holliday() { return g_eFreeVip[bHolliday]; } public bool: native_fv_is_nights() { return g_eFreeVip[bNight]; } public bool: native_fv_is_user_gifts(const iPlayer) { return g_playersData[iPlayer][pd_bSet]; } public native_fv_get_holliday_flags() { return g_eFreeVip[bitHollidayFlags]; } public native_fv_get_nights_flags() { return g_eFreeVip[bitNightsFlags]; } public native_fv_get_gifts_flags(const iPlayer) { return g_playersData[iPlayer][pd_bitSetFlags]; } public native_fv_get_ignor_flags_holliday(szBuffer[], const iSize) { return copy(szBuffer, iSize, g_eFreeVip[szIgnorHollidayFlags]); } public native_fv_get_ignor_flags_nights(szBuffer[], const iSize) { return copy(szBuffer, iSize, g_eFreeVip[szIgnorNightsFlags]); } public native_fv_get_time_end_gifts(const iPlayer) { return g_playersData[iPlayer][pd_iEnd]; } public native_fv_get_user_flags(const iPlayer) { return g_playersData[iPlayer][pd_bitFlags]; } public native_fv_get_viptest_flags() { return g_eVipTest[vt_bitFlags]; } public bool: native_fv_is_user_gsclient(const iPlayer) { if (g_playersData[iPlayer][pd_bitClient] & Client_GS) return true; return false; } public native_fv_get_ignor_flags_viptest(szBuffer[], const iSize) { return copy(szBuffer, iSize, g_eVipTest[vt_szIgnorFlags]); } public bool: native_fv_is_user_viptest(const iPlayer) { if (g_playersData[iPlayer][pd_bitTestsSetFlags]) return true; return false; }