Ошибка в плагине Kills Rarity

Сообщения
67
Реакции
1
Помог
1 раз(а)
Ошибка
L 03/11/2020 - 23:06:01: [AMXX] Displaying debug trace (plugin "KillsRarity.amxx", version "0.0.1")
L 03/11/2020 - 23:06:01: [AMXX] Run time error 5: memory access
L 03/11/2020 - 23:06:01: [AMXX] [0] KillsRarity.sma::_AnnounceToPlayers (line 115)
L 03/11/2020 - 23:06:01: [AMXX] [1] KillsRarity.sma::CBasePlayer_Killed (line 41)
ОС
Linux
Amx Mod X
AMX Mod X 1.10.0.5390 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 20 2019 02:17:37
Built from: https://github.com/alliedmodders/amxmodx/commit/d3ef881
Build ID: 5390:d3ef881
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.693-dev
Build date: 18:20:58 Jan 28 2020 (2117)
Build from: https://github.com/dreamstalker/rehlds/commit/c4cecf5
ReGamedll
ReGameDLL version: 5.14.0.454-dev+m
Build date: 17:39:55 Feb 19 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/05cf0f7
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.92c ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 4] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 5] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 6] AMX Mod X RUN - amxmodx_mm_i386.so v1.10.0.5390 ini Start ANY
[ 7] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 9] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[10] MySQL RUN - mysql_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[11] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl6 ANY Never
[12] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl6 ANY Never
[13] Fun RUN - fun_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[14] Engine RUN - engine_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[15] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[16] GeoIP RUN - geoip_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[17] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[18] CSX RUN - csx_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
[19] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5390 pl6 ANY ANY
19 plugins, 19 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] admin_loader 0.5.5 kanagava admin_loader-05 running
[ 2] WebHS 0.1 kanagava fb_web_online.a running
[ 3] FreshBans 1.4.2b kanagava fresh_bans_142_ running
[ 4] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 5] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 6] Micro Army Rank System 1.29Hz_p1 Ge3eR mars.amxx running
[ 7] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 8] Admin Help 1.9.0.5249 AMXX Dev Team adminhelp.amxx running
[ 9] Slots Reservation 1.9.0.5249 AMXX Dev Team adminslots.amxx running
[ 10] Multi-Lingual System 1.9.0.5249 AMXX Dev Team multilingual.am running
[ 11] Commands Menu 1.9.0.5249 AMXX Dev Team cmdmenu.amxx running
[ 12] Players Menu 1.9.0.5249 AMXX Dev Team plmenu.amxx running
[ 13] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 14] Server AMXMODMENU [INI 1.0 Leo_[BH] amxmodmenu.amxx running
[ 15] Weapon Kill No Suicide 1.2 Slove. & AcE weaponkill.amxx running
[ 16] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 17] Anti Flood 1.9.0.5249 AMXX Dev Team antiflood.amxx running
[ 18] Scrolling Message 1.9.0.5249 AMXX Dev Team scrollmsg.amxx running
[ 19] Info. Messages 1.9.0.5249 AMXX Dev Team imessage.amxx running
[ 20] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 21] Pause Plugins 1.9.0.5249 AMXX Dev Team pausecfg.amxx running
[ 22] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 23] CS Stats Logging 1.9.0.5249 AMXX Dev Team stats_logging.a running
[ 24] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 25] ReChecker Logging 1.0 custom rc_logging.amxx running
[ 26] Hide HUD/Menu on Vote 1.2.2 d3m37r4 hide_hud_and_me running
[ 27] Ultimate Chats Control 5.2(c) neygomon ucc.amxx running
[ 28] unknown unknown unknown ucc_api_example running
[ 29] UCC Addon: VoteGAG 1.2 neygomon ucc_votegag.amx running
[ 30] Team Select 1.5.0 F@nt0M teamselect.amxx running
[ 31] AFK Protection 2.3 rapara13/Nordic afk.amxx running
[ 32] Weapon Skin System 0.7.0-55 Mistrick weapon_skin_sys running
[ 33] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 34] Score 0.1 Ragamafona score.amxx running
[ 35] Spectator Bots 2.1 SISA s_b.amxx running
[ 36] unknown unknown unknown ExCLuSiVe_CSDM. running
[ 37] Connect Info 1.0 Hypa_[KZ] connect_info.am running
[ 38] Parachute 1.1 Random1, 93()|29 sub_parachute.a running
[ 39] Advanced Kill Assists 0.9 Spection next21_kill_ass running
[ 40] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 41] Show Damage 1.0 neygomon damager.amxx running
[ 42] Screen Fade [True Flas 1.0 Leo_[BH] screen_fade_fla running
[ 43] AntiFlash FINAL 5.0 Leo_[BH] antiflash5.amxx running
[ 44] Ultimate Gore 1.6 JTP10181 amx_gore_ultima running
[ 45] Reset Score and Sound 1.0 FarCher NewResetScore.a running
[ 46] RE Vampire 1.0.7 MakapoH, AcE, RE re_vampire.amxx running
[ 47] Voteban CSR 0.8.5beta Leo_[BH] csr_voteban.amx running
[ 48] Demo Recorder 2.4.1 F@nt0M demo_recorder.a running
[ 49] Custom skies 0.0.1 Nordic Warrior CustomSkies.amx running
[ 50] Simple Grenade Trail 1.0 seroff granade_trail.a running
[ 51] PLUGIN VERSION AUTHOR hidetimer.amxx running
[ 52] NoRound Balancer 1.3 neygomon noround_balance running
[ 53] unknown unknown unknown menuSystem.amxx running
[ 54] Spec Switch 0.0.3 many spec_switch_new running
[ 55] Kills Rarity 0.0.1 wopox1337 KillsRarity.amx debug
[ 56] InName Combo Kills 0.0.2 wopox1337 InName_Combo_Ki running
[ 57] Grab 3.0 DEPO grab.amxx running
[ 58] Bullet Whizz 1.4 Cheap_Suit Bullet_Whizz.am running
[ 59] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 60] Colored Spawn 1.2.2 fezh colored_spawn.a running
[ 61] Ad From Server 1.0 DePO ad_from_server. running
[ 62] Lite Translit 2.8 neygomon lite_translit.a running
[ 63] Map Manager: Core 3.0.5 Mistrick map_manager_cor running
[ 64] Map Manager: Scheduler 0.1.3 Mistrick map_manager_sch running
[ 65] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 66] Map Manager: Nominatio 0.1.2 Mistrick map_manager_nom running
[ 67] Map Manager: BlockList 0.0.3 Mistrick map_manager_blo running
[ 68] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 69] Map Manager: Effects 0.0.9 Mistrick map_manager_eff running
[ 70] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 71] Map Manager: GUI 0.0.4 Mistrick map_manager_gui running
71 plugins, 71 running
Автор плагина
wopox1337
Версия плагина
0.0.1
Исходный код
#include <amxmodx>
#include <reapi>
#include <fakemeta>
#include <xs>

