Promocodes for server 0.1

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
10
Реакции
-2
Ошибка
Ошибки как таковой нет, просто не выдаются нужные права
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5263
Билд
version
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.8.0.706-dev
Build date: 23:41:46 Jan 25 2021 (2480)
Build from: https://github.com/dreamstalker/rehlds/commit/6d01b1b
ReGamedll
ReGameDLL version: 5.20.0.492-dev
Build date: 15:26:35 Jan 4 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/aae507c
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion.so v0.1.0.137 ini Start Never
[ 2] AMX Mod X RUN - amxmodx.so v1.9.0.5263 ini Start ANY
[ 3] Placeholders disabler RUN - plfix_mm_i386.so v0.0.3 ini Start Never
[ 4] Ultimate Unprecacher RUN - unprecacher_i386.so vBeta 2.5.3 ini Chlvl Chlvl
[ 5] Revoice RUN - revoice.so v0.1.0.34 ini Start Never
[ 6] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 7] ReSRDetector RUN - resrdetector.so v0.1.0 ini ANY
[ 8] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl2 ANY
[ 9] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl2 ANY
[10] ReAPI RUN - reapi_amxx_i386.so v5.19.0.211-dev pl2 ANY Never
[11] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[14] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[15] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
15 plugins, 15 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Ultimate Chats Control 5.2(c) neygomon ultimate_chats_ error
[ 2] Admin Loader v3.5 neygomon admin_loader.am running
[ 3] Advanced Gag v1.4.2 neygomon amx_gag.amxx running
[ 4] Bypass Guard v1.0.1 mx?! bypass_guard.am running
[ 5] FreshBans v1.4.2b kanagava fresh_bans.amxx running
[ 6] xREDIRECT v1.0 x0R xredirect.amxx running
[ 7] Admin Commands v1.8.1.3746 AMXX Dev Team admincmd.amxx running
[ 8] Slots Reservation v1.8.1.3746 AMXX Dev Team adminslots.amxx running
[ 9] Menus Front-End v1.8.1.3746 AMXX Dev Team menufront.amxx running
[ 10] Players Menu v1.8.1.3746 AMXX Dev Team plmenu.amxx running
[ 11] Maps Menu v1.8.1.3746 AMXX Dev Team mapsmenu.amxx running
[ 12] Admin Chat v1.8.1.3746 AMXX Dev Team adminchat.amxx running
[ 13] Admin Votes v1.8.1.3746 Wildness Team adminvote.amxx running
[ 14] StatsX v1.9.0.5263 AMXX Dev Team statsx.amxx running
[ 15] Stats Configuration v1.8.2 AMXX Dev Team statscfg.amxx running
[ 16] STEAM_ID_LAN KICK v1.0 SKAJIbnEJIb sil_kick.amxx running
[ 17] Weapons MaxClip v0.3.0 ConnorMcLeod weapons_maxclip running
[ 18] Fire in the hole REMOV v1.05 ........ FITH_REMOVER.am running
[ 19] Zombie Plague v4.3 MeRcyLeZZ zombie_plague40 debug
[ 20] [ZP] Addon: Knifes v1.0 BlackCat cso_knife.amxx running
[ 21] [ZP] Addon: Extended G v2.0 [ru]In1ernal Err zp_ammo_ex.amxx running
[ 22] [ZP] DHUD Informer v0.0.0.1 Andrei zp_score.amxx running
[ 23] No Survivor Recoil vv1.0 Stone/Mog zp_no_survivor_ running
[ 24] [ZP] Addon: Zombie HP v0.1 KceHoH zp_hud_hp_cso.a running
[ 25] [ZP] Survivor or Nemes v1.0 Kiske zp_winorlose_ro running
[ 26] Simple AmmoPacks Giver v0.2 Arseny aka Witho ammo_vipadm.amx running
[ 27] Serfing servers v1.1 Svoloch serfing_servers running
[ 28] Menu_Priv v1.0 NoNameNPC menu_priv.amxx running
[ 29] [ CSO ] VIP v0.1 Opo4uMapy cso_vip.amxx running
[ 30] [FS] Chat v1.1 Docaner zp_chat.amxx running
[ 31] unknown vunknown unknown block_models.am running
[ 32] Custom Models v1.3.2 neugomon & Oli custom_models.a running
[ 33] unknown vunknown unknown zp_vip_ak47g.am running
[ 34] unknown vunknown unknown zp_vip_m4a1g.am running
[ 35] [ZP] VIP menu v1.2 NoNameNPC edited vip_menu.amxx running
[ 36] [ZP] GVIP menu v1.2 NoNameNPC edited gvip_menu.amxx running
[ 37] [ZP] BOSS menu v1.2 NoNameNPC edited boss_menu.amxx running
[ 38] Admin-Check v5.5 p1Mp & S1n[L]Ss admin_check.amx running
[ 39] [ZP] Weapon: THANATOS- v2.0 xUnicorn (t3rkec zp_weapon_thana running
[ 40] [ZP]Balrog-V v1.1 Crock / PbI)I(Uu zp_werapon_balr running
[ 41] [ZP] Classic v1.0 dias reclassic.amxx running
[ 42] Fast v1.0 Fast refast.amxx running
[ 43] [ZP] Class: DaSu (2) v1.0 Jim rebig.amxx running
[ 44] [ZP] Class - predator v1.0 HoRRoR rehanter.amxx running
[ 45] [ZP] Zombie Class: KF v0.2 meTaLiCroSS reshaman.amxx running
[ 46] unknown vunknown unknown zp_countdown.am running
[ 47] [ZP] Zombie Class: Par v0.1 =), LARS-BLOODLI azp_class_reven debug
[ 48] [ZP] Zombie Class: Dra v0.1 =), LARS-BLOODLI azp_class_reven running
[ 49] [ZP] Zombie Class: Dra v0.1 =), LARS-BLOODLI zp_class_revena running
[ 50] [ZP] AmmoChange v1.0 ZETA [M|E|N] zp_ammochange.a running
[ 51] [ZP] Sub-Plugin: Parac v1.1 Random1, 93()|29 zp_sub_parachut running
[ 52] unknown vunknown unknown zp_extra_firegr running
[ 53] [ZP] Extra: Anti-Infec v1.0 MeRcyLeZZ zp_extra_human_ running
[ 54] unknown vunknown unknown zp_extra_ultima running
[ 55] [ZP] LaserMine v2.4 SandStriker/Shid zp_lasermine_24 running
[ 56] [ZP] Extra: Dual Infin v1.0 LARS-DAY[BR]EAKE azp_weapon_infi debug
[ 57] [ZP] Extra: AK47 Red D v1.0 LARS-DAY[BR]EAKE azp_weapon_assa running
[ 58] CSO CROSSBOW, toectb a v1.0 Crock zp_extra_crossb running
[ 59] [ZP] Extra: Thompson C v1.0 Crock / =) (Popr azp_weapon_thom running
[ 60] [ZP] Extra: Electric G v1.0 LARS-DAY[BR]EAKE azp_weapon_gatl running
[ 61] [ZP] Extra: Water Gun v1.0 LARS-DAY[BR]EAKE azp_weapon_wate running
[ 62] [ZP] Extra: M134 EX v1.0 LARS-DAY[BR]EAKE azp_weapon_m134 running
[ 63] [ZP] Extra: PKM Total v1.0 Crock / =) (Popr azp_weapon_pkm. running
[ 64] [ZP] Extra: Marauders v1.0 Crock azp_weapon_mk48 running
[ 65] [ZP] Extra: New Weapon v1.1 Crock zp_extra_sniper running
[ 66] [ZP] Extra: SKULL5 v1.0 LARS-DAY[BR]EAKE azp_weapon_skul running
[ 67] Jump Grenade v1.0 xz zp_extra_bomb.a running
[ 68] [ZP] Buy Health v1.3 Dcrkan / CHyc / zp_extra_health running
[ 69] [ZP] Can Auto Save Amm v0.1.0 ZombArena.Ru zp_save.amxx running
[ 70] [ZP] Donate Ammo Packs v1.0 r1laX , PomanoB zp_donate_ap.am running
[ 71] stopsay v0.1 kanagava stopsay.amxx running
[ 72] High Ping Kicker v1.0 Shadow/Bo0m! amx_hpk.amxx running
[ 73] [ZL] NoRoundEnd v1.0 Alexander.3 zl_noroundend.a stopped
[ 74] [ZL] RewardSystem v1.3.1 Alexander.3 zl_rewardsystem stopped
[ 75] [ZL] SpawnSystem v1.2 Alexander.3 zl_spawnsystem. stopped
[ 76] SupplyBox v1.2 Alexander.3 zl_supplybox.am stopped
[ 77] [API] ZombieSystem v1.3 Alexander.3 zl_zombiesystem running
[ 78] [ZL] MapChooser v1.1 Alexander.3 zl_mapchooser.a stopped
[ 79] AlienBoss v2.0.2 Alexander.3 zl_alienboss.am stopped
[ 80] [ZL] CoreFunction v2.0.2 Alexander.3 zl_core.amxx running
[ 81] Auto recording demo v2.0 IzI | Bonaqua (R auto_recording_ running
[ 82] NadeModes v11.2 Nomexous & OT nademodes.amxx running
[ 83] Advert Messages v1.2 neygomon advert_messages running
[ 84] Aim Hud Info v1.0 Yakess zp_aimhudinfo.a running
[ 85] Map Manager: Core v3.0.7 Mistrick map_manager.amx running
[ 86] unknown vunknown unknown rechecker.amxx bad load
[ 87] Cs_Hook v1.0 koshak cs_hook.amxx running
[ 88] Grab New v2.5 Cs-Str1ke.Clan.S grab_new.amxx running
[ 89] [ZP]Concussion Grenade v1.5 DimoK zp_extra_conc.a running
[ 90] unknown vunknown unknown Pumba.amxx running
[ 91] Janus 1 v1.0 m4m3ts zp_extra_janus1 running
[ 92] Player Model v2.13c commonbullet player_model.am running
[ 93] [182] Spect Bot v17.08.28 SKAJIbnEJIb & Bo spectbot.amxx running
[ 94] [ZBG] Menu Front v1.0 BaRSiK zp_sponsor_menu running
[ 95] New Jetpack v0.0.2 Bad_Bud,ZmOutSta zp_jetpack_new. running
[ 96] [CSO] Thanatos-5 v1.0 Sneaky.amxx | SO zp_extra_thanat running
[ 97] [ZP] Extra: AWP Camo v1.0 Crock / =) (Popr zp_extra_awp_wo running
[ 98] Players Log v1.1 Mistrick players_log.amx running
[ 99] Online Logger v1.0.3 mx?! online_logger.a running
[100] [ZP43] Extra item: Gas 3.0 H.RED.ZONE zp43_gas_mask.a running
[101] [ZP] Extra Item: Strip 1.6 Hezerf zp_extra_strip. running
[102] [CSO LIKE] LaserMG 1.1 Lakerovich cso_weapon_lase running
[103] [ZP] ZP++ Ice Cube 1.0 DareDevil (Gyiov zp_zp_ice_cube. running
[104] All-Menu 1.0 Dambas zp_ruletka.amxx running
[105] Time Presents 0.1 WPMG Team zp_addon_time_p running
[106] [ZP] 50-50 Plague Mode 0.2 MeRcyLeZZ zp_mod_50_50.am running
[107] UCC Addon: VoteGAG 1.2 neygomon ucc_votegag.amx running
[108] Map Manager: Scheduler 0.1.5 Mistrick map_manager_sch running
[109] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[110] Map Manager: Nominatio 0.1.2 Mistrick map_manager_nom running
[111] Map Manager: BlockList 0.0.3 Mistrick map_manager_blo running
[112] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[113] Map Manager: Effects 0.0.9 Mistrick map_manager_eff running
[114] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
Автор плагина
AlexandrFiner/ex3m777
Версия плагина
0.1
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <time>
#include <reapi>

const TASK_LOAD_CONFIG = 518232;
const TASK_LOAD = 158716;

/* Настройки */
#define SQL_HOST "83.222.115.150" // Хост базы данных
#define SQL_DATEBASE "db569689" // База данных
#define SQL_USER "u569689jdia" // Пользователь базы данных
#define SQL_PASSWORD "wzTiq39Qcs8qVlOLvMLe" // Пароль от базы данных

#define SERVER_ID 4 // id сервера
#define SQL_TABLE "gm_amxadmins" // Таблица с админами
#define SQL_TABLE_SERVERS "gm_admins_servers" // Таблица для активации админов

#define PLUGIN_PREFIX "Online" // Префикс перед сообщениями в чате и в логах
#define COMMAND "promocode" // Команда для ввода промокода


//#define SEE_MENU // (*) Показ меню после первой смерти.

#if defined SEE_MENU
new bool:g_bSeeMotd[33];
new KEYSMENU = (1<<4)|(1<<9);
#endif


enum _:eData_Codes { PROMOCODE[64], ACCESS[64], TIME };
new aDataCodes[eData_Codes];

enum _:TOTAL_SQL_TYPES { SQL_TYPE_INSERT, SQL_TYPE_IGNORE }
new Handle:g_hSqlTuple;
new g_szSteamID[MAX_PLAYERS + 1][34];

new g_szLogFile[PLATFORM_MAX_PATH];

public plugin_init() {
register_plugin("Promocode", "0.1", "AlexandrFiner");
register_clcmd(COMMAND, "Command_Promcode");
register_clcmd("say /promo", "Open_PromoMenu");
register_clcmd("say_team /promo", "Open_PromoMenu");
register_menucmd(register_menuid("Open_PromoMenu"), 1023, "Close_PromoMenu");
register_dictionary("time.txt");

#if defined SEE_MENU
RegisterHookChain(RG_CBasePlayer_Killed, "player_kill", true);
register_menu("Menu_Server", KEYSMENU, "Menu_Server");
#endif

}

public client_putinserver(id)
get_user_authid(id, g_szSteamID[id], charsmax(g_szSteamID[]));

public plugin_cfg() {
new szDir[] = "addons/amxmodx/logs/promocode";
if(!dir_exists(szDir)) {
mkdir(szDir);
}
new szDate[16]; get_time("%Y%m%d", szDate, charsmax(szDate));
formatex(g_szLogFile, charsmax(g_szLogFile), "%s/log_%s.txt", szDir, szDate);

SQL_SetAffinity("mysql");
g_hSqlTuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASSWORD, SQL_DATEBASE);
}


#if defined SEE_MENU
public player_kill(victim)
{
if(!is_user_connected(victim)) {
return;
}

if(!g_bSeeMotd[victim]) {
static menu[1024], len;
len = formatex(menu[len], charsmax(menu) - len, "\rХочешь узнать как получить бесплатно VIP?^n^n");
len += formatex(menu[len], charsmax(menu) - len, "\r5. \yДа, Я хочу VIP :)^n");
len += formatex(menu[len], charsmax(menu) - len, "\r0. \yВыход");

show_menu(victim, KEYSMENU, menu, -1, "Menu_Server");
}
g_bSeeMotd[victim] = true;
}

public Menu_Server(victim, key) {
switch(key) {
case 4: {
if(is_user_connected(victim)) {
show_motd(victim, "forum.txt", "Forum");
}
}
}
}

public client_disconnected(id)
{
g_bSeeMotd[id] = false;
}
#endif


public SQL_Handler(iFailState, Handle:sqlQuery, const szError[], iError, const szData[], iDataSize) {
switch(iFailState)
{
case TQUERY_CONNECT_FAILED:
{
log_amx("MySQL connection failed");
log_amx("[ %d ] %s", iError, szError);
if(iDataSize) {
log_amx("Query state: %d", szData[1]);
}
return;
}
case TQUERY_QUERY_FAILED:
{
new szLastQuery[512];
SQL_GetQueryString(sqlQuery, szLastQuery, charsmax(szLastQuery));
log_amx("MySQL query failed");
log_amx("[ %d ] %s", iError, szError);
log_amx("[ SQL ] %s", szLastQuery);
if(iDataSize) {
log_amx("Query state: %d", szData[1]);
}
return;
}
}

new iAuthType = szData[0];
switch(iAuthType)
{
case SQL_TYPE_INSERT:
{
new insertId = SQL_GetInsertId(sqlQuery);

new szQuery[512];
formatex(szQuery, charsmax(szQuery), "INSERT INTO `%s` (`admin_id`, `server_id`, `use_static_bantime`) VALUES ('%d', '%d', 'no')", SQL_TABLE_SERVERS, insertId, SERVER_ID);
new szDataNew[1]; szDataNew[0] = SQL_TYPE_IGNORE;
SQL_ThreadQuery(g_hSqlTuple, "SQL_Handler", szQuery, szDataNew, sizeof szDataNew);
server_cmd("amx_reloadadmins");
}
}
}

public plugin_precache() {
load_config();
set_task_ex(60.0, "load_config", TASK_LOAD_CONFIG, .flags = SetTask_Repeat);
}

public load_config() {
new szPath[PLATFORM_MAX_PATH], szCfgFile[PLATFORM_MAX_PATH];
get_configsdir(szPath, charsmax(szPath));
formatex(szCfgFile, charsmax(szCfgFile), "%s/promocode.ini", szPath);

if(!file_exists(szCfgFile)) {
set_fail_state("[Промокоды] Файл %s не найден.", szCfgFile);
return;
}

new iConfig = fopen(szCfgFile, "rt");
if(iConfig)
{
new szBuffer[512], szTime[8];
while(!feof(iConfig))
{
fgets(iConfig, szBuffer, charsmax(szBuffer));

if(!szBuffer[0] || szBuffer[0] == ';')
continue;

parse(szBuffer,
aDataCodes[PROMOCODE], charsmax(aDataCodes[PROMOCODE]),
aDataCodes[ACCESS], charsmax(aDataCodes[ACCESS]),
szTime, charsmax(szTime)
);
aDataCodes[TIME] = str_to_num(szTime);
break;
}
fclose(iConfig);
}
}

public Command_Promcode(id) {
new szArg[32];
read_args(szArg, charsmax(szArg));
remove_quotes(szArg);
trim(szArg);

if(!strlen(szArg))
return PLUGIN_HANDLED;

if(equali(szArg, aDataCodes[PROMOCODE])) {
//if(get_user_flags(id) & read_flags(aDataCodes[PROMOCODE])) {
if(get_user_flags(id) & read_flags(aDataCodes[ACCESS])) {
client_print_color(id, print_team_red, "^4[%s] ^1Простите, но у вас ^3уже ^1есть эта привлегия^1.", PLUGIN_PREFIX);
return PLUGIN_HANDLED;
}

new iTime = 60 * aDataCodes[TIME];

//client_print_color(id, id, "^4[%s] ^1Вам ^4успешно ^1выдана услуга. Срок: ^3%d мин.", PLUGIN_PREFIX, aDataCodes[TIME]);
client_print_color(0, print_team_default, "^4[%s] ^1Игрок ^3%n ^1активировал ^4Promo VIP ^1на ^3%d ^1мин.", PLUGIN_PREFIX, id, aDataCodes[TIME]);

new iSysTime;
iSysTime = get_systime() + 7200;
new szQuery[512];
formatex
(
szQuery, charsmax(szQuery),
"\
INSERT INTO `%s` ( `access`, `flags`, `steamid`, `nickname`, `icq`, `created`, `expired`, `days`, `ashow`) VALUES ( '%s', 'ce', '%s', '%s', 'Промокод - %n', '%d', '%d', '1', '1') \
",
SQL_TABLE, aDataCodes[ACCESS], g_szSteamID[id], g_szSteamID[id], id, iSysTime, (iSysTime + iTime)
);
new szDataNew[1]; szDataNew[0] = SQL_TYPE_INSERT;
SQL_ThreadQuery(g_hSqlTuple, "SQL_Handler", szQuery, szDataNew, sizeof szDataNew);

log_to_file(g_szLogFile, "Актвация промокода (%s, %s, %d мин) - %n (%s)", aDataCodes[PROMOCODE], aDataCodes[ACCESS], aDataCodes[TIME], id, g_szSteamID[id]);
}
else client_print_color(id, print_team_red, "^4[%s] ^1Данный промокод ^3не найден^1 в базе.", PLUGIN_PREFIX);
return PLUGIN_HANDLED;
}

public Open_PromoMenu(id) {
new szMenu[512],
iLen = formatex(szMenu, charsmax(szMenu), "\yАктивировать промокод^n^n");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r1. \wВвести промокод^n");
formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r0. \wВыход");
return show_menu(id, (1<<0|1<<9), szMenu, -1, "Open_PromoMenu");
}

public Close_PromoMenu(id, iKey) {
switch(iKey) {
case 0: {
client_cmd(id, "messagemode ^"%s^"", COMMAND);
client_print_color(id, id, "^4[%s] ^1Введите промо код и нажмите Enter.", PLUGIN_PREFIX);
}
case 9: return PLUGIN_HANDLED;
}
return Open_PromoMenu(id);
}
Собственно, суть я описал, ошибка есть, но она в том, что не выдаются права... Почему? Понять не могу
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
10
Реакции
-2
Pokemoshka, какие именно пароли? В базе данных? Или в плагине, где указываются данные для подключения к БД?

UPD: Понял, но не знаю, как отредактировать 1-ый пост в топике, поэтому просто сменил данные для подключения.
 
Последнее редактирование:
Сообщения
511
Реакции
111
Помог
16 раз(а)
Ryfer, после ввода промокода что показывает amx_who ? Выдало флаги или нет?
 
Сообщения
10
Реакции
-2
Забавно, обнаружил, что в самой таблице запись с игроком вводившим промокод появляется, а привилегий как таковых он не получает...
 
Последнее редактирование:
Сообщения
10
Реакции
-2
Всё, я разобрался. Дело было в том, что я SERVER ID не поменял...))
Код:
#define SERVER_ID
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу