VIP_TEST помогите решить проблему!

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
29
Реакции
-5
Ошибка
Ошибок нету!
ОС
Linux
Amx Mod X
Amx Mod X ниже 1.9.0
Билд
Rehlds_3.6.0.671
ReGamedll
ReGamedll 5.7.0.330
Версия Metamod
metamod 1.3.0.128
Список метамодулей
description    stat pend  file                        vers             src  load  unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.133 ini Start Never
[ 2] Revoice RUN - revoice_mm_i386.so v0.1.0.32 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 4] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 5] AMX Mod X RUN - amxmodx_mm_i386.so v1.8.3-dev+5120 ini Start ANY
[ 6] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 7] ReSemiclip RUN - semiclip.so v2.2(a) ini Chlvl ANY
[ 8] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl5 ANY Never
[ 9] Engine RUN - engine_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[11] MySQL RUN - mysql_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[12] ReAPI RUN - reapi_amxx_i386.so v5.8.0.166-dev pl5 ANY Never
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[14] CSX RUN - csx_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[15] CStrike RUN - cstrike_amxx_i386.so v1.8.3-Re pl5 ANY ANY
[16] Fun RUN - fun_amxx_i386.so v1.8.3-Re pl5 ANY ANY
16 plugins, 16 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] [183] AMXBans RBS 18.10.13 SKAJIbnEJIb & La amxbans_rbs.amx running
[ 2] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a debug
[ 3] pvpru ranget t 0.2.143 kekt AntiSoundESP.am running
[ 4] Fake Map 0.2 Vaqtincha FakeMap.amxx running
[ 5] Fake Ping 1.0 MeRcyLeZZ/gyxoBk FakePing.amxx running
[ 6] [183] Screen Player 19.02.22 SKAJIbnEJIb screen_player.a running
[ 7] [183] Ad From Server 17.10.30 SKAJIbnEJIb ad_from_server. running
[ 8] Players Menu 16.11.25 AMXX Dev Team & admincmd_rbs.am running
[ 9] Menus Front-End 18.12.18 AMXX Dev Team & amxmodmenu_rbs. running
[ 10] [183] AR Vampire 17.08.22 SKAJIbnEJIb ar_vampire.amxx running
[ 11] [183] Army Ranks Ultim 18.05.15 SKAJIbnEJIb army_ranks_ulti running
[ 12] [183] Chat RBS 19.02.22 SKAJIbnEJIb chat_rbs.amxx running
[ 13] [183] CsStats MySQL 18.08.09 SKAJIbnEJIb csstats_mysql.a running
[ 14] [183] Skill ELO 18.03.24 SKAJIbnEJIb skill_elo.amxx running
[ 15] [183] AC GasPuff 17.10.30 SKAJIbnEJIb ac_gaspuff.amxx running
[ 16] Maps Menu 15.07.22 AMXX Dev Team & mapsmenu_rbs.am running
[ 17] [183] Stats Configurat 18.05.15 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 18] [183] StatsX RBS 18.03.24 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 19] timeleft 1.0 Kasper timeleft_rr.amx running
[ 20] Show Motd 0.1 unnamed modt.amxx running
[ 21] Mapchooser 2.6 Kasper mapchooser.amxx running
[ 22] [183] Auto Spawn Manag 17.10.30 VCL Auto_Spawn_Mana running
[ 23] [183] Kill Assist RBS 17.10.30 Digi & SKAJIbnEJ killassist_rbs. running
[ 24] Ping Control 0.1.5 Freedo.m | neygo Ping_Control.am running
[ 25] [183] Map Spawns Edito 17.08.27 iG_os & SKAJIbnE MapSpawnsEditor running
[ 26] AntiFlash FINAL 5.0 Leo_[BH] antiflash5.amxx running
[ 27] MuteMenu by KaSpEr 1.0 Kasper mutemenu.amxx running
[ 28] Admin Chat 1.8.3-Re AMXX Dev Team adminchat.amxx running
[ 29] NextMap 1.8.3-Re AMXX Dev Team nextmap.amxx running
[ 30] Restrict Weapons 1.8.2 AMXX Dev Team restmenu.amxx running
[ 31] TimeLeft 1.8.3-Re AMXX Dev Team timeleft.amxx running
[ 32] Auto rr 1.0 9 rpamm!? auto_rr.amxx running
[ 33] 'Fire in the hole' blo 1.0 xPaw hidefireintheho running
[ 34] Parachute 1.0 maeStro parachute.amxx running
[ 35] server_demo 3.0 Saveliy demo.amxx running
[ 36] Restart 1.0 MaksaTaksa admin_rr.amxx running
[ 37] Amx_Killer 1.1 Xhonor/asd edit damager_swidi11 running
[ 38] ResetScore 1.0 Leo_[BH] resetscore.amxx running
[ 39] c4 timer 1.1 cheap_suit c4timer.amxx running
[ 40] [AMXX] ViP Gold 1.0 Kasper amxx_vip_goldi_ debug
[ 41] Menu 1.0 InKvIzItOr Menu_serv.amxx running
[ 42] [ReAPI] AdminFreeLook 1.0 ReHLDS Team adminfreelook.a running
[ 43] [183] Block Reconnect 17.08.09 ShaTalKiN Block_Reconnect running
[ 44] Game Namer 1.1 NeuroToxin gamenamechanger running
[ 45] [183] Ultimate Models 18.12.19 SKAJIbnEJIb ultimate_models running
[ 46] [183] WallHack Viewer 18.05.15 SKAJIbnEJIb wallhack_viewer running
[ 47] Advanced Spam Nick Cha 0.2 Fullserver advanced_spam_n running
[ 48] AWPoff 4.0 PAffAEJIkA :3 awp.amxx running
[ 49] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 50] Team menu 1.1 NobodyInTeam teammenu.amxx running
[ 51] FakeFull Original 1.7.6 JTP10181/Freecod fakefull_origin running
[ 52] Nade Messages 1.0 v3x nademessages.am running
[ 53] Recoil Control 1.5 OT recoil_control. running
[ 54] AMXX Gag 1.4.9 xPaw & Exolent amx_gag.amxx running
[ 55] Vip Test 1.0 daywer vip_test.amxx running
55 plugins, 55 running
Автор плагина
Автор не известный
Версия плагина
Не известно
Исходный код
#include <amxmodx>
#include <sqlx>
#include <csstats>
#pragma tabsize 0 /* Впадлу.... */
/* константы */
#define VIP_TEST_HOUR 24
#define S_MINUTE 60
#define S_HOUR 3600
#define DB_SAVEBY_STEAMID 0
#define DB_SAVEBY_IP 1
#define DB_SAVEBY_NAME 2
#define SAVE_TYPE 0 //0 - по стимид 1 -по айпи 2 - по нику
#define DB_SAVE 2 //1-sqlite 2- mysql
#define MAX_PLAYER 32
#define MIN_RANK 3000 /* Чтобы новые аккаунты не брали */

