Участник
Пользователь
- Сообщения
- 194
- Реакции
- 43
- Помог
- 4 раз(а)
- Ошибка
-
при смене карты слетает звание в чем может быть проблема?
- ОС
- Linux
- Amx Mod X
-
Amx Mod X 1.9.0
- Билд
-
ReHLDS version: 3.6.0.675-dev Build
- ReGamedll
-
ReGameDLL version: 5.9.0.366-dev
- Версия Metamod
-
Metamod v1.21p37 2013/05/30 (5:13)
- Список метамодулей
-
[ 1] Reunion RUN - reunion.so v0.1.0.1 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 3] VoiceTranscoder RUN - vtc.so v2017RC3 ini ANY
[ 4] AMX Mod X RUN - amxmodx.so v1.9.0.5 ini ANY
[ 5] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 6] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 7] WHBlocker RUN - whblocker.so v1.5.696 ini ANY
[ 8] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl4 ANY
[9] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl4 ANY
[10] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl4 ANY
[11] ReAimDetector RUN - reaimdetector_am v0.2.2 pl4 ANY Never
[12] ReAPI RUN - reapi_amxx_i386. v5.9.0.1 pl4 ANY Never
[13] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl4 ANY
[14] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl4 ANY
[15] Engine RUN - engine_amxx_i386 v1.9.0.5 pl4 ANY
[16] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl4 ANY
16 plugins, 16 running
- Список плагинов
-
[ 1] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 2] Admin Loader 3.5 neygomon admin_loader.am running
[ 3] FreshBans 1.4.0b kanagava fresh_bans_183. running
[ 4] ScreenMaker 1.1 neygomon screen_maker.am running
[ 5] Ultimate Chats Control 5.2(c) neygomon ucc.amxx running
[ 6] UCC Addon: VoteGAG 1.2 neygomon ucc_votegag.amx running
[ 7] Admin Commands 1.9.0.5235 AMXX Dev Team admincmd.amxx running
[ 8] Slots Reservation 1.2 pUzzlik adminslots.amxx running
[ 9] Menus Front-End 1.5 neugomon menufront.amxx running
[ 10] Commands Menu 1.9.0.5235 AMXX Dev Team cmdmenu.amxx running
[ 11] Players Menu 1.7 neugomon plmenu.amxx running
[ 12] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 13] Maps Menu 1.4.2 neugomon mapsmenu.amxx running
[ 14] Admin Chat 1.9.0.5235 AMXX Dev Team adminchat.amxx running
[ 15] Player Votes 1.0 neugomon player_votes.am running
[ 16] Dust2 Online [RR] 0.1 neugomon dust2_online_rr running
[ 17] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 18] AES: StatsX 0.5+1 serfreeman1337 aes_statsx_cstr running
[ 19] Stats Configuration 1.9.0.5235 AMXX Dev Team statscfg.amxx running
[ 20] Say me and Say hp 1.4 neygomon sayme.amxx running
[ 21] Restrict Weapons 1.9.0.5235 AMXX Dev Team restmenu.amxx running
[ 22] Server Menu 0.1 maFFyoZZyk menu.amxx running
[ 23] Show Online 1.0 neugomon show_online.amx running
[ 24] Lite Rank System 1.5 AcE lrs_csstats.amx running
[ 25] resetscore(ReAPI) 1.1 Phantom resetscore.amxx running
[ 26] User Connect 0.0.4 Jumper user_connect.am running
[ 27] Lite Translit 2.8 neygomon | swede lite_translit.a running
- Автор плагина
- AcE
- Версия плагина
- 1.5
- Исходный код
-
#define AUTHOR "AcE"
#define VERSION "1.5"
#define PLUGIN "Lite Rank System"
#define LASTUPDATE "30, July (7), 2019"
#define CSSTATSX_SQL // SerFreeman1337 Скилл игрока на на худе.
#if defined CSSTATSX_SQL
native get_statsnum_sql()
native get_user_skill(player, &Float:skill)
native get_user_stats_sql(index, stats[8], bodyhits[8])
#endif
//#define CS_MYSQL_HUD_SKILL // SKAJIbnEJIb Скилл игрока на на худе.
#if defined CS_MYSQL_HUD_SKILL
native csstats_get_user_stats(id, stats[22])
native statsx_get_skill(stats[22], string[] = "", len = 0)
#endif
#include <amxmodx>
#include <csx>
#tryinclude <reapi>
#if !defined _reapi_included
#include <fakemeta>
#endif
#include <lrs_csstats>
#if !defined MAX_CLIENTS
const MAX_CLIENTS = 32
#endif
#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH = 32
#endif
#if !defined MAX_MENU_LENGTH
const MAX_MENU_LENGTH = 512
#endif
#if !defined MAX_USER_INFO_LENGTH
const MAX_USER_INFO_LENGTH = 256
#endif
#if !defined MAX_RESOURCE_PATH_LENGTH
const MAX_RESOURCE_PATH_LENGTH = 64
#endif
#if !defined MAX_SKILL_LEVEL_LENGTH
const MAX_SKILL_LEVEL_LENGTH = 64
#endif
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#define argbreak strbreak
#define client_disconnected client_disconnect
#endif
const FIRST_PERSON = 4
const PLAYER_HUD_OFFSET = 1337
#if !defined _reapi_included
#define user_health(%1) pev(%1, pev_health)
#define is_user_target(%1) pev(%1, pev_iuser2)
#define is_user_first_person(%1) (pev(%1, pev_iuser1) == FIRST_PERSON)
#else
#define user_health(%1) floatround(get_entvar(%1, var_health))
#define is_user_target(%1) get_entvar(%1, var_iuser2)
#define is_user_first_person(%1) (get_entvar(%1, var_iuser1) == FIRST_PERSON)
#endif
enum _:cvars
{
CVAR_ADD_EXP, CVAR_ADD_HS_EXP, CVAR_EXP_LEVELS,
CVAR_LEVEL_UP_MSG, CVAR_LEVEL_UP_SND, CVAR_LEVEL_UP_SND_PATH,
CVAR_HUD_EXP_TYPE, CVAR_HUD_POSITION, CVAR_HUD_SPEC_POSITION,
CVAR_HUD_COLOR, CVAR_HUD_SPEC_COLOR, CVAR_HUD_RANDOM_COLOR, CVAR_HUD_TOP_POSITION,
CVAR_HUD_UPDATE_TIME, CVAR_HUD_WEB_SITE, CVAR_HOOK_MP_PLAYERID, CVAR_GAME_DESCRIPTION
}
enum _:SKILL_DATA
{
SKILL_VALUE,
SKILL_LEVEL_NAME[MAX_SKILL_LEVEL_LENGTH]
}
new const g_Skill[][SKILL_DATA] =
{
{0, "L-"}, {60, "L"}, {75, "L+"},
{85, "M-"}, {100, "M"}, {115, "M+"},
{130, "H-"}, {140, "H"}, {150, "H+"},
{165, "P-"}, {180, "P"}, {195, "P+"}, {210, "G"}
}
enum _:eData {lvl, exp, exp_to_next_lvl}
new const teamcolor[] = {print_team_grey, print_team_red, print_team_blue}
new cvar[cvars], SyncHudMsg, Float:HudUpdate, FW_LevelUp, FW_Result,
website[MAX_USER_INFO_LENGTH], game_name[MAX_USER_INFO_LENGTH], sndpath[MAX_USER_INFO_LENGTH],
bool:g_bIsSwitch[MAX_CLIENTS +1], bool:exp_type, bool:is_mp3_sound, bool:random_color, bool:top_position,
g_arrData[MAX_CLIENTS +1][eData], Array:g_Levels, g_MaxLevel
const MAX_BYTES = 191
const g_StatusText = 106
enum _:MAX_TYPES {TYPE_NONE, TYPE_RELATION, TYPE_PLAYER}
enum {LOOK_FRIEND = 1, LOOK_ENEMY, LOOK_HOSTAGE}
enum _:MAX_REPLACES {USER_HP, USER_RANK, USER_NAME}
new const Replaces[MAX_REPLACES][] = {"%hp%", "%rank%", "%name%"}
new status_value[MAX_TYPES], bool:player_id
public plugin_precache()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("lrs_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED)
server_print(""); server_print(" %s Copyright (c) 2019 %s", PLUGIN, AUTHOR)
server_print(" Version %s build on %s", VERSION, LASTUPDATE); server_print("")
cvar[CVAR_ADD_EXP] = register_cvar("lrs_add_exp", "2")
cvar[CVAR_ADD_HS_EXP] = register_cvar("lrs_add_exp_hs", "3")
cvar[CVAR_EXP_LEVELS] = register_cvar("lrs_levels", "0 20 40 60 100 150 200 300 400 600 1000 1500 2100 2700 3400 4200 5100 5900 7000 10000 15000")
cvar[CVAR_LEVEL_UP_MSG] = register_cvar("lrs_level_up_msg", "1")
cvar[CVAR_LEVEL_UP_SND] = register_cvar("lrs_level_up_snd", "1")
cvar[CVAR_LEVEL_UP_SND_PATH] = register_cvar("lrs_level_up_snd_path", "events/task_complete.wav")
cvar[CVAR_HUD_EXP_TYPE] = register_cvar("lrs_hud_exp_type", "1")
cvar[CVAR_HUD_POSITION] = register_cvar("lrs_hud_xypos", "0.01 0.22")
cvar[CVAR_HUD_SPEC_POSITION] = register_cvar("lrs_hud_xypos_spec", "0.01 0.14")
cvar[CVAR_HUD_COLOR] = register_cvar("lrs_hud_color", "100 100 100")
cvar[CVAR_HUD_SPEC_COLOR] = register_cvar("lrs_hud_color_spec", "80 80 80")
cvar[CVAR_HUD_RANDOM_COLOR] = register_cvar("lrs_hud_random_color", "0")
cvar[CVAR_HUD_TOP_POSITION] = register_cvar("lrs_hud_top_position", "1")
cvar[CVAR_HUD_UPDATE_TIME] = register_cvar("lrs_hud_update", "1.0")
cvar[CVAR_HUD_WEB_SITE] = register_cvar("lrs_hud_web_site", "vk.com/e1337ace")
cvar[CVAR_HOOK_MP_PLAYERID] = register_cvar("lrs_mp_playerid", "1")
cvar[CVAR_GAME_DESCRIPTION] = register_cvar("lrs_game_name", "[RANK SYSTEM]")
server_cmd("exec addons/amxmodx/configs/lrs_csstats.cfg"); server_exec()
g_Levels = ArrayCreate(1)
new levelString[MAX_MENU_LENGTH], rawPoint[MAX_NAME_LENGTH]
get_pcvar_string(cvar[CVAR_EXP_LEVELS], levelString, charsmax(levelString))
#if AMXX_VERSION_NUM < 183
if (strlen(levelString))
{
new stPos, ePos
do {
ePos = strfind(levelString[stPos], " ")
formatex(rawPoint, ePos, levelString[stPos])
ArrayPushCell(g_Levels, str_to_num(rawPoint))
stPos += ePos +1
} while (ePos != -1)
}
#else
while((argbreak(levelString, rawPoint, charsmax(rawPoint), levelString, charsmax(levelString))) != -1)
{
ArrayPushCell(g_Levels, str_to_num(rawPoint))
}
#endif
g_MaxLevel = ArraySize(g_Levels)
HudUpdate = get_pcvar_float(cvar[CVAR_HUD_UPDATE_TIME])
get_pcvar_string(cvar[CVAR_HUD_WEB_SITE], website, charsmax(website))
get_pcvar_string(cvar[CVAR_GAME_DESCRIPTION], game_name, charsmax(game_name))
exp_type = get_pcvar_num(cvar[CVAR_HUD_EXP_TYPE]) == 0 ? true : false
random_color = get_pcvar_num(cvar[CVAR_HUD_RANDOM_COLOR]) > 0 ? true : false
top_position = get_pcvar_num(cvar[CVAR_HUD_TOP_POSITION]) == 1 ? true : false
player_id = get_pcvar_num(cvar[CVAR_HOOK_MP_PLAYERID]) == 1 ? true : false
if (get_pcvar_num(cvar[CVAR_LEVEL_UP_SND]) > 0)
{
if (equali(sndpath[strlen(sndpath) -4], ".mp3"))
{
is_mp3_sound = true
precache_generic(sndpath)
}
else
{
is_mp3_sound = false
precache_sound(sndpath)
}
}
}
public plugin_init()
{
register_dictionary("lrs_csstats.txt")
register_clcmd("say /lrshud", "InformerSwitch")
register_clcmd("say_team /lrshud", "InformerSwitch")
SyncHudMsg = CreateHudSyncObj()
register_event("StatusValue", "StatusValueShow", "be")
FW_LevelUp = CreateMultiForward("lrs_player_level_up_event", ET_CONTINUE, FP_CELL)
#if defined _reapi_included
set_member_game(m_GameDesc, game_name)
#else
register_forward(FM_GetGameDescription, "GetGameDescription")
#endif
}
#if !defined _reapi_included
public GetGameDescription()
{
forward_return(FMV_STRING, game_name)
return FMRES_SUPERCEDE
}
#endif
#if AMXX_VERSION_NUM < 183
public plugin_end()
TrieDestroy(g_lvl_name)
#endif
public client_putinserver(id)
{
g_bIsSwitch[id] = true
arrayset(g_arrData[id], 0, eData)
set_task(0.3, "LoadUserStats", id)
set_task(HudUpdate, "Show_Hud_Informer", PLAYER_HUD_OFFSET + id, .flags = "b")
}
public client_disconnected(id)
{
g_bIsSwitch[id] = false
arrayset(g_arrData[id], 0, eData)
remove_task(PLAYER_HUD_OFFSET + id)
}
public LoadUserStats(id)
{
if (is_user_connected(id))
{
new st[CSX_MAX_STATS], bh[CSX_MAX_BODYHITS]
#if !defined CSSTATSX_SQL
get_user_stats(id, st, bh)
#else
get_user_stats_sql(id, st, bh)
#endif
g_arrData[id][exp] = get_exp_for_stats(st)
g_arrData[id][lvl] = get_lvl_for_exp(g_arrData[id][exp])
g_arrData[id][exp_to_next_lvl] = get_exp_to_next_lvl(g_arrData[id][lvl])
}
}
public client_death(killer, victim, wpn, hit, tk)
{
if (!is_user_connected(killer) && victim != killer) return
if (g_arrData[killer][exp_to_next_lvl] != -1)
{
g_arrData[killer][exp] += (hit != HIT_HEAD) ? get_pcvar_num(cvar[CVAR_ADD_EXP]) : get_pcvar_num(cvar[CVAR_ADD_HS_EXP])
if (g_arrData[killer][exp] >= g_arrData[killer][exp_to_next_lvl])
{
g_arrData[killer][lvl] = get_lvl_for_exp(g_arrData[killer][exp])
g_arrData[killer][exp_to_next_lvl] = get_exp_to_next_lvl(g_arrData[killer][lvl])
ExecuteForward(FW_LevelUp, FW_Result, killer)
switch(get_pcvar_num(cvar[CVAR_LEVEL_UP_MSG]))
{
case 0: return
case 1:
{
new teams = get_user_team(killer)
if (!(0 <= teams < sizeof teamcolor))
teams = 0
else
{
new szName[MAX_NAME_LENGTH]; get_user_name(killer, szName, charsmax(szName))
client_print_color(0, teamcolor[teams], "%L", LANG_SERVER, "NEW_LVL_ALL", szName, get_lvl_name(g_arrData[killer][lvl]), LANG_SERVER)
}
}
case 2: client_print_color(killer, print_team_default, "%L", LANG_SERVER, "NEW_LVL_ID", get_lvl_name(g_arrData[killer][lvl]), LANG_SERVER)
}
switch(get_pcvar_num(cvar[CVAR_LEVEL_UP_SND]))
{
case 0: return
case 1:
{
switch(is_mp3_sound)
{
case true: client_cmd(0, "mp3 play ^"sound/%s^"", sndpath)
case false: client_cmd(0, "spk ^"%s^"", sndpath)
}
}
case 2:
{
switch(is_mp3_sound)
{
case true: client_cmd(killer, "mp3 play ^"sound/%s^"", sndpath)
case false: client_cmd(killer, "spk ^"%s^"", sndpath)
}
}
}
}
}
}
public Show_Hud_Informer(taskId)
{
new id = taskId - PLAYER_HUD_OFFSET
new target = id
new alive = is_user_alive(id)
new buffer[MAX_USER_INFO_LENGTH], len
trim(buffer)
if (!is_user_connected(id) && is_user_bot(id))
{
remove_task(taskId)
return
}
if (!alive)
{
target = is_user_target(id)
if (!target) return
if (!is_user_first_person(id)) return
}
if (g_bIsSwitch[id])
{
ClearSyncHud(id, SyncHudMsg)
if (target != id)
{
new szName[MAX_NAME_LENGTH]
get_user_name(target, szName, charsmax(szName))
len += format(buffer[len], charsmax(buffer), "%L %s^n", LANG_SERVER, "USER_NAME", szName)
}
len += format(buffer[len], charsmax(buffer), "%L %s^n", LANG_SERVER, "LVL_NAME", get_lvl_name(g_arrData[target][lvl]), LANG_SERVER)
if (g_arrData[target][exp_to_next_lvl] != -1)
{
switch(exp_type)
{
case true: len += format(buffer[len], charsmax(buffer) - len, "%L [%d/%d]^n", LANG_SERVER, "EXPERIENCE", g_arrData[target][exp], g_arrData[target][exp_to_next_lvl])
case false: len += format(buffer[len], charsmax(buffer) - len, "%L [%d/%d][+%d]^n", LANG_SERVER, "EXPERIENCE", g_arrData[target][exp], g_arrData[target][exp_to_next_lvl], (g_arrData[target][exp_to_next_lvl] - g_arrData[target][exp]))
}
}
else len += format(buffer[len], charsmax(buffer) - len, "%L %L^n", LANG_SERVER, "EXPERIENCE", LANG_SERVER, "EXPERIENCE_MAX")
#if defined CSSTATSX_SQL
new Float:skill; get_user_skill(target, skill)
len += format(buffer[len], charsmax(buffer) - len, "%L [%s|%.0f]^n", LANG_SERVER, "SKILL", g_Skill[get_skill_f(skill)][SKILL_LEVEL_NAME], skill)
#endif
#if defined CS_MYSQL_HUD_SKILL
new stats[22]
if (csstats_get_user_stats(target, stats))
{
new szSkill[3], iSkill = statsx_get_skill(stats, szSkill, charsmax(szSkill))
len += format(buffer[len], charsmax(buffer) - len, "%L [%s|%d]^n", LANG_SERVER, "SKILL", szSkill, iSkill)
}
#endif
if (top_position)
{
new st[CSX_MAX_STATS], bh[CSX_MAX_BODYHITS]
#if !defined CSSTATSX_SQL
new stnum = get_statsnum()
new plRank = get_user_stats(target, st, bh)
#else
new stnum = get_statsnum_sql()
new plRank = get_user_stats_sql(id, st, bh)
#endif
len += format(buffer[len], charsmax(buffer) - len, "%L %d %L %d^n", LANG_SERVER, "POSITION", plRank, LANG_SERVER, "OF", stnum)
}
len += format(buffer[len], charsmax(buffer) - len, "%s^n", website)
static r, g, b, Float:x, Float:y, r_d, g_d, b_d, Float:x_d, Float:y_d
HudMsgPos(cvar[CVAR_HUD_POSITION], x, y); HudMsgPos(cvar[CVAR_HUD_SPEC_POSITION], x_d, y_d)
HudMsgColor(cvar[CVAR_HUD_COLOR], r, g, b); HudMsgColor(cvar[CVAR_HUD_SPEC_COLOR], r_d, g_d, b_d)
switch(random_color)
{
case false:
{
if (alive) set_hudmessage(r, g, b, x, y, 0, 0.0, HudUpdate, _, _, -1)
else set_hudmessage(r_d, g_d, b_d, x_d, y_d, 0, 0.0, HudUpdate, _, _, -1)
}
case true:
{
if (alive) set_hudmessage(random(255), random(255), random(255), x, y, 0, 0.0, HudUpdate, _, _, -1)
else set_hudmessage(random(255), random(255), random(255), x_d, y_d, 0, 0.0, HudUpdate, _, _, -1)
}
}
ShowSyncHudMsg(id, SyncHudMsg, "%s", buffer)
}
}
public InformerSwitch(id)
{
g_bIsSwitch[id] = !g_bIsSwitch[id]
switch(g_bIsSwitch[id])
{
case false:
{
remove_task(PLAYER_HUD_OFFSET + id)
client_cmd(id, "spk fvox/deactivated")
client_print_color(id, print_team_default, "%L", LANG_SERVER, "HUD_OFF")
}
case true:
{
client_cmd(id, "spk fvox/activated")
client_print_color(id, print_team_default, "%L", LANG_SERVER, "HUD_ON")
set_task(HudUpdate, "Show_Hud_Informer", PLAYER_HUD_OFFSET + id, .flags = "b")
}
}
}
public StatusValueShow(id)
{
if (!player_id)
return
new num = read_data(1)
if (num <= 0 || num >= MAX_TYPES)
return
new update = status_value[num] = read_data(2)
switch(num)
{
case TYPE_RELATION:
{
if (!update && is_user_alive(id))
{
message_begin(MSG_ONE_UNRELIABLE, g_StatusText, _, id)
write_byte(0); write_string(""); message_end()
}
}
case TYPE_PLAYER:
{
if (is_user_alive(id))
{
new message[MAX_BYTES]
switch(status_value[TYPE_RELATION])
{
case LOOK_FRIEND: copy(message, charsmax(message), "Друг: %name% ХП: %hp%% Ранг: %rank%")
case LOOK_ENEMY: copy(message, charsmax(message), "Враг: %name% Ранг: %rank%")
case LOOK_HOSTAGE: return
}
EditMessage(message, update, true, user_health(update))
message_begin(MSG_ONE_UNRELIABLE, g_StatusText, _, id)
write_byte(0); write_string(message); message_end()
}
}
}
}
EditMessage(message[MAX_BYTES], player, bool:status_text, hp)
{
new temp[MAX_RESOURCE_PATH_LENGTH]
if (is_user_alive(player))
{
for (new i; i < MAX_REPLACES; i ++)
{
switch(i)
{
case USER_HP: num_to_str(hp, temp, charsmax(temp))
case USER_RANK: format(temp, charsmax(temp), "%s", get_lvl_name(g_arrData[player][lvl]))
case USER_NAME:
{
if (status_text) copy(temp, charsmax(temp), "%p2")
else get_user_name(player, temp, charsmax(temp))
}
default: copy(temp, charsmax(temp), "")
}
replace(message, charsmax(message), Replaces[i], temp)
}
}
trim(message)
}
HudMsgPos(cvar, &Float:x, &Float:y)
{
static coords[16], piece[10]
get_pcvar_string(cvar, coords, charsmax(coords))
argbreak(coords, piece, charsmax(piece), coords, charsmax(coords))
x = str_to_float(piece), y = str_to_float(coords)
}
HudMsgColor(cvar, &r, &g, &b)
{
static color[16], piece[5]
get_pcvar_string(cvar, color, charsmax(color))
argbreak(color, piece, charsmax(piece), color, charsmax(color))
r = str_to_num(piece)
argbreak(color, piece, charsmax(piece), color, charsmax(color))
g = str_to_num(piece), b = str_to_num(color)
}
stock get_skill_f(Float:skill)
{
new skill_index
for (new i; i < sizeof g_Skill; i ++)
{
if (floatround(skill) >= g_Skill[i][SKILL_VALUE])
skill_index = i
}
return skill_index
}
stock get_exp_for_stats(st[CSX_MAX_STATS])
{
st[CSX_FRAGS] = st[CSX_FRAGS] - st[CSX_HS]
new user_exp = st[CSX_FRAGS] * get_pcvar_num(cvar[CVAR_ADD_EXP]) + st[CSX_HS] * get_pcvar_num(cvar[CVAR_ADD_HS_EXP])
return user_exp
}
stock get_exp_for_lvl(lvlnum)
{
if (!(0 <= lvlnum < g_MaxLevel)) return -1
return ArrayGetCell(g_Levels, lvlnum)
}
stock get_lvl_for_exp(expnum)
{
for (new i; i < g_MaxLevel; ++ i)
{
if (expnum < ArrayGetCell(g_Levels, i))
return clamp(i -1, 0, g_MaxLevel -1)
}
return g_MaxLevel -1
}
stock get_exp_to_next_lvl(lvlnum)
{
lvlnum ++
if (lvlnum >= g_MaxLevel) return -1
lvlnum = clamp(lvlnum, 0, g_MaxLevel -1)
return ArrayGetCell(g_Levels, lvlnum)
}
stock get_lvl_name(level)
{
new LangKey[10], idLang,
levelName[MAX_RANK_LEVEL_LENGTH]
if (level > g_MaxLevel) level = g_MaxLevel -1
formatex(LangKey, charsmax(LangKey), "LVL_%d", level +1)
formatex(levelName, charsmax(levelName), "%L", idLang, LangKey)
return levelName
}
public plugin_natives()
{
register_library("lrs_csstats")
register_native("lrs_get_max_lvl", "_lrs_get_max_lvl")
register_native("lrs_get_user_exp", "_lrs_get_user_exp")
register_native("lrs_get_user_lvl", "_lrs_get_user_lvl")
register_native("lrs_get_lvl_name", "_lrs_get_lvl_name")
register_native("lrs_get_exp_for_stats", "_lrs_get_exp_for_stats")
register_native("lrs_get_lvl_for_stats", "_lrs_get_lvl_for_stats")
register_native("lrs_get_exp_for_lvl", "_lrs_get_exp_for_lvl")
register_native("lrs_get_lvl_for_exp", "_lrs_get_lvl_for_exp")
register_native("lrs_get_exp_to_next_lvl", "_lrs_get_exp_to_next_lvl")
}
public _lrs_get_max_lvl(plugin, params)
return g_MaxLevel
public _lrs_get_user_exp(plugin, params)
{
new id = get_param(1)
if (!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id)
return 0
}
return g_arrData[id][exp]
}
public _lrs_get_user_lvl(plugin, params)
{
new id = get_param(1)
if (!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id)
return 0
}
return g_arrData[id][lvl]
}
public _lrs_get_exp_for_stats(plugin, params)
{
if (params != 1)
{
log_error(AMX_ERR_NATIVE, "bad arguments num, expected 1, passed %d", params)
return 0
}
new st[CSX_MAX_STATS]
get_array(1, st, sizeof st)
return get_exp_for_stats(st)
}
public _lrs_get_lvl_for_stats(plugin, params)
{
if (params != 1)
{
log_error(AMX_ERR_NATIVE, "bad arguments num, expected 1, passed %d", params)
return 0
}
new st[CSX_MAX_STATS]
get_array(1, st, sizeof st)
return get_lvl_for_exp(get_exp_for_stats(st))
}
public _lrs_get_exp_for_lvl(plugin, params)
{
if (params < 1)
{
log_error(AMX_ERR_NATIVE, "bad arguments num, expected 1, passed %d", params)
return 0
}
return get_exp_for_lvl(get_param(1))
}
public _lrs_get_lvl_for_exp(plugin, params)
{
if (params < 1)
{
log_error(AMX_ERR_NATIVE, "bad arguments num, expected 1, passed %d", params)
return 0
}
return get_lvl_for_exp(get_param(1))
}
public _lrs_get_exp_to_next_lvl(plugin, params)
return get_exp_to_next_lvl(get_param(1))
public _lrs_get_lvl_name(plugin, params)
set_string(2, get_lvl_name(get_param(1)), get_param(3))
Добрый вечер , может найдется человек который разбирается в плагинах и поможет исправить данную проблему в плагине ,))
В этой теме было размещено решение! Перейти к решению.
Вложения
-
18.8 KB Просмотры: 314