Не добавляется уровень

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
4
Реакции
0
Ошибка
Когда Набирается нужное количество exp не выдается уровень
ОС
Linux
Amx Mod X
1.10.0dev
Билд
ReHLDS
ReGamedll
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 16:20:56 Sep 19 2022 (3082)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
Версия Metamod
metamod_re.1.3.xx
Список метамодулей
[ 1] POD-Bot mm    RUN   -    podbot_mm_i386.so         v3.0B20a      ini   ANY  
[ 2] Reunion RUN - reunion.so v0.1.0.137 ini Start Never
[ 3] AMX Mod X RUN - amxmodx.so v1.10.0.5435 ini Start ANY
[ 4] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5435 pl3 ANY
[ 5] CSX RUN - csx_amxx_i386.so v1.10.0.5435 pl3 ANY
[ 6] MySQL RUN - mysql_amxx_i386.so v1.10.0.5435 pl3 ANY
[ 7] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5435 pl3 ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5435 pl3 ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.10.0.5435 pl3 ANY
[10] Engine RUN - engine_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
Список плагинов
[  1] 0   Admin Load              3.9.3 Dev   F@nt0M            unknown                          admin_loade  running  
[ 2] 1 Admin Base 1.10.0.539 AMXX Dev Team unknown admin.amxx stopped
[ 3] 2 Admin Commands 1.10.0.539 AMXX Dev Team unknown admincmd.am running
[ 4] 3 Admin Help 1.10.0.539 AMXX Dev Team unknown adminhelp.a running
[ 5] 4 Slots Reservation 1.10.0.539 AMXX Dev Team unknown adminslots. running
[ 6] 5 Multi-Lingual System 1.10.0.539 AMXX Dev Team unknown multilingua running
[ 7] 6 Menus Front-End 1.10.0.539 AMXX Dev Team unknown menufront.a running
[ 8] 7 Commands Menu 1.10.0.539 AMXX Dev Team unknown cmdmenu.amx running
[ 9] 8 Players Menu 1.10.0.539 AMXX Dev Team unknown plmenu.amxx running
[ 10] 9 Maps Menu 1.10.0.539 AMXX Dev Team unknown mapsmenu.am running
[ 11] 10 Plugin Menu 1.10.0.539 AMXX Dev Team unknown pluginmenu. running
[ 12] 11 Admin Chat 1.10.0.539 AMXX Dev Team unknown adminchat.a running
[ 13] 12 Anti Flood 1.10.0.539 AMXX Dev Team unknown antiflood.a running
[ 14] 13 Admin Votes 1.10.0.539 AMXX Dev Team unknown adminvote.a running
[ 15] 14 NextMap 1.10.0.539 AMXX Dev Team unknown nextmap.amx running
[ 16] 15 Lite MapChooser 2.6 neygomon unknown xman2030_ma running
[ 17] 16 TimeLeft 1.10.0.539 AMXX Dev Team unknown timeleft.am running
[ 18] 17 Pause Plugins 1.10.0.539 AMXX Dev Team unknown pausecfg.am running
[ 19] 18 Stats Configuration 1.10.0.539 AMXX Dev Team unknown statscfg.am running
[ 20] 19 StatsX 1.10.0.539 AMXX Dev Team unknown statsx.amxx running
[ 21] 20 Zombie Plague 1.5 Aurora MeRcyLeZZ unknown mod_1.5.1.a running
[ 22] 21 [ZP]Level System 6.0 Dambas unknown xman2030_lv running
[ 23] 22 [ZP] Addon: Evolution 0.0.7 https://vk.com/i unknown xman2030_ev running
[ 24] 23 [ZMO] SQL DataBase Best t3rkecorejz unknown xman2030_sa running
[ 25] 24 TalRasha Precache Soun 0.0.1 xman2030 unknown xman2030_pr running
[ 26] 25 [CSO] Addon: WpnLevel 1.0.2 lite t3 unknown xman2030_we running
[ 27] 26 [ZP] Random Extra Weap 1.0 BirnoSemiSem unknown xman2030_ra running
[ 28] 27 [ZP] Addon: HERO Syste 0.1 inf unknown xman2030_he debug
[ 29] 28 [CSO LIKE] Weapon: Dua 1.0 inf / Batcoh: Co unknown xman2030_du running
[ 30] 29 [ZP]Present 1.0 CrAsH unknown xman2030_pr running
[ 31] 30 UnPrecacher BuB9neC - Proo.Noob unknown limit_off.a running
[ 32] 31 [CSO Like] ZClass: Reg 0.3 | 04.0 inf2030 unknown xman2030_sp running
[ 33] 32 [CSO Like] ZClass: Lig 0.2 | 19.1 inf unknown xman2030_zc running
[ 34] 33 [ZP] Class: x-Voodoo 2019 | 1.0 xUnicorn (t3rkec unknown xman2030_vo running
[ 35] 34 [ ZM ] ZClass: Deimos 1.0 KOBRA / t3rkecor unknown xman2030_de running
[ 36] 35 [ZMO] Class: Heavy 1.1 Jim/4e/| unknown xman2030_he running
[ 37] 36 [ZP] Class: Stamper 2020 | 1.0 xUnicorn (t3rkec unknown xman2030_zc running
[ 38] 37 unknown unknown unknown unknown xman2030_ba running
[ 39] 38 [ZP] ZClass: Voodoo 0.3 | 19.1 inf unknown xman2030_si running
[ 40] 39 [ZMO] ZClass: Spin Div 1.0 t3rkecorejz unknown xman2030_sp running
[ 41] 40 [ZP | AMXX] Sting Fing 0/0/2 m0rt3m unknown xman2030_st running
[ 42] 41 [ZP] ZClass: Energy Ba 0.1 | 21.1 inf unknown xman2030_en running
[ 43] 42 unknown unknown unknown unknown xman2030_le running
[ 44] 43 Amx Dodge 0.1.0 PomanoB/fl0wer o unknown xman2030_do running
[ 45] 44 blood color 0.1 Barney unknown xman2030_bl running
[ 46] 45 [CSO Like] Grenade: Zo 1.0 inf / Batcoh: Co unknown xman2030_gr running
[ 47] 46 [ZP Addon] Knives 0.1 ONYX unknown xman2030_kn running
[ 48] 47 Reload Radio for XMAN 1.3 INF unknown xman2030_Re running
[ 49] 48 unknown unknown unknown unknown xman2030_ar running
[ 50] 49 Bullet Damage 0.0.1 ConnorMcLeod unknown xman2030_da running
[ 51] 50 [ZP] Easy Parachute 1.1 xman2030 unknown xman2030_pa running
[ 52] 51 xman2030_cooldown CS-FADE.RU CS-FADE.RU unknown xman2030_co running
[ 53] 52 [FS] Chat 1.1 Inf unknown xman2030_ch running
[ 54] 53 [ZP] Shoot Light 0.1 | 11.0 inf unknown xman2030_sh running
[ 55] 54 ZM VIP 1.7.2 aaarnas unknown xman2030_vi running
[ 56] 55 NadeModes 11.2 Nomexous & OT unknown xman2030_na running
[ 57] 56 [ZP] Addon: Weather 0.1 | 30.0 inf / xman2030 unknown xman2030_we running
[ 58] 57 Addon: Hud Helping 0.1 | 03.0 inf unknown xman2030_hu running
[ 59] 58 Hat 1.0 pRoxxx unknown xman2030_ha running
[ 60] 59 [ZP] Extra: Squeak Gre 1.0.6-wwm Arkshine unknown xman2030_ne running
[ 61] 60 [ZP] Extra: HK416 1.0 Crock / =) (Popr unknown xman2030_hk running
[ 62] 61 [ZP] Extra: Chey-Tac M 1.0 Crock / =) (Popr unknown xman2030_m2 running
[ 63] 62 Extraitems: Oz Lion Pi 1.0 Base: Batcon & x unknown xman2030_oz running
[ 64] 63 [ZP] Extra: Anaconda 1.0 Crock / =) (Popr unknown xman2030_an running
[ 65] 64 [ZP] Extra: Anti-Infec 1.0 MeRcyLeZZ unknown xman2030_ar running
[ 66] 65 [ZP] Buy Health New 2.0 FINAL xrekuy unknown xman2030_he running
[ 67] 66 [ZP] Extra: HK23 1.0 Crock / =) (Popr unknown xman2030_hk running
[ 68] 67 [ZP] Extra: MG3 1.0 Crock / =) (Popr unknown xman2030_mg running
[ 69] 68 [ZP] Extra: Double Bar 1.0 Crock / =) (Popr unknown xman2030_we running
[ 70] 69 [ZP] Extra: M1887 1.0 Crock / =) (Popr unknown xman2030_we running
[ 71] 70 ZP Extraitem: Fire Vul 1.0 Base: Batcon; Re unknown xman2030_ga running
[ 72] 71 [ZP] Extra: Walther WA 1.0 Crock / =) (Popr unknown xman2030_wa running
[ 73] 72 [ZP] Extra: VSK94 1.0 Crock / =) (Popr unknown xman2030_vs running
[ 74] 73 [ZP] Extra: SKULL5 1.0 Crock / =) (Popr unknown xman2030_sk running
[ 75] 74 [ZP] Extra: USAS12 Cam 1.0 Crock / =) (Popr unknown xman2030_us running
[ 76] 75 [ZP] Extra: MP5 Tiger 1.0 Crock / =) (Popr unknown xman2030_mp running
[ 77] 76 [ZP] Extra: P90 Lapin 1.0 Crock / =) (Popr unknown xman2030_p9 running
[ 78] 77 [ZP] Extra: Lightning 1.0 Crock / =) (Popr unknown xman2030_gu running
[ 79] 78 [ZP] Extra: Water Gun 1.0 LARS-DAY[BR]EAKE unknown xman2030_wa running
[ 80] 79 [ZP] Extra: TAR-21 1.0 Crock / =) (Popr unknown xman2030_ta running
[ 81] 80 [ZP] Extra: XM8 Basic 1.0 Crock / =) (Popr unknown xman2030_xm running
[ 82] 81 [ZP] Weapon: Crossbow 1.0 xUnicorn (t3rkec unknown xman2030_cr running
[ 83] 82 [ZP] Extra Item: Knife 1.2 pharse unknown xman2030_kn running
[ 84] 83 [ZP] Extra: Deagle Gol 1.0 LARS-BLOODLIKER unknown xman2030_de running
[ 85] 84 [ZP] Extra Item: ak47 3.0 WeReWolF unknown xman2030_go running
[ 86] 85 [ZP] Extra Item: M4A1 3.0 4e/l unknown xman2030_go running
[ 87] 86 [CSO LIKE] LaserMG 1.1 Lakerovich unknown xman2030_we debug
[ 88] 87 Galaxy Menu 0.1 inf unknown xman2030_Ex running
[ 89] 88 unknown unknown unknown unknown xman2030_lk running
[ 90] 89 unknown unknown unknown unknown xman2030_do running
[ 91] 90 [Server Addon] Lottery 0.1 ONYX unknown xman2030_ry running
[ 92] 91 [ZP] Menu Priv 1.2 xman2030 unknown xman2030_me running
[ 93] 92 VIP menu 1.2 XZ KTO unknown xman2030_me running
[ 94] 93 [ZP] Menu Elite 1.2 xman2030 unknown xman2030_me running
[ 95] 94 [ZP] Menu Elite 1.2 xman2030 unknown xman2030_me running
[ 96] 95 [ZP] Menu Priv 1.2 xman2030 unknown xman2030_me running
[ 97] 96 [ZP] Admin Lvl Menu 1.0 Dambas unknown xman2030_le running
[ 98] 97 ammo paki 4.0 Bagamut unknown xman2030_am running
Автор плагина
Dambas
Версия плагина
6.0
Исходный код
/*
===================================================================
[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], 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

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/addons/xman_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_disconnected(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]
formatex(string,charsmax(string),"[+%d EXP]", d_exp)
}

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

client_print(id, print_center, 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[ZP] !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 }
*/
Первый раз сталкиваюсь с таким багом, через специальное меню выдал себе 1000 exp, и лвл не выдался. Было 1000/100 exp и 2 уровень хотя должен был выдасться 3 уровень. И так далее был 2 уровень и 5000 exp из 100 как исправить?
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
892
Реакции
149
Помог
25 раз(а)
Перезаходить пробовал на сервер после выдачи?
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
Rubick Castle, попробуй очистить базу данных, какую ты щас используешь?
 
Сообщения
3,582
Реакции
1,571
Помог
137 раз(а)
Rubick Castle, попробуй обнулить опыт и поставить себе 4999. Напиши, что получится.
 
Сообщения
845
Реакции
523
Помог
13 раз(а)
309 строка
Просто проверяется на количество экспы, а не циклом просчитывается разница до след.уровня. примером может быть подсчет урона в зп для реварда аммопаками
 
Сообщения
3,582
Реакции
1,571
Помог
137 раз(а)
BalbuR, скорее другое, ТС говорит что выдавал через меню, в плагине меню нету, значит оно реализовано отдельно через натив, в нативе есть вызов check_level, где идёт проверка на кол-во экспы (387 строка), а если у него больше экспы чем макс. уровень, то повышение не происходит.
 
Сообщения
845
Реакции
523
Помог
13 раз(а)
У него там в комплекте менюшка должна была быть, да , в другом плагине
Тут прикол в том, что ему один лвл, судя по коду, добавится, а после только после нанесения урона (?). Если он добавит больше экспы чем на один уровень
 
Сообщения
1,042
Реакции
206
Предупреждения
1
Помог
6 раз(а)
Уже говорилось, что от дамбаса система кривая
Из-за этого и была создана модульная система уровней
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
Rubick Castle, как вижу очистка базы данных помогла :) видать у тебя был опыт выше чем максимально установленно плагином. такое же и у меня было.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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