#define IsSuicide(%1,%2) bool:(%1 == %2)
#define IsPlayer(%1) bool:(%1 && %1 <= MAX_PLAYERS)

new bool:g_bDamaged[MAX_PLAYERS + 1][MAX_PLAYERS + 1];

enum _:KillRarity_s (<<=1)
{
kill_NoScope = 1,
kill_AirShot,
kill_OneShot,
kill_Penetrated,
kill_HeadShot
}

public plugin_init()
{
register_plugin("Kills Rarity", "0.0.1", "wopox1337");
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage", .post = true);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", .post = true);
RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound", .post = true);
}

public CBasePlayer_TakeDamage(id, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
if(id == iAttacker || !is_user_connected(iAttacker) || !rg_is_player_can_takedamage(id, iAttacker))
return;

g_bDamaged[iAttacker][id] = true;
}

public CBasePlayer_Killed(id, iKiller, iGib)
{
if(IsSuicide(id, iKiller) || !IsPlayer(iKiller))
return;

_AnnounceToPlayers(iKiller, _Get_RareKill(id, iKiller));
}

public CSGameRules_RestartRound()
{
for(new id = 1; id <= MaxClients; id++)
arrayset(g_bDamaged[id], 0, sizeof g_bDamaged[]);
}

_Get_RareKill(id, iKiller)
{
const DEFAULT_FOV = 90;
#define __GetItem_ID(%1) get_member(get_member(%1, m_pActiveItem), m_iId)

new bitKillRarity;
new bitsActiveItem = 1 << __GetItem_ID(iKiller);

if(get_member(id, m_bHeadshotKilled)) // Headshot kill
{
bitKillRarity |= kill_HeadShot;
}

if(bitsActiveItem & (1 << CSW_HEGRENADE | 1 << CSW_KNIFE)) // HEGrenade or Knife kill
{
return bitKillRarity;
}

if(bitsActiveItem & (1 << CSW_AWP | 1 << CSW_SCOUT | 1 << CSW_G3SG1 | 1 << CSW_SG550)) // Sniper Kill
{
if(get_member(iKiller, m_iClientFOV) == DEFAULT_FOV) // NoScope
{
bitKillRarity |= kill_NoScope;
}
}

static Float:fvecVelocity[3];
get_entvar(iKiller, var_velocity, fvecVelocity);
if(fvecVelocity[2] != 0.0 && (fvecVelocity[2] < -1.0 || fvecVelocity[2] > 1.0)) // JumpShot or AirShot kill (same as !FL_ONGROUND?)
{
bitKillRarity |= kill_AirShot;
}

if(!(bitsActiveItem & (1 << CSW_AWP))
&& !g_bDamaged[iKiller][id]
) // OneShot kill
{
bitKillRarity |= kill_OneShot;
}

if(bIsPenetrated(id, iKiller)) // Wallbang kill
{
bitKillRarity |= kill_Penetrated;
}

return bitKillRarity;
}

