Ошибка reapi_killer_screenfade

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
460
Реакции
68
Помог
7 раз(а)
Ошибка
L 04/06/2018 - 11:09:15: [AMXX] Displaying debug trace (plugin "reapi_killer_screenfade.amxx", version "0.0.5")
L 04/06/2018 - 11:09:15: [AMXX] Run time error 4: index out of bounds
L 04/06/2018 - 11:09:15: [AMXX] [0] reapi_killer_screenfade.sma::CSGameRules_PlayerKilled (line 238)
ОС
Windows
Билд
Protocol version 48
Exe version 1.1.2.7 (cstrike)
ReHLDS version: 3.4.0.640-dev
Build date: 15:11:44 Apr 1 2018 (1450)
Build from: https://github.com/dreamstalker/rehlds/commit/19e3a5d
ReGamedll
ReGameDLL version: 5.7.0.295-dev
Build date: 15:10:22 Feb 19 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/aa329db
Список метамодулей
description      stat pend  file                    vers             src  load  unload
[ 1] VoiceTranscoder RUN - voicetranscoder.dll v2017RC3 ini ANY ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.92 ini Start Never
[ 3] ReSemiclip RUN - resemiclip_mm.dll v2.3.9 ini Chlvl ANY
[ 4] AMX Mod X RUN - amxmodx_mm.dll v1.8.3-dev+5151 ini Start ANY
[ 5] WHBlocker RUN - whblocker_mm.dll v1.5.695 ini Chlvl ANY
[ 6] Rechecker RUN - rechecker_mm.dll v2.5 ini Chlvl ANY
[ 7] ReAuthCheck RUN - reauthcheck_mm.dll v0.1.6 ini Start Never
[ 8] CStrike RUN - cstrike_amxx.dll v1.8.3-Re pl4 ANY ANY
[ 9] SQLite RUN - sqlite_amxx.dll v1.8.3-Re pl4 ANY ANY
[10] Fun RUN - fun_amxx.dll v1.8.3-dev+5154 pl4 ANY ANY
[11] hackdetector RUN - hackdetector_amxx.dll v0.15.328.lite pl4 ANY ANY
[12] ReAimDetector RUN - reaimdetector_amxx.dll v0.2.2 pl4 ANY Never
[13] ReAPI RUN - reapi_amxx.dll v5.5.0.150-dev pl4 ANY Never
[14] FakeMeta RUN - fakemeta_amxx.dll v1.8.3-Re pl4 ANY ANY
[15] Engine RUN - engine_amxx.dll v1.8.3-Re pl4 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx.dll v1.8.3-Re pl4 ANY ANY
16 plugins, 16 running
Список плагинов
name                    version     author            file             status   
[ 1] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 2] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 3] FreshBans 1.3.9b kanagava fresh_bans_139_ running
[ 4] ScreenMaker 1.1 neygomon screen_maker.am running
[ 5] RC BaseChanger 1.0 phe rc_basechanger. stopped
[ 6] ReChecker Logging 1.0 phe rc_logging.amxx running
[ 7] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 8] Admin Base 1.8.2 AMXX Dev Team admin.amxx running
[ 9] Ping Control 1.4 neygomon Ping_Control.am running
[ 10] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 11] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 12] Stats Configuration 1.8.2 AMXX Dev Team statscfg.amxx running
[ 13] Say me and Say hp 1.4 neygomon sayme_reapi.amx running
[ 14] Advanced Gag 1.9.0 neygomon amx_gag.amxx running
[ 15] Advanced MapChooser 1.4 neygomon map_chooser.amx running
[ 16] Lite Translit 2.8 neygomon lite_translit_c running
[ 17] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 18] Menus Front-End 1.5 neugomon menufront.amxx running
[ 19] Items Restrict 1.0 s1lent items_restrict. running
[ 20] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 21] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 22] Radio Hudmsg Block 1.0 AcE radio_hudmsg_bl running
[ 23] Server Menu [INI] 1.0 Leo_[BH] server_menu.amx running
[ 24] SF Bets 0.1.5 serfreeman1337 sf_bets.amxx running
[ 25] Parachute for ALL [ReA 3.0 Leo_[BH] parachute.amxx running
[ 26] C4 Timer on roundtime 0.3.3a neygomon c4timer_neugomo running
[ 27] Plugins Controller 1.0 neygomon plugins_control stopped
[ 28] DemoRecoder 1.1 neygomon amx_demorec.amx running
[ 29] Rock to Ban 1.02 Safety1st rock2ban.amxx running
[ 30] [ReAPI] AWPoff 1.3 PAffAEJIkA :3 awp_off.amxx running
[ 31] Players Menu 1.7 neugomon players_menu.am running
[ 32] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 33] Steam Models 0.1b+mod.l Freedo.m steam_models.am running
[ 34] Team Grenade Trail 1.2 Numb team_grenade_tr running
[ 35] [ReAPI] Round Balancer 1.1 neygomon round_balancer. running
[ 36] Kills Counter 0.3 serfreeman1337 kills_counter.a running
[ 37] Star Damager 1.0 Seroff Damager_star.am running
[ 38] [ReAPI] Random Weapons 2.4.6 neugomon random_weapons_ stopped
[ 39] Killer ScreenFade 0.0.5 Vaqtincha reapi_killer_sc debug
[ 40] SpecList 1.2a FatalisDK speclist_rus.am running
[ 41] Adverts 1.0 pUzzlik adverts_message running
[ 42] Grab 2.5 Support123 grab_new.amxx running
[ 43] Super Bunny Hopper 1.2 Cheesy Peteza bunnyhop.amxx stopped
[ 44] SF MultiJump 0.2 serfreeman1337 sf_multijump.am running
[ 45] Ultimate KillStreak Ad 0.7 SAMURAI ut_killstreak_a running
[ 46] ProKreedz Hook v2.3 vato loco [GE-S] dr_hook.amxx stopped
[ 47] Nick Change Menu 0.1.1 serfreeman1337 nickchange_menu running
[ 48] Ultimate Gore 1.6 JTP10181 amx_gore_ultima running
[ 49] V.I.P Custom Weapons 1.0.0 Vaqtincha vip_custom.amxx debug
[ 50] unknown unknown unknown custom_deagle.a paused
[ 51] unknown unknown unknown custom_m4a1.amx paused
[ 52] unknown unknown unknown custom_ak47.amx paused
[ 53] unknown unknown unknown custom_awp.amxx paused
[ 54] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 55] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 56] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 57] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 58] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste stopped
[ 59] AES: Bonus CSTRIKE 0.5.9 [REA serfreeman1337/s aes_bonus_cstri stopped
59 plugins, 48 running
Исходный код
Простыми словами после удаления мною розового цвета затемнения посыпались ошибки.
Исходник.
PHP:
// Copyright © 2016/2017 Vaqtincha

#define KFADE_HOLD_TIME            0.5    // Продолжительность
#define KFADE_FX_TIME            0.2    // Плавное исчезновение   
#define VAULT_EXPIRE_DAYS        7    // Через сколько дней удалить настройку (если игрок не заходил)

#define MESSAGE_TYPE            MSG_ONE_UNRELIABLE
// #define DEBUG
new const VAULT_FILE[] = "kscfade_data"

#define PL_VERSION         "0.0.5"

#include <amxmodx>
#include <reapi>
#include <nvault_array>

#define DEFAULT_FADE_COLOR             FADE_COLORS_BLUE // see "enum FadeColors"

#if AMXX_VERSION_NUM < 183
    #define client_disconnected         client_disconnect
#endif

#define IsBot(%1)                        (!g_aPlayerData[%1][AuthId][0])

const MAX_AUTHID_LENGHT = 32
const MENU_KEYS = (MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_0)
const KEY_EXIT = 10
enum any:FadeColors

{
    FADE_COLORS_RANDOM = 0,
    FADE_COLORS_BLUE,
    FADE_COLORS_ORANGE,
    FADE_COLORS_PURPLE,
    FADE_COLORS_GREEN,
    FADE_COLORS_WHITE,
    FADE_COLORS_RED
}

enum color_e { R, G, B }

enum player_s
{
    AuthId[MAX_AUTHID_LENGHT],
    State,
    FadeColor,
    AlphaPercent
}

enum
{
    KSF_DISABLED,
    KSF_ENABLED,
    KSF_ONLY_HS
}

new const FADE_ALPHA[] = { 10, 20, 30, 40, 50, 60, 70, 80, 90 }

new const FADE_COLORS[FadeColors][color_e] =
{
    {0, 0, 0},        // random
    {0, 127, 255},     // blue
    {255, 127, 0},     // orange
    {127, 0, 255},     // purple
    {0, 255, 0},     // green
    {255, 255, 255},  // white
    {255, 0, 0}     // red
}

new g_aPlayerData[MAX_CLIENTS + 1][player_s]
new g_hVault = INVALID_HANDLE

public plugin_end()
{
    if(g_hVault != INVALID_HANDLE) {
        nvault_close(g_hVault)
    }
}

public plugin_cfg()
{
    if((g_hVault = nvault_open(VAULT_FILE)) == INVALID_HANDLE) {
        set_fail_state("[KSCFADE] ERROR: Opening nVault failed!")
    }
    else{
        nvault_prune(g_hVault, 0, get_systime() - (86400 * VAULT_EXPIRE_DAYS))
    }
}

public plugin_init()
{
    register_plugin("Killer ScreenFade", PL_VERSION, "Vaqtincha")
    register_menucmd(register_menuid("SettingsMenu"), MENU_KEYS, "SettingsMenuHandler")

    register_clcmd("fade", "ClCmd_ScfMenu")
    register_clcmd("say /fade", "ClCmd_ScfMenu")
    register_clcmd("say_team /fade", "ClCmd_ScfMenu")

    RegisterHookChain(RG_CSGameRules_PlayerKilled, "CSGameRules_PlayerKilled", .post = true)
    // RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", .post = true)
}

public client_disconnected(pClient) {
    SaveUserInfo(pClient)
}

public client_putinserver(pClient)
{
    g_aPlayerData[pClient][AuthId][0] = 0

    if(is_user_bot(pClient) || is_user_hltv(pClient))
        return
    
    get_user_authid(pClient, g_aPlayerData[pClient][AuthId], MAX_AUTHID_LENGHT - 1)

    if(nvault_get_array(g_hVault, g_aPlayerData[pClient][AuthId], g_aPlayerData[pClient], player_s) <= 0)
    {
        g_aPlayerData[pClient][State] = KSF_ENABLED
        g_aPlayerData[pClient][FadeColor] = DEFAULT_FADE_COLOR
        g_aPlayerData[pClient][AlphaPercent] = random_num(2, 4)
    }
    
#if defined DEBUG
    static const szText[KSF_ONLY_HS + 1][] = { "disabled", "enabled", "hs only" }
    server_print("^n[KSCFADE] Client: %s | State: %s | Color: %d | Alpha: %d", g_aPlayerData[pClient][AuthId],
        szText[g_aPlayerData[pClient][State]], g_aPlayerData[pClient][FadeColor], g_aPlayerData[pClient][AlphaPercent])
#endif
}

public ClCmd_ScfMenu(const pPlayer)
{
    if(!is_user_alive(pPlayer))
    {
        client_print_color(pPlayer, print_team_default, "Доступно только для живых игроков!")
        return PLUGIN_HANDLED 
    }
    
    new szMenu[512], iKeys = (MENU_KEY_0|MENU_KEY_3)
    new iLen = formatex(szMenu, charsmax(szMenu), "\yМеню Настройки^n^n")

    static const szColText[sizeof(FADE_COLORS)][] = {"Рандомно", "Синий", "Оранжевый", "Фиолетовый", "Зеленый", "Белый", "Красный" }
    static const szStateText[KSF_ONLY_HS + 1][] = { "\rОтключен", "\wВключен", "\wТолько хедшоте" }
    
    if(g_aPlayerData[pPlayer][State] == KSF_DISABLED)
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen,
            "\d1. Цвет: [%s]^n\
            \d2. Прозрачность: [%d]^n^n",
            szColText[g_aPlayerData[pPlayer][FadeColor]], FADE_ALPHA[g_aPlayerData[pPlayer][AlphaPercent]]
        )
    }
    else
    {
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen,
            "\y1. \wЦвет\r: \y[\w%s\y]^n\
            \y2. \wПрозрачность\r: \y[\w%d\y]^n^n",
            szColText[g_aPlayerData[pPlayer][FadeColor]], FADE_ALPHA[g_aPlayerData[pPlayer][AlphaPercent]]
        )

        iKeys |= (MENU_KEY_1|MENU_KEY_2)
    }
    
    formatex(szMenu[iLen], charsmax(szMenu) - iLen,
        "\y3. \wСостояние\r: \y[%s\y]^n^n^n\
        \y0. \rСохранить и выйти", szStateText[g_aPlayerData[pPlayer][State]]
    )
    
    show_menu(pPlayer, iKeys, szMenu, -1, "SettingsMenu")
    return PLUGIN_HANDLED
}

