spec stats info

Сообщения
187
Реакции
319
Помог
1 раз(а)
Совсем нет времени доделать плаг, мб возьмется кто или пригодится кому в таком виде в каком есть.
Что хотел доделать:
Мультилэнг
Разобраться с флагами

C++:
/**
*
* Name: Rank Menu
* Version: 0.1
* 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#5A82F748-3B>
*
*/

//BIG THANKS "h1k3" !!!

#include <amxmodx>
#include <csstatsx_sql>
#include <time_perf>

//////////////////=CONFIG=//////////////////
#define SHOW_TIME    10    //Time in seconds to show info
//Uncommend segment if you need to show this
#define PLACE            //Player's position from all players
#define SKILL            //Show player skill example (M 104)
#define KD_HSP            //Kill / Deaths ratio | Head shot percents
//#define K_D_HS            //Kills | Deaths | Headshots
#define AES_EXP            //Show expirience to next level
#define AES_RANK        //AES level and rank
#define ONLINE            //Total time on server
#define STEAM            //Show steam or non steam
#define ADMIN_VIP        //Show is a player admin or vip
#if defined ADMIN_VIP
    #define ADMIN_FLAG    ADMIN_BAN         //Flag "d" in users.ini
    #define VIP_FLAG    ADMIN_LEVEL_H    //Flag "t" in users.ini
#endif
///////////////////=END=////////////////////

#if defined AES_EXP || defined AES_RANK
    #include <aes_v>
#endif

#define STATS_KILLS        0
#define STATS_DEATHS    1
#define STATS_HS        2

const MAX_TIME_LENGTH = 80    // '1 weeks, 6 days, 20 hours, 22 minutes and 41 seconds': 53 in English & 80 in Russian

public plugin_init()
{
    register_plugin("Spec_stats", "0.1", "perf");
    register_event("SpecHealth2","spec_target","bd");
    register_dictionary("time_perf.txt");
}

public spec_target(id)
{
    new target, msg[512], len;
    target = read_data(2);

#if defined PLACE || defined KD_HSP || defined K_D_HS
    new stats[8], bodyhits[8];
    new rank = get_user_stats_sql(target, stats, bodyhits);
#endif

#if defined PLACE
    new num = get_statsnum_sql();
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wPlace: \r%d \wof \y%d^n", rank, num);
#endif
#if defined SKILL
    new Float:skill, letter[3];
    get_user_skill(target, skill);
    getSkillLetter(skill, letter, charsmax(letter));
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wSkill: \r%s \y%.2f^n", letter, skill);
#endif
#if defined KD_HSP
    if((stats[STATS_DEATHS]) == 0)
    {
        (stats[STATS_DEATHS]) == 1.0;
    }
    new Float: kd, Float:hsp;
    kd = float(stats[STATS_KILLS]) / float(stats[STATS_DEATHS]);
    hsp = (100.0 * float(stats[STATS_HS]) / float(stats[STATS_KILLS]));
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wK/D: \r%.2f \d| \wHSP: \r%.2f\r%%^n", kd, hsp);
#endif
#if defined K_D_HS
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wKills: \r%d \d| \wDeaths: \r%d \d| \wHS: \r%d^n"
    , stats[STATS_KILLS], stats[STATS_DEATHS], stats[STATS_HS]);
#endif
#if defined AES_EXP
    new Float:player_exp = aes_get_player_exp(target);
    new Float:player_reqexp = aes_get_player_reqexp(target);
    //magic of serfreeman1337 ??
    player_exp = _:player_exp >= 0 ? player_exp + 0.005 : player_exp - 0.005;
    player_reqexp = _:player_reqexp >= 0 ? player_reqexp + 0.005 : player_reqexp - 0.005;
    //
    if(player_reqexp >= 0)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wExp: \r%.0f\w/\y%.0f^n", player_exp, player_reqexp);
    }
    else
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wExp: \rMAX");
    }
#endif
#if defined AES_RANK
    new tag[32];
    new level = aes_get_player_level(target);
    aes_get_level_name(level, tag, charsmax(tag), target);
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wLevel: \r%d \w(\y%s\w)^n", level, tag);
#endif
#if defined ONLINE
    new gametime = get_user_gametime(target)
    new online[MAX_TIME_LENGTH]
    get_time_length(target, gametime, timeunit_seconds, online, charsmax(online))
    len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\wOnline: \y%s^n", online);
#endif
#if defined STEAM
    new bool:is_steam = bool:(is_user_steam(target));
    if(is_steam)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\rSTEAM");
    }
    else
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\yNON STEAM");
    }
#endif
#if defined STEAM && defined ADMIN_VIP
    if(get_user_flags(target) & ADMIN_FLAG)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t\w| \rADMIN");
    }
    if(get_user_flags(target) & VIP_FLAG)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t\w| \yVIP");
    }
#elseif defined ADMIN_VIP
    if(get_user_flags(target) & ADMIN_FLAG)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\w| \rADMIN");
    }
    if(get_user_flags(target) & VIP_FLAG)
    {
        len += formatex(msg[len], charsmax(msg) - len, "^t^t^t^t\w| \yVIP");
    }
#endif
    show_menu(id, 1023, msg, SHOW_TIME);
    return PLUGIN_HANDLED;
}

#if defined SKILL
getSkillLetter(Float:skill, letter[], len) {
    if (skill < 60.0) {
        copy(letter, len, "L-");
    } else if (60.0 <= skill < 75.0) {
        copy(letter, len, "L");
    } else if (75.0 <= skill < 85.0) {
        copy(letter, len, "L+");
    } else if (85.0 <= skill < 100.0) {
        copy(letter, len, "M-");
    } else if (100.0 <= skill < 115.0) {
        copy(letter, len, "M");
    } else if (115.0 <= skill < 130.0) {
        copy(letter, len, "M+");
    } else if (130.0 <= skill < 140.0) {
        copy(letter, len, "H-");
    } else if (140.0 <= skill < 150.0) {
        copy(letter, len, "H");
    } else if (150.0 <= skill < 165.0) {
        copy(letter, len, "H+");
    } else if (165.0 <= skill < 180.0) {
        copy(letter, len, "P-");
    } else if (180.0 <= skill < 195.0) {
        copy(letter, len, "P");
    } else if (195.0 <= skill < 210.0) {
        copy(letter, len, "P+");
    } else {
        copy(letter, len, "G");
    }
}
#endif

#if defined STEAM
stock bool:is_user_steam(id)
{
// Author Sh0oter
        static dp_pointer
        if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
        {
            server_cmd("dp_clientinfo %d", id)
            server_exec()
            return (get_pcvar_num(dp_pointer) == 2) ? true : false
        }
        return false
}
#endif

P.S. спасибо h1k3
 

Download all Attachments

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

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