_AnnounceToPlayers(iKiller, bitKillRarity)
{
if(!bitKillRarity)
{
return;
}

new szRareKillBuffer[64];

if(bitKillRarity & kill_NoScope) strcat(szRareKillBuffer, "без снайперского прицела ", 100);
if(bitKillRarity & kill_AirShot) strcat(szRareKillBuffer, "в полете ", 100);
if(bitKillRarity & kill_OneShot) strcat(szRareKillBuffer, "с первой пули ", 100);
if(bitKillRarity & kill_Penetrated) strcat(szRareKillBuffer, "прострелом ", 100);
if(bitKillRarity & kill_HeadShot) strcat(szRareKillBuffer, "в голову ", 100); // Don't need it!?

trim(szRareKillBuffer);

client_print_color(0, print_team_red, "%n совершил убийство из AWP ^3%s^1", iKiller, szRareKillBuffer);
}

stock bool:bIsPenetrated(id, iKiller)
{
static hTrace;
if(!hTrace)
hTrace = create_tr2();

static Float:vfOrigin_Killer[3], Float:vfViewOfs[3];
get_entvar(iKiller, var_origin, vfOrigin_Killer);
get_entvar(iKiller, var_view_ofs, vfViewOfs);
xs_vec_add(vfOrigin_Killer, vfViewOfs, vfOrigin_Killer);

static Float:vfOrigin[3];
get_entvar(id, var_origin, vfOrigin);
get_entvar(id, var_view_ofs, vfViewOfs);
xs_vec_add(vfOrigin, vfViewOfs, vfOrigin);

engfunc(EngFunc_TraceLine, vfOrigin_Killer, vfOrigin, IGNORE_MONSTERS | IGNORE_GLASS, 0, hTrace);

static Float:fFraction;
get_tr2(hTrace, TR_flFraction, fFraction);

return bool:(fFraction != 1.0);
}
Просьба помочь с ошибками!
 
В этой теме было размещено решение! Перейти к решению.

RockTheStreet

