- Ошибка
-
Скилл не прибавляется
- ОС
- Linux
- Билд
-
Protocol version 48
Exe version 1.6.3.7/Stdio (cstrike)
ReHLDS version: 3.3.0.590-dev
Build date: 20:57:36 Aug 4 2017 (1210)
Build from: https://github.com/dreamstalker/rehlds/commit/5bd5
- ReGamedll
-
ReGameDLL version: 5.3.0.217-dev
Build date: 18:18:45 Jul 17 2017
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/0f1f4c0
ReGameDLL version: 5.3.0.217-dev
Build date: 18:18:45 Jul 17 2017
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/0f1f4c0
- Список метамодулей
-
description stat pend file vers src load unlod
[ 1] SafeNameAndChat RUN - SafeNameAndChat. v1.0 ini ANY ANY
[ 2] VoiceTranscoder RUN - VoiceTranscoder. v2017RC3 ini ANY ANY
[ 3] ReSRDetector RUN - resrdetector_mm_ v0.1.0 ini Chlvl ANY
[ 4] Reunion RUN - reunion_mm_i386. v0.1.75 ini Start Never
[ 5] ReSemiclip RUN - resemiclip_mm_i3 v2.2(a) ini Chlvl ANY
[ 6] Rechecker RUN - rechecker_mm_i38 v2.3 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i38 v1.5.672 ini Chlvl ANY
[ 8] AMX Mod X RUN - amxmodx_mm_i386. v1.8.2 ini Start ANY
[ 9] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[10] ReAPI RUN - reapi_amxx_i386. v5.1.0.1 pl8 ANY Never
[11] Fun RUN - fun_amxx_i386.so v1.8.2 pl8 ANY ANY
[12] CStrike RUN - cstrike_amxx_i38 v1.8.2 pl8 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.8.2 pl8 ANY ANY
[14] ReAimDetector RUN - reaimdetector_am v0.2.1 pl8 ANY Never
[15] FakeMeta RUN - fakemeta_amxx_i3 v1.8.2 pl8 ANY ANY
[16] MySQL RUN - mysql_amxx_i386. v1.8.2 pl8 ANY ANY
[17] Ham Sandwich RUN - hamsandwich_amxx v1.8.2 pl8 ANY ANY
[18] Engine RUN - engine_amxx_i386 v1.8.2 pl8 ANY ANY
18 plugins, 18 running
- Список плагинов
-
[ 1] FreshBan 1.0.5b kanagava fresh_bans.amxx running
[ 2] AMXBans: Core Gm 1.6 Larte Team amxbans_core.am running
[ 3] AMXBans: Flagged Gm 1.6 Larte Team amxbans_flagged running
[ 4] AMXBans: Freeze Gm 1.6 Larte Team amxbans_freeze. running
[ 5] AMXBans: Main Gm 1.6 Larte Team amxbans_main.am debug
[ 6] AMXBans: Screens Gm 1.6 Larte Team amxbans_ssban.a running
[ 7] Admin Base 1.8.2 AMXX Dev Team admin.amxx stopped
[ 8] Admin Commands 1.8.2 AMXX Dev Team admincmd.amxx running
[ 9] Menus Front-End 1.8.2 AMXX Dev Team menufront.amxx running
[ 10] Commands Menu 1.8.2 AMXX Dev Team cmdmenu.amxx running
[ 11] Teleport Menu 1.8.2 AMXX Dev Team telemenu.amxx running
[ 12] Maps Menu 1.8.2 AMXX Dev Team mapsmenu.amxx running
[ 13] Plugin Menu 1.8.2 AMXX Dev Team pluginmenu.amxx running
[ 14] Admin Votes 1.8.2 AMXX Dev Team adminvote.amxx running
[ 15] NextMap 1.8.2 AMXX Dev Team nextmap.amxx running
[ 16] TimeLeft 1.8.2 AMXX Dev Team timeleft.amxx running
[ 17] Pause Plugins 1.8.2 AMXX Dev Team pausecfg.amxx running
[ 18] Stats Configuration 1.8.2 AMXX Dev Team statscfg.amxx running
[ 19] StatsX 1.8.2 AMXX Dev Team statsx.amxx running
[ 20] ReAimDetector API 0.2.1 ReHLDS Team reaimdetector.a running
[ 21] Map Manager 0.5.7 RND Mistrick | neygo mapmanager.amxx running
[ 22] Nextmap Chooser 1.8.2 AMXX Dev Team mapchooser.amxx running
[ 23] Admin Check 1.51 OneEyed admin_check.amx running
[ 24] Admin ESP 1.5b_mini KoST admin_esp_mini. running
[ 25] Demo Recorder RBS 15.07.15 SKAJIbnEJIb demorecorder_rb running
[ 26] Players Menu 1.3.2 neugomon players_menu.am running
[ 27] Advanced Gag 1.4.3[VTC neygomon amx_gag.amxx running
[ 28] Multi-Lingual System 1.8.2 AMXX Dev Team multilingual.am running
[ 29] Reset Score 1.0 SKAJIbnEJIb resetscore_rbs. running
[ 30] C4 Timer on roundtime 0.3.3a neygomon c4timer.amxx running
[ 31] Micro Army Rank System 1.29Hz_p1 Ge3eR MARS_1.29Hz.amx running
[ 32] V.I.P Custom AK-47 1.0.0 Vaqtincha custom_ak47.amx running
[ 33] V.I.P Custom M4A1 1.0.0 Vaqtincha custom_m4a1.amx running
[ 34] V.I.P Custom AWP 1.0.0 Vaqtincha custom_awp.amxx running
[ 35] V.I.P Custom DEAGLE 1.0.0 Vaqtincha custom_deagle.a running
[ 36] V.I.P Custom Weapons 1.0.0 Vaqtincha vip_custom.amxx running
[ 37] Silly C4 1.1 Cheap_Suit sillyc4.amxx running
[ 38] Parachute 1.0 maeStro parachute.amxx running
[ 39] Real Nade Drops 0.4 VEN realnadedrops.a running
[ 40] Advert Messages 1.2 neygomon adverts.amxx running
[ 41] Weapon Icon 1.2 hoboman313/Zenix weapon_icon.amx running
[ 42] Admin Prefixes 3.0 m0skVi4a ;] AdminPrefixes.a running
[ 43] unknown unknown unknown MuteMenu.amxx running
[ 44] Back Weapons RBS 15.02.19 hoboman313/cheap backweapons_rbs running
[ 45] Descriptive 'Fire in t 0.2 RUS VEN / halegator descriptive_fir running
[ 46] Blue Fade 0.1 Stimul killerscreenfad running
[ 47] Damager 2.0 Prayer damager.amxx running
[ 48] Restrict Weapons 1.8.1.3746 AMXX Dev Team restmenu.amxx running
[ 49] RockTheVote 1.8 DA rockthevote_cus running
[ 50] AntiFlash 1.0 CrAsH AntiFlash.amxx running
[ 51] Advanced Experience Sy 0.4.1 serfreeman1337 aes_main.amxx running
[ 52] AES: Exp CSTRIKE 0.3 serfreeman1337 aes_exp_cstrike running
[ 53] unknown unknown unknown aes_informer.am bad load
[ 54] AES: Experience Editor 0.1 serfreeman1337 aes_exp_editor. running
( 53) Load fails: Plugin uses an unknown function (name "aes_get_skill") - check your modules.ini.
54 plugins, 52 running
- Исходный код
-
/**
* Micro Army Rank System by Ge3eR
* 13.11.2017
* v1.29Hz
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <csx> // По умолчанию включает и <csstats>. не трогать.
#if AMXX_VERSION_NUM < 183
#include <colorchat> // colorchat.inc от aghl.ru
#define MAX_NAME_LENGTH 32
#endif
/* Раскомментируйте, для частичной поддержки AES нативов и форвардов */
//#define AES_PLUGINS_COMPATIBLE
/* Раскомментируйте, если хотите дополнить HUD инфой о скилле */
#define WITH_SKILLS
/* -- READ_STATS
* Откуда будем считывать статистику?
* 0 - CSX or CSX Extended (Module)
* 1 - CSSTATS MYSQL by SKAJIbnEJIb // автором не тестировалось, но говорят норм )
* 2 - CSSTATSX SQL by serfreeman1337 + CSX_DUMMY Module// учтите, что CSSTATSX SQL должен быть в режиме csstats_sql_forwards 1
*/
#define READ_STATS 0
// Настройки отображения HUD информера
#define HUD_LIVE_COLOR_R 0
#define HUD_LIVE_COLOR_G 128
#define HUD_LIVE_COLOR_B 0
#define HUD_LIVE_AXIS_X 0.01
#define HUD_LIVE_AXIS_Y 0.22
#define HUD_SPEC_COLOR_R 28
#define HUD_SPEC_COLOR_G 90
#define HUD_SPEC_COLOR_B 28
#define HUD_SPEC_AXIS_X 0.01
#define HUD_SPEC_AXIS_Y 0.15
// Промежуток между сообщениями информера
#define HUD_REPEAT_TIME 1.5
/* -- LEVELUP_CONGRATULATION
* Оповещение о повышении уровня
* 0 - отключено
* 1 - включено (оповещает в чат, HUD и звуком)
*/
#define LEVELUP_CONGRATULATION 1
#if LEVELUP_CONGRATULATION == 1
// Настройки отображения HUD сообщения о повышении уровня
#define HUD_LEVELUP_COLOR_R 0
#define HUD_LEVELUP_COLOR_G 128
#define HUD_LEVELUP_COLOR_B 0
#define HUD_LEVELUP_AXIS_X -1.0
#define HUD_LEVELUP_AXIS_Y 0.15
#endif
#define ONSTART_WAIT_TIME /* CS */ 1.6 // задержка перед чтением статистики. (увеличить при плохом соединении с БД)
// автограф
#define PLAGIN "Micro Army Rank System"
#define VERSIA "1.29Hz_p1" // patched
#define AUTHOR "Ge3eR"
// остальное, системное
#if READ_STATS == 1
#include <csstats_mysql>
; // again ...
#endif
#if READ_STATS == 2
#include <csstatsx_sql> // и кто же это у нас пишет либы без semicolon?
; // hot fix by wopox1337
#endif
#if defined AES_PLUGINS_COMPATIBLE
new level_up_forward, dummy;
new client_bonus[33];
#endif
#pragma semicolon 1
#define STATS_KILLS 0
#define STATS_DEATHS 1
/*
#define STATS_HEADSHOTS 2
#define STATS_DAMAGE 6
*/
/* -- EXP_MODE .. будет в следующем релизе )
* Режим чтения опыта
* 0 - считать за опыт фраги (kills)
* 1 - считать за опыт хедшоты (headshots)
* 2 - считать за опыт общий урон (damage)
#define EXP_MODE 0
*/
#define MAX_RANGS sizeof mars_exp
#define IsEntPlayer(%1) (1<=%1<=g_maxplayers)
/* input: level
* output: next exp border
*///level_reqexp
#define level_reqexp(%1) mars_exp[min( (%1 + 1), min(array_size-1, MAX_RANGS-1) )] // 1.29 bug fix
#define LEVEL_NAME_LENGHT 64 // если ранг длинный и обрезается, изменить.
#define MARS_ST_EXP 0
#define MARS_ST_LEVEL 1
#define MARS_ST_NEXTEXP 2
#define MARS_ST_END_DIGIT 3
// ну вы поняли
new const prefix[] = "MARS";
#if defined WITH_SKILLS
new const skill_letters[][] =
{
"M-", "M", "M+", "H-",
"H", "H+", "P-", "P", "P+", "G"
};
#endif
// Глобальные
new g_maxplayers;
new Array:rang_list;
new informer_sync_obj;
new array_size;
// оптимизируем запросы к стате засчитывая в оффлайн режиме)
new client_kills[33];
new client_kills_req[33];
new client_level[33];
#if defined WITH_SKILLS
#if READ_STATS == 0 || READ_STATS == 1
new client_deaths[33];
#endif
new Float:client_skill[33] = { 100.0, ... };
#endif
// Так быстрее вычислять ранг игрока. изменить по желанию.
new mars_exp[] = { // при добавлении последней записи, следите чтобы после неё небыло запятой
00000, 00050, 00100, 00200, 00400,
00700, 01000, 02000, 03000, 04000,
05000, 06000, 07000, 08000, 09000,
10000, 11000, 12000, 13000, 14000,
15000, 16000, 17000, 18000, 19000,
20000, 25000, 30000, 40000, 50000
}; // and so on, to infinity...
public plugin_init()
{
register_plugin(PLAGIN, VERSIA, AUTHOR);
rang_list = ArrayCreate(LEVEL_NAME_LENGHT);
informer_sync_obj = CreateHudSyncObj();
g_maxplayers = get_maxplayers();
register_srvcmd("mars_reload_list", "_mars_reload_list"); // Hot reload rank list
register_srvcmd("mars_reload_stats", "_mars_reload_stats"); // Hard reloading stats, for connected players
register_cvar("mars", VERSIA, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED);
#if defined AES_PLUGINS_COMPATIBLE
level_up_forward = CreateMultiForward("aes_player_levelup",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL);
if(get_cvar_pointer("aes_track_mode") == 0) register_cvar("aes_track_mode","0"); // "-1" ?
#endif
register_dictionary("mars.txt");
set_task(HUD_REPEAT_TIME, "informer", .flags="b");
}
public plugin_cfg()
{
server_print("[%s] Loaded %d Ranks", prefix, ( array_size = load_rangs() ) );
}
public _mars_reload_list()
{
ArrayClear(rang_list);
server_print("[%s] ReLoaded with %d Ranks", prefix, ( array_size = load_rangs() ) );
// пересчёт уровня. это понадобится, если новых уровней меньше чем было раньше // 1.28 bug fix
for(new id = 1; id <= g_maxplayers; id++)
if(is_user_connected(id))
client_level[id] = get_level_index(client_kills[id]);
}
load_rangs()
{
new file;
new lang[3];
new path[256], cfg_path[128];
get_configsdir(cfg_path,charsmax(cfg_path));
get_cvar_string("amx_language", lang, charsmax(lang));
format(path, charsmax(path), "%s/mars_lists/mars_list_%s.ini", cfg_path, lang);
if( !(file = fopen(path, "rt")))
{
format(path, charsmax(path), "%s/mars_list.ini", cfg_path);
file = fopen(path, "rt");
}
if(file)
{
new message[LEVEL_NAME_LENGHT];
while(!feof(file))
{
fgets(file, message, charsmax(message));
trim(message);
if(strlen(message) && message[0] != ';')
ArrayPushString(rang_list, message);
}
fclose(file);
new size = ArraySize(rang_list);
if(!size)
{
server_print("[%s] file^"%s^" is empty! Loaded 1 fake rank.", prefix, path);
ArrayPushString(rang_list, "Марсианин");
return 1;
}
return size;
}
server_print("[%s] File ^"%s^" not found! Loaded 1 fake rank.", prefix, path);
ArrayPushString(rang_list, "Марсианин");
return 1;
}
public informer()
{
static watching;
static stats[MARS_ST_END_DIGIT];
static level_name[LEVEL_NAME_LENGHT];
static output[96+ LEVEL_NAME_LENGHT];
static id;
#if defined WITH_SKILLS
static Float:skill;
#endif
for(id = 1; id <= g_maxplayers; id++)
{
if(!is_user_connected(id) || is_user_bot(id)) continue;
//entity_get_int(id, EV_INT_iuser2); // maybe engine?
watching = pev(id, pev_iuser2);
if(is_user_alive(watching) && !is_user_alive(id))
{
get_player_stats(watching, stats);
#if defined WITH_SKILLS
skill = _get_skill(watching);
#endif
}
else
{
get_player_stats(id, stats);
#if defined WITH_SKILLS
skill = _get_skill(id);
#endif
}
ArrayGetString(rang_list, stats[MARS_ST_LEVEL], level_name, charsmax(level_name));
#if defined WITH_SKILLS
format(output, charsmax(output), "%L^n%L^n%L"
, LANG_SERVER, "MARS_HUD_RANK"
, level_name
, LANG_SERVER, "MARS_HUD_EXP"
, stats[MARS_ST_EXP], max(stats[MARS_ST_EXP], stats[MARS_ST_NEXTEXP]) //Предела нет!
, LANG_SERVER, "MARS_HUD_SKILL"
, skill_letters[skill_id(
skill
)], skill
);
#else
format(output, charsmax(output), "%L^n%L"
, LANG_SERVER, "MARS_HUD_RANK"
, level_name
, LANG_SERVER, "MARS_HUD_EXP"
, stats[MARS_ST_EXP], max(stats[MARS_ST_EXP], stats[MARS_ST_NEXTEXP]) //Предела нет!
);
#endif
ClearSyncHud(id,informer_sync_obj);
if(is_user_alive(id))
{
set_hudmessage(HUD_LIVE_COLOR_R, HUD_LIVE_COLOR_G, HUD_LIVE_COLOR_B, HUD_LIVE_AXIS_X, HUD_LIVE_AXIS_Y, 0
, .holdtime = HUD_REPEAT_TIME, .channel = 3
, .fxtime=0.0, .fadeintime=0.1, .fadeouttime=0.1
);
}
else
{
set_hudmessage(HUD_SPEC_COLOR_R, HUD_SPEC_COLOR_G, HUD_SPEC_COLOR_B, HUD_SPEC_AXIS_X, HUD_SPEC_AXIS_Y, 0
, .holdtime = HUD_REPEAT_TIME, .channel = 3
, .fxtime=0.0, .fadeintime=0.1, .fadeouttime=0.1
);
}
ShowSyncHudMsg(id, informer_sync_obj, output);
}
}
get_player_stats(id, stats[])
{
stats[MARS_ST_EXP] = client_kills[id];
stats[MARS_ST_LEVEL] = client_level[id];
stats[MARS_ST_NEXTEXP] = level_reqexp(client_level[id]);
}
get_level_index(exp)
{
new index = 0;
for(new i = 0; i < array_size && i < MAX_RANGS; i++) // it works!
{
if(mars_exp[i] <= exp)
index = i;
}
return index;
}
stock Float:_get_skill(id)
{
#if READ_STATS == 2
return client_skill[id];
#else
return effec(client_kills[id], client_deaths[id]);
#endif
}
stock Float:effec(kills, deaths) return (100.0 * float(kills) / float(kills + deaths));
stock skill_id(Float:skill)
{
#if READ_STATS == 2
switch(floatround(skill))
{
case 0..59: return 0; case 60..74: return 1; case 75..84: return 2; // L
case 85..99: return 3; case 100..114: return 4; case 115..129: return 5; // M
case 130..139: return 6; case 140..149: return 7; case 150..164: return 8; // H
case 165..179: return 9; case 180..194: return 10; case 195..209: return 11;// P
case 210..999: return 12; // G
}
#else // будет нормально отображать букву для простых смертных с READ_STATS 0
switch(floatround(skill))
{
case 0..14: return 0; case 15..29: return 1; case 30..44: return 2; // L
case 45..51: return 3; case 52..63: return 4; case 64..69: return 5; // M
case 70..74: return 6; case 75..79: return 7; case 80..85: return 8; // H
case 86..89: return 9; case 90..94: return 10; case 95..97: return 11;// P
case 98..100: return 12; // G
}
#endif
return 0;
}
public client_death(killer,victim)
{
if(!(IsEntPlayer(killer)) || !(IsEntPlayer(victim))
|| killer == victim
) return;
// зачтём
client_kills[killer]++;
#if defined WITH_SKILLS // немного больше вычислений...
#if READ_STATS == 0 || READ_STATS == 1
client_deaths[victim]++;
#endif
#if READ_STATS == 2 // The ELO Method
static Float:delta; delta = 1.0 / (1.0 + floatpower(10.0,(client_skill[killer] - client_skill[victim]) / 100.0));
static Float:koeff; koeff = 0.0;
if(client_kills[killer] < 100) koeff = 2.0; else koeff = 1.5;
client_skill[killer] += (koeff * delta);
client_skill[victim] -= (koeff * delta);
// log_amx("[MARS %d] %f (Client k)", killer, client_skill[killer]);
// log_amx("[MARS %d] %f (Client v)", victim, client_skill[victim]);
#endif
#endif
if(--client_kills_req[killer]) return; // пропускаем, пока игрок не достигнет нового уровня
// учтём
if(client_level[killer]< MAX_RANGS && client_level[killer]< array_size) client_level[killer]++;
client_kills_req[killer] = level_reqexp(client_level[killer])-client_kills[killer]; // 1.27 bug fixed
#if defined AES_PLUGINS_COMPATIBLE
// set event levelup
ExecuteForward(level_up_forward, dummy, killer, client_level[killer], client_level[killer] - 1);
#endif
// покажем
#if LEVELUP_CONGRATULATION == 1
static local_client_name[MAX_NAME_LENGTH];
static local_level_name[LEVEL_NAME_LENGHT];
get_user_name(killer, local_client_name,charsmax(local_client_name));
ArrayGetString(rang_list, client_level[killer], local_level_name, charsmax(local_level_name));
set_hudmessage(HUD_LEVELUP_COLOR_R, HUD_LEVELUP_COLOR_G, HUD_LEVELUP_COLOR_B, HUD_LEVELUP_AXIS_X, HUD_LEVELUP_AXIS_Y, 0,.holdtime = 8.0);
show_hudmessage(0, "%L", LANG_SERVER, "MARS_HUD_CONGRATULATION", local_client_name, local_level_name);
client_print_color(0, print_team_default
, "^4[^1%s^4] %L", prefix, LANG_SERVER, "MARS_TXT_CONGRATULATION", local_client_name, local_level_name);
client_cmd(0, "spk gonarch/gon_step1.wav");
#endif
}
public client_putinserver(id)
{
// немного подождём, а вдруг ещё не загрузилась инфа?
set_task(ONSTART_WAIT_TIME, "onstart_set_exp", id + 129);
}
public onstart_set_exp(index)
{
new id = index - 129;
if(!is_user_connected(id)) return;
// обнуляем
client_kills[id] = 0;
#if defined WITH_SKILLS
#if READ_STATS != 2
client_deaths[id] = 0;
#endif
client_skill[id] = 100.0;
#endif
#if defined AES_PLUGINS_COMPATIBLE
client_bonus[id] = 0;
#endif
// и считываем
_read_stats(id);
}
_read_stats(id)
{
#if READ_STATS == 0
static stats[8];
static bh[8];
if(!get_user_stats(id,stats,bh))
client_kills[id] = 0;
else
client_kills[id] = stats[STATS_KILLS];
#endif
#if READ_STATS == 1
static stats[22];
if(csstats_get_user_stats(id, stats) <= 0)
client_kills[id] = 0;
else
client_kills[id] = stats[STATS_KILLS];
#endif
#if READ_STATS == 2
static stats[8];
static bh[8];
if(!get_user_stats_sql(id,stats,bh))
client_kills[id] = 0;
else
client_kills[id] = stats[STATS_KILLS];
#endif
// оптимизируем подсчёт уровня
client_level[id] = get_level_index(client_kills[id]);
client_kills_req[id] = level_reqexp(get_level_index(client_kills[id]))-client_kills[id];
#if defined WITH_SKILLS
#if READ_STATS == 0 || READ_STATS == 1
client_deaths[id] = stats[STATS_DEATHS];
client_skill[id] = (100.0 * float(stats[STATS_KILLS]) / float(stats[STATS_KILLS] + stats[STATS_DEATHS]));
#endif
#if READ_STATS == 2
if(!get_user_skill(id,client_skill[id]))
client_skill[id] = 100.0;
if(!client_skill[id]) client_skill[id] = 100.0;
#endif
// log_amx("[MARS %d] %f (FirstRead)", id, client_skill[id]);
#endif
}
/*
#if AMXX_VERSION_NUM < 183
#define client_disconnected client_disconnect
#endif
public client_disconnected(id)
{
log_amx("[MARS %d] %f (Disconnect)", id, client_skill[id]);
}
*/
public _mars_reload_stats() /* постарайтесь не юзать эту функцию без надобности. Обновление статистики в модуле csx или других плагинах
не мгновенно, а зачастую настраивается на запись под конец карты или при дисконнекте. так что вы рискуете временно сбить счёт уже успевшим
его набить игрокам. */
{
for(new id = 1; id <= g_maxplayers; id++)
{
if(is_user_connected(id)) _read_stats(id);
}
server_print("stats reloaded");
}
// Проброс натив ... конец плагина )
public plugin_natives()
{
register_library("mars_main");
#if defined WITH_SKILLS
register_native("mars_get_skill", "_mars_get_skill", true); // get Real-Time skill
#endif
#if defined AES_PLUGINS_COMPATIBLE
register_library("mars_to_aes_main");
// Совместимость с плагинами использующими AES 0.5 Vega..
register_native("aes_get_player_level", "_mars_get_player_level", true);
register_native("aes_get_player_exp", "_mars_get_player_exp", true);
register_native("aes_get_player_reqexp", "_mars_get_player_reqexp", true);
register_native("aes_get_level_name", "_mars_get_level_name");
register_native("aes_get_level_reqexp", "_mars_get_level_reqexp", true);
register_native("aes_get_max_level", "_mars_get_max_level", true);
register_native("aes_get_exp_level", "_mars_get_exp_level", true);
// fake natives ?
register_native("aes_set_player_bonus", "_mars_set_player_bonus");
register_native("aes_get_player_bonus", "_mars_get_player_bonus", true);
register_native("aes_set_player_level", "_mars_set_player_level");
register_native("aes_set_player_exp", "_mars_set_player_exp");
// mega fake native :)
register_native("aes_find_stats_thread", "_mars_find_stats_thread"); // mega fake :D
// Совместимость с AES 0.4
register_native("aes_get_stats", "_mars_get_player_stats"); // do not use it anymore (in aes 0.5 Vega, will be return false)
register_native("aes_get_player_stats", "_mars_get_player_stats");
register_native("aes_get_exp_to_next_level","_mars_get_level_reqexp", true);
register_native("aes_get_level_for_exp", "_mars_get_exp_level", true);
// aes_cstrike_exp for AES: STATSX CSTRIKE plugin
register_native("aes_get_exp_for_stats_f","_mars_get_exp_for_stats_f");
register_native("aes_get_exp_for_stats","_mars_get_exp_for_stats");
#endif
}
#if defined WITH_SKILLS
public Float:_mars_get_skill(id)
{
if ( !IsEntPlayer(id) )
{
log_error(AMX_ERR_NATIVE, "player out of range (%d)", id);
return -1.0;
}
return _get_skill(id);
}
#endif
#if defined AES_PLUGINS_COMPATIBLE
// Returns required experience to pass level
// @lvl - level
//
// @return - required experience value or -1.0 on fail
//
//native Float:aes_get_level_reqexp(level)
public Float:_mars_get_level_reqexp(level_index)
{
return float( level_reqexp( min( level_index, min( array_size-1, MAX_RANGS ) ) ) );
}
//native aes_get_level_for_exp(exp) AES 0.4
//
// Returns level for experience
// @exp - experience value
//
// @return - level num or -1 of fail
//
//native aes_get_exp_level(Float:exp)
public _mars_get_exp_level(Float:exp)
{
return get_level_index( floatround(exp) );
}
//
// Returns maximum level
//
//native aes_get_max_level()
public _mars_get_max_level()
{
return min(array_size, MAX_RANGS);
}
//
// Returns player experience
// @player - player id
//
// @return - player experience or -1.0 if player not tracked yet
//
//native Float:aes_get_player_exp(player)
public Float:_mars_get_player_exp(player_id)
{
if ( !IsEntPlayer(player_id) )
{
log_error(AMX_ERR_NATIVE, "player out of range (%d)", player_id);
return -1.0;
}
return float(client_kills[player_id]);
}
//
// Returns player required experience to next level
// @player - player id
//
// @return - required experience value
//
//native Float:aes_get_player_reqexp(player)
public Float:_mars_get_player_reqexp(player_id)
{
if ( !IsEntPlayer(player_id) )
{
log_error(AMX_ERR_NATIVE, "player out of range (%d)", player_id);
return -1.0;
}
return float( level_reqexp(client_level[ player_id ]) );
}
//native aes_set_player_stats(id,stats[3])
public _mars_get_player_stats(plugin,params)
{
if(params < 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d", params);
return 0;
}
new id = get_param(1);
if ( !IsEntPlayer(id) )
{
log_error(AMX_ERR_NATIVE, "player out of range (%d)", id);
return 0;
}
new ret[4];
ret[0] = client_kills[id]; // exp
ret[1] = client_level[id];//get_level_index(ret[0]); // level
ret[2] = client_bonus[id];//313374; // bonus
ret[3] = level_reqexp(ret[1]); // next exp
set_array(2, ret, 4);
return 1;
}
//
// Returns current player level
// @player - player id
//
// @return - current player level or -1 if player not tracked yet
//
//native aes_get_player_level(player)
public _mars_get_player_level(player_id)
{
if(!IsEntPlayer(player_id))
{
log_error(AMX_ERR_NATIVE,"player index %d, out of bounds", player_id);
return -1;
}
return client_level[player_id];
}
// +
// Returns level name for level num.
//
// @level - level number
// @level[] - level name output
// @len - len
// @idLang - language id
//
// @return - len
//
//native aes_get_level_name(level,level_name[],len,idLang = LANG_SERVER)
public _mars_get_level_name(plugin,params)
{
if(params < 3)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 3, passed %d", params);
return 0;
}
new level_index = get_param(1);
new level_name[LEVEL_NAME_LENGHT];
ArrayGetString(rang_list, min(level_index,array_size-1), level_name, charsmax(level_name));
set_string(2, level_name, get_param(3));
return 1;
}
//
// Returns player bonus points
// @player - player id
//
// @return - player bonus points or -1 if player
//
//native aes_get_player_bonus(player)
public _mars_get_player_bonus(player_id)
{
if(!IsEntPlayer(player_id))
{
log_error(AMX_ERR_NATIVE,"player index %d, out of bounds", player_id);
return -1;
}
return client_bonus[player_id];
}
//
// Sets player bonus points
// @player - player id
// @bonus - bonus value
// @force - force even if track paused
//
// @return
// AES_RT_NO - on track pause or player not tracked yet
// AES_RT_YES - on success
//
//native aes_set_player_bonus(player,bonus,bool:force = false)
public _mars_set_player_bonus(plugin,params)
{
if(params < 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d", params);
return 0;
}
new player_id = get_param(1);
if(!IsEntPlayer(player_id))
{
log_error(AMX_ERR_NATIVE,"player index %d, out of bounds", player_id);
return 0;
}
client_bonus[player_id] = get_param(2);
return 1;
}
//
// Sets player level
// @player - player id
// @level - level
// @force - force even if track paused
//
// @return
// AES_RT_NO - on track pause or player not tracked yet
// AES_RT_YES - on success
//
//native aes_set_player_level(player,level,bool:force = false)
public _mars_set_player_level(plugin,params)
{
if(params < 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d", params);
return 0;
}
new player_id = get_param(1);
if(!IsEntPlayer(player_id))
{
log_error(AMX_ERR_NATIVE,"player index %d, out of bounds", player_id);
return 0;
}
client_level[player_id] = min( get_param(2), min(array_size, MAX_RANGS) );
return 1;
}
//
// Sets player experience
// @player - player id
// @exp - experience value
// @no_forward - dont trigger forward functions on level up or level down
// @force - force even if track paused
//
// @return
// AES_RT_NO - on track pause or player not tracked yet
// AES_RT_YES - on success
// AES_RT_LEVLE_DOWN - on level down
// AES_RT_LEVEL_UP - on level up
//
//native aes_set_player_exp(player,Float:exp,bool:no_forward = false,bool:force = false)
public _mars_set_player_exp(plugin,params)
{
if(params < 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d", params);
return 0;
}
new player_id = get_param(1);
if(!IsEntPlayer(player_id))
{
log_error(AMX_ERR_NATIVE,"player index %d, out of bounds", player_id);
return 0;
}
client_kills[player_id] = min( floatround(get_param_f(2)), mars_exp[MAX_RANGS-1] );
return 1;
}
//
// Thread search for aes stats witch given array track_ids
// @id - player id
// @track_ids - dynamic array with track ids for search
// @callback - your callback function
// public my_callback(id,Array:aes_stats,stats_data[])
// @data[] - custom data
// @data_size - custom data size
//
// @return - true or false
//
//native aes_find_stats_thread(id = 0,Array:track_ids,callback[],data[] = "",datasize = 0)
public _mars_find_stats_thread() return false;
// aes exp cstrike
public Float:_mars_get_exp_for_stats_f(plugin_id,params)
{
if(params != 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d",params);
return 0.0;
}
return float(client_kills[get_param(1)]);//- 0.005; // в данный момент опыт и убийства - одно и тоже
}
public _mars_get_exp_for_stats(plugin_id,params)
{
if(params != 2)
{
log_error(AMX_ERR_NATIVE,"bad arguments num, expected 2, passed %d",params);
return 0;
}
return client_kills[get_param(1)];
}
#endif
Здорова ребята. Проблема такая. Поставил себе на сервер Micro Army Rank System.
Скилл и процент скилла не правильно показывает и стоят они на одном месте, короче не прибавляются.
Прикрепил СМА посмотрите плиз)
Скилл и процент скилла не правильно показывает и стоят они на одном месте, короче не прибавляются.
Прикрепил СМА посмотрите плиз)
В этой теме было размещено решение! Перейти к решению.
Download all Attachments
-
380 KB Просмотры: 764
-
25.6 KB Просмотры: 703