public SettingsMenuHandler(const pPlayer, const iKey)
{
    if(iKey == KEY_EXIT - 1)
    {
        SaveUserInfo(pPlayer)
        return PLUGIN_HANDLED
    }
    
    switch(iKey)
    {
        case 0:
        {
            if(++g_aPlayerData[pPlayer][FadeColor] >= sizeof(FADE_COLORS)) {
                g_aPlayerData[pPlayer][FadeColor] = FADE_COLORS_RANDOM
            }
    
            new iCol = g_aPlayerData[pPlayer][FadeColor]
            __UTIL_ScreenFade(pPlayer, iCol != FADE_COLORS_RANDOM ? FADE_COLORS[iCol] : FADE_COLORS[random_num(1, sizeof(FADE_COLORS) - 1)], FADE_ALPHA[g_aPlayerData[pPlayer][AlphaPercent]],
                KFADE_FX_TIME, KFADE_HOLD_TIME
            )
        }
        case 1:
        {
            if(++g_aPlayerData[pPlayer][AlphaPercent] >= sizeof(FADE_ALPHA)) {
                g_aPlayerData[pPlayer][AlphaPercent] = 0
            }

            new iCol = g_aPlayerData[pPlayer][FadeColor]
            __UTIL_ScreenFade(pPlayer, iCol != FADE_COLORS_RANDOM ? FADE_COLORS[iCol] : FADE_COLORS[random_num(1, sizeof(FADE_COLORS) - 1)], FADE_ALPHA[g_aPlayerData[pPlayer][AlphaPercent]],
                KFADE_FX_TIME, KFADE_HOLD_TIME
            )
        }
        case 2:
        {
            switch(g_aPlayerData[pPlayer][State])
            {
                case KSF_DISABLED:
                {
                    g_aPlayerData[pPlayer][State] = KSF_ENABLED
                    // client_print(pPlayer, print_center, "ScreenFade Enabled!")
                }
                case KSF_ENABLED: g_aPlayerData[pPlayer][State] = KSF_ONLY_HS
                case KSF_ONLY_HS:
                {
                    g_aPlayerData[pPlayer][State] = KSF_DISABLED
                    client_print(pPlayer, print_center, "ScreenFade Disabled!")
                }
            }
        }
    }
    
    return ClCmd_ScfMenu(pPlayer)
}


