не подключается к базе данных

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
Ошибка
L 09/06/2022 - 13:30:07: [AMXX] Plugin ("xman2030_level.amxx") is setting itself as failed.
L 09/06/2022 - 13:30:07: [AMXX] Plugin says: Unknown MySQL server host 'remotemysql.com' (16)
L 09/06/2022 - 13:30:07: [AMXX] Run time error 1 (plugin "xman2030_level.amxx") - forced exit
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.8.0.709-dev+m
Build date: 08:40:10 Feb 22 2021 (2508)
Build from: https://github.com/dreamstalker/rehlds/commit/dc75d82
ReGamedll
ReGameDLL version: 5.20.0.505-dev
Build date: 11:06:14 Apr 17 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/e86284b
Версия Metamod
Metamod v1.21p37  2013/05/30 (5:13)
by Will Day
http://www.metamod.org/
Patch: Metamod-P (mm-p) v37
by Jussi Kivilinna
http://metamod-p.sourceforge.net/
compiled: May 30 2013, 11:41:16 EET (optimized)
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386. v0.1.0.9 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 4] VoiceTranscoder RUN - VoiceTranscoder. v2017RC4 ini ANY ANY
[ 5] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0.5 ini Start ANY
[ 6] Rechecker RUN - rechecker_mm_i38 v2.5 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i38 v1.5.696 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 9] Ultimate Unprec RUN - unprecacher_i386 vBeta 2. ini Chlvl Chlvl
[10] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl5 ANY ANY
[11] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl5 ANY ANY
[12] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl5 ANY ANY
[13] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl5 ANY ANY
[14] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl5 ANY ANY
[15] GeoIP RUN - geoip_amxx_i386. v1.9.0.5 pl5 ANY ANY
[16] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl5 ANY ANY
[17] SQLite RUN - sqlite_amxx_i386 v1.9.0.5 pl5 ANY ANY
[18] Engine RUN - engine_amxx_i386 v1.9.0.5 pl5 ANY ANY
[19] ReAPI RUN - reapi_amxx_i386. v5.19.0. pl5 ANY Never
[20] ReAimDetector RUN - reaimdetector_am v0.2.2 pl5 ANY Never
20 plugins, 20 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Map Manager 2.5.60 Mistrick mapmanager.amxx running
[ 2] mute 1.0 Aziz xman2030_mute.a running
[ 3] Admin Base 1.9.0.5249 AMXX Dev Team admin.amxx running
[ 4] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 5] Admin Help 1.9.0.5249 AMXX Dev Team adminhelp.amxx running
[ 6] Slots Reservation 1.9.0.5249 AMXX Dev Team adminslots.amxx running
[ 7] Multi-Lingual System 1.9.0.5249 AMXX Dev Team multilingual.am running
[ 8] Commands Menu 1.9.0.5249 AMXX Dev Team cmdmenu.amxx running
[ 9] Players Menu 1.9.0.5249 AMXX Dev Team plmenu.amxx running
[ 10] Teleport Menu 1.9.0.5249 AMXX Dev Team telemenu.amxx running
[ 11] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 12] Plugin Menu 1.9.0.5249 AMXX Dev Team pluginmenu.amxx running
[ 13] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 14] Anti Flood 1.9.0.5249 AMXX Dev Team antiflood.amxx running
[ 15] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 16] Pause Plugins 1.9.0.5249 AMXX Dev Team pausecfg.amxx running
[ 17] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 18] Ultimate Gore 1.6 JTP10181 amx_gore_ultima running
[ 19] TimeLeft 1.9.0.5249 AMXX Dev Team timeleft.amxx running
[ 20] Advanced Weapon Tracer 1.3.0 ConnorMcLeod advanced_weapon running
[ 21] NextMap 1.9.0.5249 AMXX Dev Team nextmap.amxx stopped
[ 22] POD-Bot Menu 1.3 g4s|figurE.09 amxx_podbotmenu running
[ 23] Game Namer 1.1 NeuroToxin gamenamechanger running
[ 24] Precache Management 1.0.0 ConnorMcLeod precache_manage stopped
[ 25] Advert Messages 1.2 neygomon adverts.amxx running
[ 26] Fix Remove Entity When zm zm zp_entityfix.am paused
[ 27] ScreenMaker 1.1 neygomon screen_maker.am running
[ 28] fb_forwards 0.1.8 Mazdan & Neugomo fb_forwards.amx running
[ 29] FreshBans 1.4.0b kanagava fresh_bans_1.4. running
[ 30] Menus Front-End 1.5 neugomon menufront_end.a running
[ 31] AMXX Gag 1.4.9 xPaw & Exolent amx_gag.amxx running
[ 32] motd 1.1 L@NPOC@N motd.amxx running
[ 33] unknown unknown unknown warnings.amxx bad load
[ 34] Anti Reklama 1.1 MarcaD anti_reklama.am running
[ 35] unknown unknown unknown health_nade.amx bad load
[ 36] SpecList 1.2a FatalisDK speclist_rus.am running
[ 37] DemoRecoder 1.2 neygomon demorecoder.amx running
[ 38] AFK Manager 1.2 Xramer afk_manager.amx paused
[ 39] Chat Logger 2.1a Jim chat_logger.amx running
[ 40] Zombie Escape 1337 xman2030 xman2030_ze_mod paused
[ 41] [ZP]Level System 6.0 Dambas xman2030_level. error
[ 42] Camera View 0.0.1 ConnorMcLeod talrasha_camera debug
[ 43] [ZE] ZClass: Hunter 1.0 KOBRA / t3rkecor xman2030_speed. paused
[ 44] [ZP] Class : Frank 1.0 tumoxa xman2030_pc.amx paused
[ 45] DJB Zombie Class Banch 1.0 Csoldjb xman2030_witch. paused
[ 46] [CSO Like] ZClass: Yak 0.2 | 30.0 inf xman2030_sasha. paused
[ 47] [ZP Class] Flying Zomb 0.1 ONYX xman2030_flying paused
[ 48] ZP Class Energy Ball(T 2.1 Jim/tERoR edit/O xman2030_tesla. paused
[ 49] [CSO] Class String Fin 2.0 BLACK_ROSE zp_class_finger paused
[ 50] Undertaker 1.0 DSHGFHDS zp_undertaker.a paused
[ 51] NST Zombie Class Heal 1.0 NST NST_ZbClass_Hea running
[ 52] [ZP] Drowned Zombie 1.2 tuty/CHyC zp_drowned_zomb paused
[ 53] Houndeye Zombie 0.4 Morte zp_zclass_hound paused
[ 54] unknown unknown unknown azp_zclass_sire paused
[ 55] [CSO:Heavy Zombie] 1.1 REDEMAX cso_heavy.amxx paused
[ 56] CSO Lusty Rose 1.0.1 ALBTeam zp_class_LustyR running
[ 57] [ZP] Class: x-Voodoo 2019 | 1.0 xUnicorn (t3rkec zp_zclass_voodo running
[ 58] [CSO:Hunter Zombie] 1.2 HoRRoR/tERoR edi zp_china.amxx paused
[ 59] ZM VIP 1.7.2 aaarnas xman2030_vip.am running
[ 60] [FS] Chat 1.1 Inf xman2030_chat.a paused
[ 61] Heli Button Info 1.0 Shanks' xman2030_showes running
[ 62] [ZP] EASY SAVE AMMO 1.2 CS-FADE.RU xman2030_ammo_a paused
[ 63] [ZP] Addon: Win Models 0.1 CS-FADE.RU xman2030_ze_amo debug
[ 64] [ZP Addon] Knives 0.1 ONYX xman2030_knifes paused
[ 65] [ZP] Admin Lvl Menu 1.0 Dambas xman2030_level_ running
[ 66] ZE HUD Final CS-FADE.RU xman2030_ze_hud running
[ 67] NadeModes 11.2 Nomexous & OT xman2030_nademo running
[ 68] [ZP] ZP++ Ice Cube 1.0 DareDevil (Gyiov xman2030_ice_cu running
[ 69] Weapon Model + Sound R 1.2 GHW_Chronic GHW_Weapon_Repl running
[ 70] xman2030_damager CS-FADE.RU CS-FADE.RU xman2030_damage running
[ 71] ZP: Zombie Health 1.0 Yakess yakess_health.a debug
[ 72] Countdown 1.7.3 T a l R a s h a gameplay_countd running
[ 73] Zp info Big 0.1 TalRasha zp_info_big.amx running
[ 74] [ZP] Addon: Ammo Box 1.1 | 2019 xUnicorn zp_addon_ammobo paused
[ 75] ammo donate/dhud 1.5 user/zobie-dead zp_ammo_donate. running
[ 76] Team Locker 1.5 Bmann_420 teamlocker.amxx running
[ 77] xman2030_human_revolut CS-FADE.RU CS-FADE.RU xman2030_human_ paused
[ 78] [ZP] Addon: Evolution 0.0.7 https://vk.com/i xman2030_evolut running
[ 79] xman2030_aura CS-FADE.RU CS-FADE.RU xman2030_aura.a paused
[ 80] xman2030_blood CS-FADE.RU CS-FADE.RU xman2030_blood. running
[ 81] ZP Reloading! Shout 0.0.1 xPaw,wbyokomo reloading_weapo running
[ 82] [ZP] Addon: Weather 0.1 | 30.0 inf / xman2030 xman2030_weathe paused
[ 83] unknown unknown unknown xman2030_leader paused
[ 84] [ZP] Shoot Light 0.1 | 11.0 inf xman2030_shot_l running
[ 85] [ZP] Round ended effec 1.0 *GEORGE* xman2030_ended_ running
[ 86] [ZP] Round Draw Blast 1.0 MeRcyLeZZ xman2030_round_ running
[ 87] Breakable Hint 1.1 Raheem hint.amxx running
[ 88] Menu_Priv 1.0 CS-FADE.RU xman2030_menu_p running
[ 89] [ZP] VIP menu 1.2 CS-FADE.RU xman2030_vip_me running
[ 90] [ZP] VIP menu 1.2 CS-FADE.RU xman2030_deluxe running
[ 91] [ZP] VIP menu 1.2 CS-FADE.RU xman2030_creato debug
[ 92] ammo paki 4.0 Bagamut xman2030_ammo_m running
[ 93] unknown unknown unknown xman2030_lk.amx running
[ 94] [ZP] Extra Item: Jump 1.0 Opo4uMapy xman2030_ze_jum debug
[ 95] [ZP] Extra Item Speed 1.2 MeRcyLeZZ zp_extra_speed_ running
[ 96] unknown unknown unknown xman2030_buy_hp running
[ 97] Janus 1 1.0 m4m3ts xman2030_janus1 running
[ 98] [CSO LIKE] Extra: Gull 1.0 Lakerovich xman2030_bloodr paused
[ 99] [Zombie Plague] Weapon 0.7 PlaneShfit1231 / zp_extra_rpg7.a running
[100] [ZP] Extra: CSO Weapon 1.0 KORD_12.7 xman2030_m3.amx running
[101] [ZP] Weapon: M32 1.0 PbI)I(Uu' / Batc xman2030_m32.am running
[102] [ZP] Extra: CSO ClayMo 1.0 TemplateAuthor:K xman2030_Claymo running
[103] [ZP] Air Strike 1.0 Dorus xman2030_air_st running
[104] [CSO LIKE] LaserMG 1.1 Lakerovich cso_weapon_lase running
[105] Janus-11 1.0 m4m3ts zp_extra_janus1 running
[106] [ZP] Extra: HK416 1.0 Crock / =) (Popr yt_extra_janus1 running
[107] Rail Cannon 1.0 m4m3ts zp_extra_railca running
[108] ZP Extraitem: FNP-45 1.0 Base: Batcon; Re zp_extraitems_f running
[109] [ZP] Weapon: JANUS-7 1.0 xUnicorn (t3rkec zp_weapon_janus running
[110] Extraitems: Water Pist 1.0 Base: Batcon & x zp_extraitems_w running
[111] [ZP] Weapon: Crossbow 1.0 xUnicorn (t3rkec zp_weapon_cross running
[112] [ZMO] Extra-Item: Skul 1.0 Mr.Kot3 zmo_weapon_skul running
[113] [ZP] Extra: m134ex 1.0 LARS-DAY[BR]EAKE zp_weapon_m134e paused
[114] [ZP] Extra item: Aeoli 1.0 m4m3ts zp_extra_aeolis running
[115] [ZP] Extra: Squeak Gre 1.0.6-wwm Arkshine zp_extra_squeak running
[116] [ZE] Addon: XMAS 2040 0.1 | 30.0 Reega! inf2030_ze_lead running
[117] [ZM] Choose Weapon 1.6.1 t3rkecorejz | Un xman2030_menu_w paused
[118] HUINYA HUINYA HUINYA xman2030_def_we running
[119] [ZP] Extra: Anaconda 1.0 Crock / =) (Popr xman2030_anacon running
[120] [ZP] Extra: CSO Weapon 1.0 KORD_12.7 xman2030_Vulcan running
[121] [ZP] Extra: CSO Weapon 1.0 KORD_12.7 xman2030_Sapien running
[122] [ZP] Extra: M1887 1.0 Crock / =) (Popr xman2030_m1887. running
[123] [ZMO]Weapon: Cyclone 1.0 Base: Batcon; Re xman2030_cyclon running
[124] [ZP] Weapon: Shining H 1.0 xUnicorn (t3rkec xman2030_magicm running
[125] [CSO] Ethereal 0.0.1 Shurik07 xman2030_ethere running
( 33) Load fails: Invalid Plugin (plugin "warnings.amxx")
( 35) Load fails: Module/Library "curl" required for plugin. Check modules.ini.
( 41) Error: Unknown MySQL server host 'remotemysql.com' (16)
125 plugins, 93 running
Автор плагина
Dambas
Версия плагина
6.0 final
Исходный код
*
===================================================================
[ZP]Level System 6.0 FINAL
Автор : Dambas

Обновление :
*Сохранение по MySQL
*Меню выдачи опыта

Главный разработчик https://vk.com/limonka__s
*/
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <zombieplague>
#include <zp_level_system>

#define is_user_valid_connected(%1) (1 <= %1 <= g_maxplayers && g_isconnected[%1])
#define is_user_valid_alive(%1) (1 <= %1 <= g_maxplayers && g_isalive[%1])
#define is_user_valid(%1) (1 <= %1 <= g_maxplayers)

#define MYSQL_SAVE // MySQL сохранение
//#define NVAULT_SAVE // Nvault сохранение

//#define HUD // Показывает худ опыта
#define LUP // Screen-fade, когда обновляется уровень.

#if defined MYSQL_SAVE
#include <sqlx>
#endif
#if defined NVAULT_SAVE
#include <nvault>
#endif

//Опыт для каждого уровня 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
new const Level_Exp[51] = {1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300, 4400, 4500, 4600, 4700, 4800, 4900, 5000}
new g_level[51], g_exp[51], g_next_exp[50], string[21], exp[3][33]

new const level_up[] = "xman2030/task_complete.wav"

new g_maxplayers, d_exp, Float:g_PlayerDamage[33]
new pcvar_damage[10]

#if defined NVAULT_SAVE
new g_vault
#endif

#if defined MYSQL_SAVE

#define SQL_HOST "remotemysql.com" // host name
#define SQL_USER "EQfaT7wDyd"
#define SQL_PASSWORD "это вам не нужно :)"
#define SQL_DATABASE "EQfaT7wDyd"
#define SQL_TABLENAME "zp_level_system"

new Handle:MYSQL_Tuple
new Handle:MYSQL_Connect
new g_szQuery[512];

new bool: UserLoaded[33];
new UserSteamID[33][34];
#endif

public plugin_init()
{
register_plugin("[ZP]Level System", "6.0", "Dambas")

RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage")

register_logevent("RoundStart", 2, "1=Round_Start")

pcvar_damage[0] = register_cvar("zp_dmg_for_xp", "500") // Сколько урона надо нанести для того что бы получить 1 опыт
pcvar_damage[1] = register_cvar("zp_give_xp_for_dmg", "1") // Сколько опыта получит id за нанесенный урон
pcvar_damage[2] = register_cvar("zp_give_for_kill_nem", "10") // Сколько получит id за убийство немезиды
pcvar_damage[3] = register_cvar("zp_give_for_kill_sur", "10") // Сколько получит id за убийство выжевшего
pcvar_damage[4] = register_cvar("zp_give_for_kill_last", "10") // Сколько получит id за убийство последнего человека
pcvar_damage[5] = register_cvar("zp_give_for_kill", "5") // Сколько получит id-человек, за убийство зомби

pcvar_damage[6] = register_cvar("zp_give_zombie", "1") // Сколько получит зомби за убийство человека
pcvar_damage[7] = register_cvar("zp_give_nemesis", "1") // Сколько получит Немезида за убийство человека
pcvar_damage[8] = register_cvar("zp_give_surv", "1") // Сколько получит Выживший за убийство зомби
pcvar_damage[9] = register_cvar("zp_give_lasthum", "10") // Сколько получит Последний человек за убийство зомби

g_maxplayers = get_maxplayers()

#if defined NVAULT_SAVE
g_vault = nvault_open("xman2030_lvl")
#endif
}

public plugin_precache()
{
precache_sound(level_up)
}

public plugin_natives()
{
register_native("zp_level", "native_level", 1)
register_native("zp_exp", "native_exp", 1)
register_native("zp_next_level_exp", "native_zp_next_level_exp", 1)

register_native("zp_get_user_exp", "native_zp_get_user_exp", 1)
register_native("zp_set_user_exp", "native_zp_set_user_exp", 1)
}

public plugin_cfg()
{
new cfgdir[32]
get_configsdir(cfgdir, charsmax(cfgdir))
server_cmd("exec %s/xman2030_lvl.cfg", cfgdir)

#if defined MYSQL_SAVE
SQL_LoadDebug();
#endif
}

public client_connect(id)
{
if (is_user_bot(id))
return

#if defined NVAULT_SAVE
LoadData(id)
#endif
}

public client_putinserver(id)
{
#if defined MYSQL_SAVE
LoadData(id)
#endif
set_task(3.0, "func_change_exp", id)
}

public client_disconnect(id)
{
#if defined NVAULT_SAVE
SaveData(id)
#endif

#if defined MYSQL_SAVE
if(!UserLoaded[id])
return;

formatex(g_szQuery, charsmax(g_szQuery), "UPDATE `%s` SET `lvl` = '%d', `exp` = '%d' WHERE `%s`.`SteamID` = '%s';", SQL_TABLENAME, g_level[id], g_exp[id], SQL_TABLENAME, UserSteamID[id])
SQL_ThreadQuery(MYSQL_Tuple, "SQL_Thread", g_szQuery)
#endif

remove_task(id)
}

public plugin_end()
{
#if defined NVAULT_SAVE
nvault_close(g_vault)
#endif

#if defined MYSQL_SAVE
if(MYSQL_Tuple)
SQL_FreeHandle(MYSQL_Tuple)

if(MYSQL_Connect)
SQL_FreeHandle(MYSQL_Connect)
#endif
}

#if defined MYSQL_SAVE
public SQL_LoadDebug()
{
new szError[512]
new iErrorCode

MYSQL_Tuple = SQL_MakeDbTuple(SQL_HOST, SQL_USER, SQL_PASSWORD, SQL_DATABASE)
MYSQL_Connect = SQL_Connect(MYSQL_Tuple, iErrorCode, szError, charsmax(szError))

if(MYSQL_Connect == Empty_Handle)
set_fail_state(szError)

if(!SQL_TableExists(MYSQL_Connect, SQL_TABLENAME))
{
new Handle:hQueries
new szQuery[512]

formatex( szQuery, charsmax(szQuery), "CREATE TABLE IF NOT EXISTS `%s` (SteamID VARCHAR(32) CHARACTER SET cp1250 COLLATE cp1250_general_ci NOT NULL, lvl INT NOT NULL, exp INT NOT NULL, PRIMARY KEY (SteamID))", SQL_TABLENAME)
hQueries = SQL_PrepareQuery(MYSQL_Connect, szQuery)

if( !SQL_Execute(hQueries))
{
SQL_QueryError(hQueries, szError, charsmax(szError))
set_fail_state(szError)
}
SQL_FreeHandle(hQueries)
}
SQL_QueryAndIgnore(MYSQL_Connect, "SET NAMES utf8")
}

public SQL_Query( iState, Handle: hQuery, szError[], iErrorCode, iParams[], iParamsSize)
{
switch(iState)
{
case TQUERY_CONNECT_FAILED: log_amx("Load - Could not connect to SQL database. [%d] %s", iErrorCode, szError)
case TQUERY_QUERY_FAILED: log_amx("Load Query failed. [%d] %s", iErrorCode, szError)
}

new id = iParams[0]
UserLoaded[id] = true

if(SQL_NumResults(hQuery) < 1)
{
if(equal(UserSteamID[id], "ID_PENDING"))
return PLUGIN_HANDLED
formatex(g_szQuery, charsmax(g_szQuery), "INSERT INTO `%s` (`SteamID`, `lvl`, `exp`) VALUES ('%s', '%d', '%d');", SQL_TABLENAME, UserSteamID[id], g_level[id], g_exp[id])
SQL_ThreadQuery(MYSQL_Tuple, "SQL_Thread", g_szQuery)

return PLUGIN_HANDLED;
}
else
{
g_level[id] = SQL_ReadResult(hQuery, 1)
g_exp[id] = SQL_ReadResult(hQuery, 2)
}

return PLUGIN_HANDLED;
}

public LoadData(id)
{

if(!is_user_connected(id))
return;

new iParams[1]
iParams[0] = id

get_user_authid(id, UserSteamID[id], charsmax(UserSteamID[]))

formatex(g_szQuery, charsmax(g_szQuery), "SELECT * FROM `%s` WHERE (`%s`.`SteamID` = '%s')", SQL_TABLENAME, SQL_TABLENAME, UserSteamID[id])
SQL_ThreadQuery(MYSQL_Tuple, "SQL_Query", g_szQuery, iParams, sizeof iParams)
}

public SQL_Thread(iState, Handle: hQuery, szError[], iErrorCode, iParams[], iParamsSize)
{
if(iState == 0)
return;

log_amx("SQL Error: %d (%s)", iErrorCode, szError)
}
#endif



#if defined NVAULT_SAVE
public SaveData(id)
{
new AuthID[35]
get_user_authid(id,AuthID,34)

new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s",AuthID)
format(vaultdata,255,"%i#%i#%i#",g_exp[id],g_level[id],g_next_exp[id])
nvault_set(g_vault,vaultkey,vaultdata)

return PLUGIN_CONTINUE;
}
public LoadData(id)
{
new AuthID[35]
get_user_authid(id,AuthID,34)

new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s",AuthID)
format(vaultdata,255,"%i#%i#%i#",g_exp[id],g_level[id],g_next_exp[id])
nvault_get(g_vault,vaultkey,vaultdata,255)

replace_all(vaultdata, 255, "#", " ")

new playerxp[32], playerlevel[32], playernextexp[32]

parse(vaultdata, playerxp, 31, playerlevel, 31)

g_exp[id] = str_to_num(playerxp)
g_level[id] = str_to_num(playerlevel)
g_next_exp[id] = str_to_num(playernextexp)

return PLUGIN_CONTINUE;
}
#endif


public func_change_exp (id)
{
d_exp = zp_get_user_exp(id)

exp[0][id] = d_exp
exp[1][id] = d_exp
exp[2][id] = d_exp

#if defined HUD
set_task(1.0,"change_exp",id,_,_,"b")
#endif
}

public change_exp(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR && is_user_connected(id))
return PLUGIN_HANDLED

exp[1][id] = zp_get_user_exp(id)

if(exp[1][id] != exp[2][id])
{
if(exp[1][id] > exp[2][id])
{
d_exp = exp[1][id] - exp[2][id]
format(string,charsmax(string),"[+%d Опыт]", d_exp)
}

exp[2][id] = exp[1][id]

set_hudmessage(255, 15, 247, 0.57, 0.57, 0, 6.0, 3.0,_,_,4)
show_hudmessage(id, "%s", string)
}
return PLUGIN_HANDLED;
}

public fwTakeDamage(id, inflictor, attacker, Float:damage)
{
if(!is_user_connected(attacker))
return;

if(zp_get_user_zombie(attacker) || zp_get_user_survivor(attacker) || zp_get_user_nemesis(attacker))
return;

if(g_level[attacker] > Level_Exp[id])
return;

g_PlayerDamage[attacker] += damage

if(g_PlayerDamage[attacker] >= get_pcvar_float(pcvar_damage[0]))
{
g_exp[attacker] += get_pcvar_num(pcvar_damage[1])
change_exp(id)
g_PlayerDamage[attacker] -= get_pcvar_float(pcvar_damage[0])
}
check_level(attacker)
}

public fw_PlayerKilled(id, killer)
{
menu_cancel(id)
if(!is_user_alive(killer))
return;

if(g_level[killer] > Level_Exp[id])
return;

if(zp_get_user_nemesis(id))
g_exp[killer] += get_pcvar_num(pcvar_damage[2])

else if(zp_get_user_survivor(id))
g_exp[killer] += get_pcvar_num(pcvar_damage[3])

else if(zp_get_user_last_human(id))
g_exp[killer] += get_pcvar_num(pcvar_damage[4])

else if(zp_get_user_zombie(killer))
g_exp[killer] += get_pcvar_num(pcvar_damage[6])

else if(zp_get_user_nemesis(killer))
g_exp[killer] += get_pcvar_num(pcvar_damage[7])

else if(zp_get_user_survivor(killer))
g_exp[killer] += get_pcvar_num(pcvar_damage[8])

else if(zp_get_user_last_human(killer))
g_exp[killer] += get_pcvar_num(pcvar_damage[9])

else
g_exp[killer] += get_pcvar_num(pcvar_damage[5])

check_level(killer)
}

public check_level(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED;

new MAX_LVL = sizeof Level_Exp - 1;

if (g_exp[id] > Level_Exp[MAX_LVL] - 1 )
return PLUGIN_HANDLED;


if( g_exp[id] >= Level_Exp[ g_level[id]])
{
if ( g_level[id] < MAX_LVL )
{
g_level[id]++
emit_sound(id, CHAN_STREAM, level_up, 1.0, ATTN_NORM, 0, PITCH_NORM)
#if defined LUP
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0, 0, 0}, id)
write_short(1 << 11)
write_short(1 << 11)
write_short(0x0001)
write_byte(255)
write_byte(255)
write_byte(0)
write_byte(110)
message_end()
#endif
ChatColor(id, "!g[ZE] !yТы достиг !g%d !yуровня.", g_level[id])
g_exp[id] = 0
}
}

return PLUGIN_HANDLED;
}

public RoundStart()
{
new players[32], num, i
get_players (players, num)

for( i=1; i < num; i++ )
{
exp[0][players[i]] = zp_get_user_exp(players[i])
}

#if defined MYSQL_SAVE
for(new id = 1; id <= 32; id++)
{
if(!is_user_connected(id))
continue;

if(!UserLoaded[id])
return;

formatex(g_szQuery, charsmax(g_szQuery), "UPDATE `%s` SET `lvl` = '%d', `exp` = '%d' WHERE `%s`.`SteamID` = '%s';", SQL_TABLENAME, g_level[id], g_exp[id], SQL_TABLENAME, UserSteamID[id])
SQL_ThreadQuery(MYSQL_Tuple, "SQL_Thread", g_szQuery)
}
#endif
}

public native_level(id)
{
return g_level[id];
}

public native_exp(id)
{
return g_exp[id];
}

public native_zp_next_level_exp(id)
{
return Level_Exp[g_level[id]];
}

public native_zp_get_user_exp(id)
{
if (!is_user_valid(id))
{
log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", id)
return -1;
}

return g_exp[id];
}

public native_zp_set_user_exp(id, amount)
{
if (!is_user_valid(id))
{
return false;
}

g_exp[id] = amount
check_level(id)
return true;
}

stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!r", "^3")
replace_all(msg, 190, "!b", "^0")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), {0,0,0}, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}

stock bool: SQL_TableExists(Handle: hDataBase, const szTable[])
{
new Handle: hQuery = SQL_PrepareQuery(hDataBase, "SELECT * FROM information_schema.tables WHERE table_name = '%s' LIMIT 1;", szTable)
new szError[512]

if(!SQL_Execute(hQuery))
{
SQL_QueryError(hQuery, szError, charsmax(szError))
set_fail_state(szError)
}
else if( !SQL_NumResults(hQuery))
{
SQL_FreeHandle(hQuery)
return false;
}
SQL_FreeHandle(hQuery)
return true;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
всем привет. у меня плагин уровня на зомби сервере не подключается к базе данных, хотя все данные введены верно, но когда переключаюсь на Nvault то все нормально. И когда плагин не может подключится, то главный мод слетает, и сервер выглядит как паблик. Кто знает в чем проблема?
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
3,049
Реакции
1,739
Помог
80 раз(а)
@Artemich,L 09/06/2022 - 13:30:07: [AMXX] Plugin says: Unknown MySQL server host 'remotemysql.com' (16)


написано же в чем проблема.
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
@Алексеич,как же он неизвестный, если такой сайт существует?
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
Алексеич, спасибо сработало) не знаешь ещё почему опыт не дает плагин? или уже отдельную тему надо создавать?
 
Статус
В этой теме нельзя размещать новые ответы.

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

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