new const szTableName[] = "vip_test" //Название таблицы
new const szDBHost[] = "" // Хост
new const szDBUser[] = "" //Пользователь
new const szDBPass[] = "" //Пароль от бд
new const szBDName[] = "" //название бд
#define VIP_FLAG "t" //Какие флаги выдавать?
/* Переменные */
new szKeyName[16];
new bool:PlayerAlreadyUseVip[MAX_PLAYER+1];
new EndTime[MAX_PLAYER+1];
new Handle:g_SqlTuple;
new g_Error[512];
public plugin_init()
{
register_plugin("Vip Test", "1.0", "daywer")
/* команда вызова */
register_clcmd("say /vip_test","CmdVipTest")
register_clcmd("say vip_test","CmdVipTest")
/* Меню */
register_menucmd(register_menuid("\yV.I.P тест"), 1023, "hnd_viptest_menu")

/* Для сохранения*/
DB_GetKeyName( szKeyName, 15 );
switch(DB_SAVE)
{
case 1:SQL_SetAffinity( "sqlite" );
case 2:SQL_SetAffinity( "mysql" );
}
}
/* Вызов главного меню*/
public CmdVipTest(idPlayer)
{
if(!is_user_connected(idPlayer))
return;

static pos, cache[512]
pos = 0
new keys;
if(PlayerAlreadyUseVip[idPlayer])
{
keys = (1<<1)|(1<<9)
new szEndTime[44],EndPlayerTime;
EndPlayerTime = EndTime[idPlayer] - get_systime();
get_human_time(EndPlayerTime,szEndTime,sizeof(szEndTime)-1)
if(EndTime[idPlayer] > get_systime())
pos += formatex(cache[pos], 511-pos, "\yV.I.P тест^nДо конца теста %s",szEndTime)
else
pos += formatex(cache[pos], 511-pos, "\yV.I.P тест^n\rТест окончен!")

pos += formatex(cache[pos], 511-pos, "^n\y|\r1\y|.\dПолучить V.I.P на %d часов",VIP_TEST_HOUR)
pos += formatex(cache[pos], 511-pos, "^n\y|\r2\y|.\yИнформация")

}
else
{
keys = (1<<0)|(1<<1)|(1<<9)
pos += formatex(cache[pos], 511-pos, "\yV.I.P тест^n")
pos += formatex(cache[pos], 511-pos, "^n\y|\r1\y|.\yПолучить V.I.P на \r%d \y часов",VIP_TEST_HOUR)
pos += formatex(cache[pos], 511-pos, "^n\y|\r2\y|.\yИнформация")
}

pos += formatex(cache[pos], 511-pos, "^n^n^n0. \wВыход^n")
show_menu( idPlayer, keys, cache, -1)
return;
}
/* обработчик меню*/
public hnd_viptest_menu(idPlayer,key)
{
if(!is_user_connected(idPlayer))
return;

switch (key)
{
case 0:
{
new stats[8],bodyhits[8], rank;
rank = get_user_stats(idPlayer, stats,bodyhits)
if(rank > MIN_RANK)
{
client_print(idPlayer,print_chat,"Прости,но твой rank должен быть ниже %d!",MIN_RANK)
CmdVipTest(idPlayer)
return;
}
client_print(idPlayer,print_chat,"Бесплатный период активирован!Вперед!")
new szTemp[512],ENDTime;
ENDTime = (get_systime() +(VIP_TEST_HOUR*S_HOUR))
new szKey[66];
DB_GetKey( idPlayer, szKey, 65 );
format(szTemp,charsmax(szTemp),"INSERT INTO `%s` ( `%s` , `timeend`)VALUES ('%s','%i');",szTableName,szKeyName,szKey,ENDTime)
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
EndTime[idPlayer] = ENDTime;
PlayerAlreadyUseVip[idPlayer] = true;
set_user_flags(idPlayer, read_flags( VIP_FLAG))
}
case 1:
{
show_motd(idPlayer,"addons/amxmodx/configs/vip_test.txt", "VIP Тест")
}
default:return;
}
return;
}