public CSGameRules_PlayerKilled(const pPlayer, const pevKiller, const pevInflictor)
{
    if(pPlayer == pevKiller || pevKiller != pevInflictor /* ignore grenade kills */ || !is_user_alive(pevKiller))
        return HC_CONTINUE
    
    if(IsBot(pevKiller) || g_aPlayerData[pevKiller][State] == KSF_DISABLED)
        return HC_CONTINUE
    
    if(g_aPlayerData[pevKiller][State] == KSF_ENABLED || (g_aPlayerData[pevKiller][State] == KSF_ONLY_HS && get_member(pPlayer, m_bHeadshotKilled)))
    {
        new iCol = g_aPlayerData[pevKiller][FadeColor]
        __UTIL_ScreenFade(pevKiller, iCol != FADE_COLORS_RANDOM ? FADE_COLORS[iCol] : FADE_COLORS[random_num(1, sizeof(FADE_COLORS) - 1)], FADE_ALPHA[g_aPlayerData[pevKiller][AlphaPercent]],
            KFADE_FX_TIME, KFADE_HOLD_TIME
        )
    }
    
    return HC_CONTINUE
}

SaveUserInfo(pPlayer)
{
    if(!IsBot(pPlayer)) {
        nvault_set_array(g_hVault, g_aPlayerData[pPlayer][AuthId], g_aPlayerData[pPlayer], player_s)
    }
}

