Участник
Пользователь
- Сообщения
- 103
- Реакции
- 5
- Помог
- 2 раз(а)
- Ошибка
-
Скрин внизу
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/**
*
* Name: Rank Menu
* Version: 1.0
* Author: h1k3
*
* Requirements: AmxModX 1.8.2 or higher
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses#5A856BAB-276>
*
*/
#include <amxmodx>
#define STATS_TYPE 1 // 0 - CSX, 1 - CSstatsX SQL by serfreeman1337, 2 - CsStats MySQL by SKAJIbnEJIb, 3 - CSX with Micro Army Rank System by Ge3eR
#define LEVEL_TYPE 1 // 0 - None, 1 - AES by serfreeman1337, 2 - Army Ranks by SKAJIbnEJIb
#if STATS_TYPE == 0
#include <csx>
#elseif STATS_TYPE == 1
#include <csstatsx_sql>
#elseif STATS_TYPE == 2
#include <csstats_mysql>
#elseif STATS_TYPE == 3
#include <csx>
native Float:mars_get_skill(player);
#elseif STATS_TYPE < 0 || STATS_TYPE > 3
#error 'Unsupported STATS_TYPE value'
#endinput
#endif
#if LEVEL_TYPE == 1
#include <aes_v>
#elseif LEVEL_TYPE == 2
#include <army_ranks_ultimate>
#elseif LEVEL_TYPE < 0 || LEVEL_TYPE > 2
#error 'Unsupported LEVEL_TYPE value'
#endinput
#endif
public plugin_init() {
register_plugin("Rank Menu", "1.0", "h1k3");
register_clcmd("say /rank", "CmdRank");
register_clcmd("say_team /rank", "CmdRank");
}
public CmdRank(id) {
#if STATS_TYPE == 0
new stats[8], bodyhits[8];
new rank = get_user_stats(id, stats, bodyhits);
new num = get_statsnum();
#elseif STATS_TYPE == 1
new stats[8], bodyhits[8];
new rank = get_user_stats_sql(id, stats, bodyhits);
new num = get_statsnum_sql();
new Float:skill, letter[3];
get_user_skill(id, skill);
getSkillLetter(floatround(skill), letter, charsmax(letter));
#elseif STATS_TYPE == 2
new stats[22];
new rank = csstats_get_user_stats(id, stats);
new num = csstats_get_statsnum();
new letter[3];
getSkillLetter(stats[SKILL], letter, charsmax(letter));
#elseif STATS_TYPE == 3
new stats[8], bodyhits[8];
new rank = get_user_stats(id, stats, bodyhits);
new num = get_statsnum();
new letter[3];
new Float:skill = mars_get_skill(id);
getSkillLetter(floatround(skill), letter, charsmax(letter));
#endif
if (rank <= 0) {
client_print(id, print_chat, "Статистика недоступна. Повторите позже.")
}
#if LEVEL_TYPE == 1
new tag[32];
new level = aes_get_player_level(id);
aes_get_level_name(level, tag, charsmax(tag), id);
#elseif LEVEL_TYPE == 2
new tag[32];
new level = ar_get_user_level(id, tag, charsmax(tag));
#endif
new msg[512], len;
len += formatex(msg[len], charsmax(msg) - len, "^t\wВы занимаете \r%d-е \wместо из \r%d^n", rank, num);
#if STATS_TYPE != 0 && LEVEL_TYPE != 0
len += formatex(msg[len], charsmax(msg) - len, "^t\wСкилл \r%s \d| \wУровень \r%d \w(\y%s\w)^n", letter, level, tag);
#elseif STATS_TYPE != 0 && LEVEL_TYPE == 0
len += formatex(msg[len], charsmax(msg) - len, "^t\wСкилл \r%s^n", letter);
#elseif STATS_TYPE == 0 && LEVEL_TYPE != 0
len += formatex(msg[len], charsmax(msg) - len, "^t\wУровень \r%d \w(\y%s\w)^n", level, tag);
#endif
len += formatex(msg[len], charsmax(msg) - len, "^t\wУбийств \r%d \d| \wСмертей \r%d^n", stats[0], stats[1]);
len += formatex(msg[len], charsmax(msg) - len, "^t\wУбийств в голову \r%d^n", stats[2]);
len += formatex(msg[len], charsmax(msg) - len, "^t\wВыстрелов \r%d \d| \wПопаданий \r%d^n", stats[4], stats[5]);
show_menu(id, 1023, msg, 5);
return PLUGIN_HANDLED;
}
stock getSkillLetter(skill, letter[], len) {
if (skill < 60) {
copy(letter, len, "L-");
} else if (60 <= skill < 75) {
copy(letter, len, "L");
} else if (75 <= skill < 85) {
copy(letter, len, "L+");
} else if (85 <= skill < 100) {
copy(letter, len, "M-");
} else if (100 <= skill < 115) {
copy(letter, len, "M");
} else if (115 <= skill < 130) {
copy(letter, len, "M+");
} else if (130 <= skill < 140) {
copy(letter, len, "H-");
} else if (140 <= skill < 150) {
copy(letter, len, "H");
} else if (150 <= skill < 165) {
copy(letter, len, "H+");
} else if (165 <= skill < 180) {
copy(letter, len, "P-");
} else if (180 <= skill < 195) {
copy(letter, len, "P");
} else if (195 <= skill < 210) {
copy(letter, len, "P+");
} else {
copy(letter, len, "G");
}
}
В этой теме было размещено решение! Перейти к решению.