/* Загрузка бд*/
public plugin_cfg()
Sql_Init()

/* Коннект к базе*/
public Sql_Init()
{
g_SqlTuple = SQL_MakeDbTuple( szDBHost, szDBUser, szDBPass, szBDName );
new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
if(SqlConnection == Empty_Handle)
set_fail_state(g_Error)
new Handle:Queries
new szSendQuery[100];
format(szSendQuery,99,"CREATE TABLE IF NOT EXISTS %s (%s varchar(64),timeend INT(16))",szTableName,szKeyName)
Queries = SQL_PrepareQuery(SqlConnection,szSendQuery)
if(!SQL_Execute(Queries))
{
SQL_QueryError(Queries,g_Error,charsmax(g_Error))
set_fail_state(g_Error)
}
SQL_FreeHandle(Queries)
SQL_FreeHandle(SqlConnection)
}
/* Игрок подкл к серверу*/
public client_putinserver(idPlayer)
{
PlayerAlreadyUseVip[idPlayer] = false;
EndTime[idPlayer] = 0;
Load_Sql(idPlayer)
}
/* загрузка данных о игроке*/
public Load_Sql(idPlayer)
{
new szTemp[512]
new Data[1]
new szKey[66];
DB_GetKey( idPlayer, szKey, 65 );
Data[0] = idPlayer
format(szTemp,charsmax(szTemp),"SELECT * FROM `%s` WHERE (`%s`.`%s` = '%s')",szTableName,szTableName,szKeyName,szKey)
SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
}
/* загрузка 2 данных о игроке*/
public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error)
}
else if(FailState == TQUERY_QUERY_FAILED)
{
log_amx("Load Query failed. [%d] %s", Errcode, Error)
}