stock __UTIL_ScreenFade(const pPlayer, iColor[color_e], iAlpha, Float:flFxTime = 1.0, Float:flHoldTime = 1.0)
{
    if(IsBlind(pPlayer))
        return

    const FFADE_IN = 0x0000
    static iMsgIdScreenFade

    if(iMsgIdScreenFade > 0 || (iMsgIdScreenFade = get_user_msgid("ScreenFade")))
    {
        message_begin(MESSAGE_TYPE, iMsgIdScreenFade, .player = pPlayer)
        write_short(FixedUnsigned16(flFxTime))
        write_short(FixedUnsigned16(flHoldTime))
        write_short(FFADE_IN)
        write_byte(iColor[R])
        write_byte(iColor[G])
        write_byte(iColor[B])
        write_byte(iAlpha)
        message_end()
    }
}

stock FixedUnsigned16(Float:flValue, iScale = (1 << 12)) {
    return clamp(floatround(flValue * iScale), 0, 0xFFFF)
}

stock bool:IsBlind(const pPlayer) {
    return bool:(Float:get_member(pPlayer, m_blindStartTime) + Float:get_member(pPlayer, m_blindFadeTime) >= get_gametime())
}

// stock bool:IsBlind(const pPlayer) {
    // return bool:(Float:get_member(pPlayer, m_blindUntilTime) > get_gametime())