Саппорт года
Сообщения
1,743
Реакции
344
Помог
40 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
memory access
 
Сообщения
67
Реакции
1
Помог
1 раз(а)
Вот оригинальный код плагина.

C++:
#include <amxmodx>
#include <reapi>
#include <fakemeta>
#include <xs>

#define IsSuicide(%1,%2)    bool:(%1 == %2)
#define IsPlayer(%1)        bool:(%1 && %1 <= MAX_PLAYERS)

new bool:g_bDamaged[MAX_PLAYERS + 1][MAX_PLAYERS + 1];

enum _:KillRarity_s (<<=1)
{
    kill_NoScope = 1,
    kill_AirShot,
    kill_OneShot,
    kill_Penetrated,
    kill_HeadShot
}

public plugin_init()
{
    register_plugin("Kills Rarity", "0.0.1", "wopox1337");
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage", .post = true);
    RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", .post = true);
    RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound", .post = true);
}

public CBasePlayer_TakeDamage(id, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
    if(id == iAttacker || !is_user_connected(iAttacker) || !rg_is_player_can_takedamage(id, iAttacker))
        return;

    g_bDamaged[iAttacker][id] = true;
}

public CBasePlayer_Killed(id, iKiller, iGib)
{
    if(IsSuicide(id, iKiller) || !IsPlayer(iKiller))
        return;

    _AnnounceToPlayers(iKiller, _Get_RareKill(id, iKiller));
}

public CSGameRules_RestartRound()
{
    for(new id = 1; id <= MaxClients; id++)
        arrayset(g_bDamaged[id], 0, sizeof g_bDamaged[]);
}

_Get_RareKill(id, iKiller)
{
    const DEFAULT_FOV = 90;
    #define __GetItem_ID(%1)     get_member(get_member(%1, m_pActiveItem), m_iId)

    new bitKillRarity;
    new bitsActiveItem = 1 << __GetItem_ID(iKiller);

    if(get_member(id, m_bHeadshotKilled)) // Headshot kill
    {
        bitKillRarity |= kill_HeadShot;
    }

    if(bitsActiveItem & (1 << CSW_HEGRENADE | 1 << CSW_KNIFE)) // HEGrenade or Knife kill
    {
        return bitKillRarity;
    }

    if(bitsActiveItem & (1 << CSW_AWP | 1 << CSW_SCOUT | 1 << CSW_G3SG1 | 1 << CSW_SG550)) // Sniper Kill
    {
        if(get_member(iKiller, m_iClientFOV) == DEFAULT_FOV) // NoScope
        {
            bitKillRarity |= kill_NoScope;
        }
    }

    static Float:fvecVelocity[3];
    get_entvar(iKiller, var_velocity, fvecVelocity);
    if(fvecVelocity[2] != 0.0 && (fvecVelocity[2] < -1.0 || fvecVelocity[2] > 1.0)) // JumpShot or AirShot kill (same as !FL_ONGROUND?)
    {
        bitKillRarity |= kill_AirShot;
    }

    if(!(bitsActiveItem & (1 << CSW_AWP))
    && !g_bDamaged[iKiller][id]
    ) // OneShot kill
    {
        bitKillRarity |= kill_OneShot;
    }

    if(bIsPenetrated(id, iKiller)) // Wallbang kill
    {
        bitKillRarity |= kill_Penetrated;
    }

    return bitKillRarity;
}

_AnnounceToPlayers(iKiller, bitKillRarity)
{
    if(!bitKillRarity)
    {
        return;
    }

    new szRareKillBuffer[64];

    if(bitKillRarity & kill_NoScope)        strcat(szRareKillBuffer, "NoScope ",    16);
    if(bitKillRarity & kill_AirShot)        strcat(szRareKillBuffer, "AirShot ",    16);
    if(bitKillRarity & kill_OneShot)        strcat(szRareKillBuffer, "OneShot ",    16);
    if(bitKillRarity & kill_Penetrated)        strcat(szRareKillBuffer, "Wallbang ",    16);
    // if(bitKillRarity & kill_HeadShot)        strcat(szRareKillBuffer, "Headshot ",    16); // Don't need it!?

    trim(szRareKillBuffer);

    client_print_color(0, print_team_red, "Игрок %n совершил необычное убийство! (^3%s^1)", iKiller, szRareKillBuffer);
}