new idPlayer
idPlayer = Data[0]

if(SQL_NumResults(Query) < 1)
{
//Игрока нет в базе его ждет халявная випка
}
else
{
PlayerAlreadyUseVip[idPlayer] = true;
EndTime[idPlayer] = SQL_ReadResult(Query, 1);
if(EndTime[idPlayer] > get_systime())
set_user_flags(idPlayer, read_flags( VIP_FLAG))
}
return PLUGIN_HANDLED
}
public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
SQL_FreeHandle(Query)
return PLUGIN_HANDLED
}
/* Секунды в минуты,часы*/
get_human_time(time,output[],len)
{
new m,h
if(time)formatex(output,len,"%d сек",time)
if(time/S_MINUTE)
{
m=time/S_MINUTE
formatex(output,len,"%d мин.",m)
}
if(time/S_HOUR)
{
h=time/S_HOUR
m=(time-(h*S_HOUR))/S_MINUTE
new szHour[16];
switch(h)
{
case 1,21:format(szHour,charsmax(szHour),"час")
case 2..4,22..24:format(szHour,charsmax(szHour),"часа")
case 5..20:format(szHour,charsmax(szHour),"часов")
}
formatex(output,len,"%d %s и %d мин",h,szHour,m)
}
}
/* Закрывает сессию,но не твою*/
public plugin_end()
SQLITE_Close()

SQLITE_Close()
{
if ( g_SqlTuple )
{
SQL_FreeHandle(g_SqlTuple);
}
}
/* Получает данные о игроке(зависит от настройки)*/
DB_GetKey( id, szKey[], len )
{
switch(SAVE_TYPE)
{
case DB_SAVEBY_NAME:
{
get_user_name( id, szKey, len );
replace_all( szKey, len, "'", "''" );
}
case DB_SAVEBY_IP: get_user_ip( id, szKey, len, 1 );
case DB_SAVEBY_STEAMID: get_user_authid( id, szKey, len );
}
}
/* Главный ключ сохранения игрока*/
DB_GetKeyName( szKeyName[], len )
{
switch( SAVE_TYPE )
{
case DB_SAVEBY_NAME: copy( szKeyName, len, "player_name" );
case DB_SAVEBY_IP: copy( szKeyName, len, "player_ip" );
case DB_SAVEBY_STEAMID: copy( szKeyName, len, "player_steamid" );
}
}
Плагин Тест - Вип через команду amx_who проверяю человеку который пробует взять тестовый период флаг t выдает как я указал в исходнике, но випка не работает ((
подключаю плагин через csbans, mysql помогите пожалуйста заранее спасибо!
 
Сообщения
2,288
Реакции
1,740
Помог
31 раз(а)
swidi, Если ваша версия Amx Mod X ниже 1.9.0 , то заполнять анкету смысла нет. На нашем форуме не поддерживаются устаревшие версии.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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