// }
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
460
Реакции
68
Помог
7 раз(а)
Pokemoshka, я думаю да можно. Если можете подскажите как заменить на строке 36 я не знаю как вписать жёлтый. По сути так FADE_COLORS_YELLOW.
 
Сообщения
2,491
Реакции
2,794
Помог
61 раз(а)
Код:
enum any:FadeColors

{
FADE_COLORS_RANDOM = 0,
FADE_COLORS_BLUE,
FADE_COLORS_ORANGE,
FADE_COLORS_PURPLE,
FADE_COLORS_GREEN,
FADE_COLORS_WHITE,
FADE_COLORS_RED
}

enum color_e { R, G, B }

new const FADE_COLORS[FadeColors][color_e] =
{
    {0, 0, 0},        // random
    {0, 127, 255},     // blue
    {255, 127, 0},     // orange
    {127, 0, 255},     // purple
    {0, 255, 0},     // green
    {255, 255, 255},  // white
    {255, 0, 0}     // red
}
 
Сообщения
2,288
Реакции
1,740
Помог
31 раз(а)
Best777, если нужно заменить white измените 36 строку и 66
 
Сообщения
957
Реакции
1,185
Помог
52 раз(а)
Pokemoshka, Best777, параметры цвета хранятся исключительно в FADE_COLORS[FadeColors][color_e] и имеют вид 3 значений, согласно цветовой схемы RGB (красный, зеленый, синий). В enum any:FadeColors присвоены символьные обозначения лишь для повышения читаемости кода - даже если там оставить старое название, ничего фатального не произойдет.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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