stock bool:bIsPenetrated(id, iKiller)
{
    static hTrace;
    if(!hTrace)
        hTrace = create_tr2();

    static Float:vfOrigin_Killer[3], Float:vfViewOfs[3];
    get_entvar(iKiller, var_origin, vfOrigin_Killer);
    get_entvar(iKiller, var_view_ofs, vfViewOfs);
    xs_vec_add(vfOrigin_Killer, vfViewOfs, vfOrigin_Killer);

    static Float:vfOrigin[3];
    get_entvar(id, var_origin, vfOrigin);
    get_entvar(id, var_view_ofs, vfViewOfs);
    xs_vec_add(vfOrigin, vfViewOfs, vfOrigin);
   
    engfunc(EngFunc_TraceLine, vfOrigin_Killer, vfOrigin, IGNORE_MONSTERS | IGNORE_GLASS, 0, hTrace);
   
    static Float:fFraction;
    get_tr2(hTrace, TR_flFraction, fFraction);

    return bool:(fFraction != 1.0);
}
12 Мар 2020
А что сделать надо? Я не совсем понял.
 
Сообщения
58
Реакции
2
Помог
2 раз(а)
client_print_color(0, print_team_red, "Игрок %n совершил необычное убийство! (^3%s^1)", iKiller, szRareKillBuffer);
Попробуй так чтоль
client_print_color(0, print_team_red, "Игрок %i совершил необычное убийство! (^3%s^1)", iKiller, szRareKillBuffer);
 
Сообщения
67
Реакции
1
Помог
1 раз(а)
pro100iweb,
Всё из лога, далее только повторение
Код:
L 03/12/2020 - 17:31:34: Start of error session.
L 03/12/2020 - 17:31:34: Info (map "awp_india") (file "addons/amxmodx/logs/error_20200312.log")
L 03/12/2020 - 17:31:34: Client index 179 is invalid
L 03/12/2020 - 17:31:34: [AMXX] Displaying debug trace (plugin "KillsRarity.amxx", version "0.0.1")
L 03/12/2020 - 17:31:34: [AMXX] Run time error 10: native error (native "client_print_color")
L 03/12/2020 - 17:31:34: [AMXX]    [0] KillsRarity.sma::_AnnounceToPlayers (line 115)
L 03/12/2020 - 17:31:34: [AMXX]    [1] KillsRarity.sma::CBasePlayer_Killed (line 41)
 
Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
Попробуй так чтоль
client_print_color(0, print_team_red, "Игрок %i совершил необычное убийство! (^3%s^1)", iKiller, szRareKillBuffer);
И что получишь-то в итоге использовав %i ?!)))
Спецификатор формата %n там не от балды стоит. (https://github.com/alliedmodders/amxmodx/pull/93)
13 Мар 2020
newcs, ну вот же
Client index 179 is invalid
Сделай проверку
if( 1<= id <= 32 )
Уже есть на 38 строке проверка. Держу в курсе.
 
Сообщения
67
Реакции
1
Помог
1 раз(а)
Minni, вот и я посмотрел только что... А в чем проблема тогда?
 
Сообщения
58
Реакции
2
Помог
2 раз(а)
newcs, тогда alive и connected проверяй :))) С такой ошибкой не сталкивался просто

Minni, на код как то не смотрел, что то не подумал об этом
 
Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
newcs, у тебя размерность массива для записи строки 64 байта, а при записи у тебя указано 100.
14 Мар 2020
Замени везде 100 на charsmax(szRareKillBuffer) и саму размерность увеличь раза в 2, поскольку юзаешь кириллицу, да и ники могут быть длинные и так же на кириллице.
 
Последнее редактирование:

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

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