next21 kill assist

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
270
Реакции
43
Помог
5 раз(а)
Ошибка
L 02/16/2020 - 01:42:21: Start of error session.
L 02/16/2020 - 01:42:21: Info (map "de_dust2x2") (file "addons/amxmodx/logs/error_20200216.log")
L 02/16/2020 - 01:42:21: [ReAPI] rh_update_user_info: player 3 is not connected
L 02/16/2020 - 01:42:21: [AMXX] Displaying debug trace (plugin "next21_kill_assist.amxx", version "1.1")
L 02/16/2020 - 01:42:21: [AMXX] Run time error 10: native error (native "rh_update_user_info")
L 02/16/2020 - 01:42:21: [AMXX] [0] next21_kill_assist.sma::CBasePlayer_Killed_Pre (line 194)
ОС
Linux
Amx Mod X
AMX Mod X 1.10.0.5384
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: May 16 2019, 05:57:03
URL:http://www.amxmodx.org/
Билд
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.453-dev+m
Build date: 11:19:05 Feb 14 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/8c82c62
Версия 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
Список метамодулей
[ 1] Reunion               RUN   -    reunion_mm_i386.so          v0.1.0.135       ini  Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.10.0.5384 ini Start ANY
[ 3] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 5] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 6] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 8] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC4 ini ANY ANY
[ 9] Ultimate Unprecacher RUN - unprecacher_i386.so vBeta 2.5.3 ini Chlvl Chlvl
[10] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl2 ANY Never
[11] MySQL RUN - mysql_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[14] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl2 ANY Never
[15] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[16] CSX RUN - csx_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[17] Engine RUN - engine_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
[18] Fun RUN - fun_amxx_i386.so v1.10.0.5384 pl2 ANY ANY
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Loader 3.5 neygomon admin_loader_3_ running
[ 2] FreshBans 1.4.3b kanagava fresh_bans_143_ running
[ 3] Ban Sound: Fresh Bans 1.1 Leo_[BH] fb_ban_sound_fi running
[ 4] DopBan 3.0.3b kanagava dop_ban303_.amx running
[ 5] fb_forwards 0.3 kanagava + Spiel fb_fowards.amxx debug
[ 6] Fake Ping 1.1 MeRcyLeZZ/gyxoBk FakePing.amxx running
[ 7] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 8] Ultimate Chats Control 5.2(c) neygomon ucc2.amxx running
[ 9] Advert Messages 1.22 neygomon adverts.amxx running
[ 10] Anti DD Scroll Test Test Anti_Scroll.amx running
[ 11] Admin Commands 1.10.0.525 AMXX Dev Team admincmd.amxx running
[ 12] Multi-Lingual System 1.10.0.525 AMXX Dev Team multilingual.am running
[ 13] Menus Front-End 1.9.0.5232 AMXX Dev Team menufrontv2_cli running
[ 14] Commands Menu 1.10.0.525 AMXX Dev Team cmdmenu.amxx running
[ 15] Players Menu 1.10.0.525 AMXX Dev Team plmenu.amxx running
[ 16] Maps Menu 1.10.0.525 AMXX Dev Team mapsmenu.amxx running
[ 17] Admin Chat 1.10.0.525 AMXX Dev Team adminchat.amxx running
[ 18] Anti Flood 1.10.0.525 AMXX Dev Team antiflood.amxx running
[ 19] Admin Votes 1.10.0.525 AMXX Dev Team adminvote.amxx running
[ 20] Stats Configuration 1.10.0.525 AMXX Dev Team statscfg.amxx running
[ 21] HLstatsX CE Ingame Plu 1.6.19 (HL psychonic hlstatsx_comman running
[ 22] Advanced Kill Assists 1.1 Xelson next21_kill_ass debug

22 plugins, 22 running
Автор плагина
Xelson
Версия плагина
1.1
Исходный код
#include <amxmodx>
#include <reapi>

#define FRAGS_FOR_ASSIST /* Объявите, чтобы игроку, оказавшему помощь в убийстве, зачислялся фраг. */
#define MONEY_FOR_ASSIST 100 /* Сколько денег платить игроку, совершившему помощь в убийстве. Оплата произойдет только если указано значение больше нуля. */
#define DAMAGE_FOR_ASSIST 30.0

#define ASSIST_ALGORITHM ADVANCED /* Алгоритм для определения помощников в убийтве. По-умолчанию используется ADVANCED.
CSSTATSX — эквивалентный CSstatsX алгоритм учёта помощи по убийствам с использованием соответствующего квара. Алгоритм выбирает такого игрока, который
нанес больше всего ущерба жертве и не менее допустимого значения, определяемое кваром csstats_sql_assisthp из CSstatsX либо параметром DAMAGE_FOR_ASSIST.
Если CSstatsX не установлен, то для просчётов используется значение DAMAGE_FOR_ASSIST.
ADVANCED — улучшенная и более справедливая формула, которая выбирает из ряда других ассистентов такого, кто больше всего нанес урона
жертве и чей процент урона от общего ущерба от всех составляет не менее DAMAGE_FOR_ASSIST процентов. Этот алгоритм не синхронизируется
с CSstatsX, что может повлечь к неучёту их в статистике. */

#define NAMES_LENGTH 28
#define is_user_valid(%0) (0 < %0 && %0 < g_iMaxPlayers)

#if AMXX_VERSION_NUM < 183
#define client_disconnected client_disconnect
#endif

#if REAPI_VERSION < 52121
#error This plugin supports ReAPI >=5.2.0.121
#endif

//#define DEBUG

enum
{
CSSTATSX,
ADVANCED
}

enum _:PLAYER_DATA
{
CONNECTED,
DAMAGE_ON[33],
Float:DAMAGE_ON_TIME[33],
NAME[32]
}
new g_ePlayerData[33][PLAYER_DATA], g_iMaxPlayers, g_iMsgScoreInfo
new HookChain:g_pSV_WriteFullClientUpdate, HookChain:g_pCBasePlayer_Killed_Post, g_szDeathString[32], g_iAssistKiller

#if ASSIST_ALGORITHM == CSSTATSX
new g_pCvarAssistHp
#endif

public plugin_init()
{
register_plugin("Advanced Kill Assists", "1.1", "Xelson")

RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true)
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Pre", false)
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage_Pre", false)
DisableHookChain((g_pCBasePlayer_Killed_Post = RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true)))
DisableHookChain((g_pSV_WriteFullClientUpdate = RegisterHookChain(RH_SV_WriteFullClientUpdate, "SV_WriteFullClientUpdate", false)))
register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg")

#if defined DEBUG
register_clcmd("assist", "ClCmd_Assist")
#endif

#if ASSIST_ALGORITHM == CSSTATSX
g_pCvarAssistHp = get_cvar_pointer("csstats_sql_assisthp")
#endif

g_iMsgScoreInfo = get_user_msgid("ScoreInfo")
g_iMaxPlayers = get_maxplayers() + 1
}

public client_infochanged(id)
{
get_user_info(id, "name", g_ePlayerData[id][NAME], charsmax(g_ePlayerData[][NAME]))
}

public client_putinserver(id)
{
g_ePlayerData[id][CONNECTED] = true
}

public client_disconnected(id)
{
g_ePlayerData[id][CONNECTED] = false
arrayset(g_ePlayerData[id][DAMAGE_ON], 0, sizeof g_ePlayerData[][DAMAGE_ON])
}

public CBasePlayer_Spawn_Post(id)
{
arrayset(g_ePlayerData[id][DAMAGE_ON], 0, sizeof g_ePlayerData[][DAMAGE_ON])

server_print("%s: frags %d", g_ePlayerData[id][NAME], get_entvar(id, var_frags))
}

public CBasePlayer_TakeDamage_Pre(iVictim, iWeapon, iAttacker, Float:fDamage)
{
if(is_user_valid(iAttacker) && iVictim != iAttacker && rg_is_player_can_takedamage(iVictim, iAttacker))
{
#if ASSIST_ALGORITHM == ADVANCED
new Float:fHealth; get_entvar(iVictim, var_health, fHealth)
if(fDamage > fHealth) fDamage = fHealth
#endif
g_ePlayerData[iAttacker][DAMAGE_ON][iVictim] += floatround(fDamage)
g_ePlayerData[iAttacker][DAMAGE_ON_TIME][iVictim] = get_gametime()
}
}

public CBasePlayer_Killed_Pre(iVictim, iKiller)
{
new iAssistant, iMaxDamage

#if ASSIST_ALGORITHM == ADVANCED
new iTotalDamage
for(new id = 1; id < g_iMaxPlayers; id++)
{
if(g_ePlayerData[id][CONNECTED])
{
if(id != iKiller && g_ePlayerData[id][DAMAGE_ON][iVictim] > 0)
{
if(g_ePlayerData[id][DAMAGE_ON][iVictim] > iMaxDamage)
{
iAssistant = id
iMaxDamage = g_ePlayerData[id][DAMAGE_ON][iVictim]
}
else if(g_ePlayerData[id][DAMAGE_ON][iVictim] == iMaxDamage)
iAssistant = g_ePlayerData[id][DAMAGE_ON_TIME][iVictim] > g_ePlayerData[iAssistant][DAMAGE_ON_TIME][iVictim] ? id : iAssistant
}
iTotalDamage += g_ePlayerData[id][DAMAGE_ON][iVictim]
}
}
if((float(iMaxDamage) / float(iTotalDamage)) * 100.0 < DAMAGE_FOR_ASSIST) iAssistant = 0
#elseif ASSIST_ALGORITHM == CSSTATSX
new iNeedDamage = g_pCvarAssistHp ? get_pcvar_num(g_pCvarAssistHp) : floatround(DAMAGE_FOR_ASSIST)
for(new id = 1; id < g_iMaxPlayers; id++)
{
if(g_ePlayerData[id][CONNECTED] && id != iKiller && g_ePlayerData[id][DAMAGE_ON][iVictim] > iMaxDamage)
{
if(g_ePlayerData[id][DAMAGE_ON][iVictim] > iNeedDamage)
{
iAssistant = id
iMaxDamage = g_ePlayerData[id][DAMAGE_ON][iVictim]
}
else if(g_ePlayerData[id][DAMAGE_ON][iVictim] == iNeedDamage)
iAssistant = g_ePlayerData[id][DAMAGE_ON_TIME][iVictim] > g_ePlayerData[iAssistant][DAMAGE_ON_TIME][iVictim] ? id : iAssistant
}
}
#endif

if(!iAssistant || iKiller == iVictim) return HC_CONTINUE

new szName[2][32], iLen[2], iExcess
copy(szName[1], charsmax(szName[]), g_ePlayerData[iAssistant][NAME])
iLen[1] = strlen(szName[1])

EnableHookChain(g_pSV_WriteFullClientUpdate)

if(!is_user_valid(iKiller) && g_ePlayerData[iAssistant][CONNECTED])
{
static const szWorldName[] = "world"

iExcess = iLen[1] - NAMES_LENGTH - (sizeof szWorldName)
if(iExcess > 0) strclip(szName[1], iExcess)
formatex(g_szDeathString, charsmax(g_szDeathString), "%s + %s", szWorldName, szName[1])

g_iAssistKiller = iAssistant
rh_update_user_info(iAssistant)
}
else
{
g_ePlayerData[iKiller][DAMAGE_ON][iVictim] = 0

copy(szName[0], charsmax(szName[]), g_ePlayerData[iKiller][NAME])
iLen[0] = strlen(szName[0])

new iLenSum = (iLen[0] + iLen[1])
iExcess = iLenSum - NAMES_LENGTH

if(iExcess > 0)
{
new iLongest = iLen[0] > iLen[1] ? 0 : 1
new iShortest = iLongest == 1 ? 0 : 1

if(float(iExcess) / float(iLen[iLongest]) > 0.60)
{
new iNewLongest = floatround(float(iLen[iLongest]) / float(iLenSum) * float(iExcess))
strclip(szName[iLongest], iNewLongest)
strclip(szName[iShortest], iExcess - iNewLongest)
}
else strclip(szName[iLongest], iExcess)
}
formatex(g_szDeathString, charsmax(g_szDeathString), "%s + %s", szName[0], szName[1])

g_iAssistKiller = iKiller
rh_update_user_info(g_iAssistKiller)
}
if(g_ePlayerData[iAssistant][CONNECTED])
{
g_ePlayerData[iAssistant][DAMAGE_ON][iVictim] = 0

#if MONEY_FOR_ASSIST > 0
rg_add_account(iAssistant, MONEY_FOR_ASSIST)
#endif

#if defined FRAGS_FOR_ASSIST
new Float:fNewFrags; get_entvar(iAssistant, var_frags, fNewFrags)
fNewFrags++
set_entvar(iAssistant, var_frags, fNewFrags)

message_begin(MSG_ALL, g_iMsgScoreInfo)
write_byte(iAssistant)
write_short(floatround(fNewFrags))
write_short(get_member(iAssistant, m_iDeaths))
write_short(0)
write_short(get_member(iAssistant, m_iTeam))
message_end()
#endif
}

EnableHookChain(g_pCBasePlayer_Killed_Post)
return HC_CONTINUE
}

public SV_WriteFullClientUpdate(id, pBuffer)
{
if(id == g_iAssistKiller)
set_key_value(pBuffer, "name", g_szDeathString)
}

public Message_DeathMsg()
{
new iWorld = get_msg_arg_int(1)
if(iWorld == 0 && g_iAssistKiller)
set_msg_arg_int(1, ARG_BYTE, g_iAssistKiller)
}

public CBasePlayer_Killed_Post(iVictim, iKiller)
{
DisableHookChain(g_pCBasePlayer_Killed_Post)

new iAssistKiller = g_iAssistKiller; g_iAssistKiller = 0
rh_update_user_info(iAssistKiller)
}

strclip(szString[], iClip, szEnding[] = "..")
{
new iLen = strlen(szString) - 1 - strlen(szEnding) - iClip
format(szString[iLen], iLen, szEnding)
}

#if defined DEBUG
#include <hamsandwich>
public ClCmd_Assist()
{
new id[3], szArg[64]
for(new i; i < 3; i++)
{
read_argv(i + 1, szArg, charsmax(szArg))
id[i] = str_to_num(szArg)
}
g_ePlayerData[id[1]][DAMAGE_ON][id[2]] = 100
ExecuteHamB(Ham_Killed, id[2], id[0], 0)
ExecuteHamB(Ham_CS_RoundRespawn, id[2])
}
#endif
L 02/16/2020 - 01:42:21: Start of error session.
L 02/16/2020 - 01:42:21: Info (map "de_dust2x2") (file "addons/amxmodx/logs/error_20200216.log")
L 02/16/2020 - 01:42:21: [ReAPI] rh_update_user_info: player 3 is not connected
L 02/16/2020 - 01:42:21: [AMXX] Displaying debug trace (plugin "next21_kill_assist.amxx", version "1.1")
L 02/16/2020 - 01:42:21: [AMXX] Run time error 10: native error (native "rh_update_user_info")
L 02/16/2020 - 01:42:21: [AMXX] [0] next21_kill_assist.sma::CBasePlayer_Killed_Pre (line 194)
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
134
Реакции
463
Помог
2 раз(а)
Поробуй новую версию.
Код:
#include <amxmodx>
#include <reapi>

#define ASSIST_ALGORITHM            ADVANCED    /*     Алгоритм для определения помощников в убийтве. По-умолчанию используется ADVANCED.
    CSSTATSX — эквивалентный CSstatsX алгоритм учёта помощи по убийствам с использованием соответствующего квара. Алгоритм выбирает такого игрока, который
нанес больше всего ущерба жертве и не менее допустимого значения, определяемое кваром csstats_sql_assisthp из CSstatsX либо кваром aka_damage.
Если CSstatsX не установлен, то для просчётов используется значение aka_damage.
    ADVANCED — улучшенная и более справедливая формула, которая выбирает из ряда других ассистентов такого, кто больше всего нанес урона
жертве и чей процент урона от общего ущерба от всех составляет не менее aka_damage процентов. Этот алгоритм не синхронизируется
с CSstatsX, что может повлечь к неучёту их в статистике. */

#define NAMES_LENGTH                28
#define is_user_valid(%0)            (0 < %0 && %0 < g_iMaxPlayers)

#if AMXX_VERSION_NUM < 183
    #define client_disconnected client_disconnect
#endif

#if REAPI_VERSION < 52121
    #error This plugin supports ReAPI >=5.2.0.121
#endif

//#define DEBUG

enum
{
    CSSTATSX,
    ADVANCED
}

enum _:CVARS_DATA
{
    CVAR_FRAG,
    CVAR_MONEY,
    CVAR_DAMAGE
}

enum _:PLAYER_DATA
{
    CONNECTED,
    DAMAGE_ON[33],
    Float:DAMAGE_ON_TIME[33],
    NAME[32]
}
new g_ePlayerData[33][PLAYER_DATA], g_pCvars[CVARS_DATA], g_iMaxPlayers, g_iMsgScoreInfo
new HookChain:g_pSV_WriteFullClientUpdate, HookChain:g_pCBasePlayer_Killed_Post, g_szDeathString[32], g_iAssistKiller

#if ASSIST_ALGORITHM == CSSTATSX
    new g_pCvarAssistHp
#endif

public plugin_init()
{
    register_plugin("Advanced Kill Assists", "1.2", "Xelson")

    RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true)
    RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Pre", false)
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage_Pre", false)
    DisableHookChain((g_pCBasePlayer_Killed_Post = RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true)))
    DisableHookChain((g_pSV_WriteFullClientUpdate = RegisterHookChain(RH_SV_WriteFullClientUpdate, "SV_WriteFullClientUpdate", false)))
    register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg")

    #if defined DEBUG
        register_clcmd("assist", "ClCmd_Assist")
    #endif

    #if ASSIST_ALGORITHM == CSSTATSX
        g_pCvarAssistHp = get_cvar_pointer("csstats_sql_assisthp")
    #endif

    g_iMsgScoreInfo = get_user_msgid("ScoreInfo")
    g_iMaxPlayers = get_maxplayers() + 1
}

public plugin_cfg()
{
    g_pCvars[CVAR_FRAG] = register_cvar("aka_frag", "1")
    g_pCvars[CVAR_MONEY] = register_cvar("aka_money", "100")
    g_pCvars[CVAR_DAMAGE] = register_cvar("aka_damage", "30.0")
}

public client_infochanged(id)
{
    get_user_info(id, "name", g_ePlayerData[id][NAME], charsmax(g_ePlayerData[][NAME]))
}

public client_putinserver(id)
{
    g_ePlayerData[id][CONNECTED] = true
}

public client_disconnected(id)
{
    g_ePlayerData[id][CONNECTED] = false
    arrayset(g_ePlayerData[id][DAMAGE_ON], 0, sizeof g_ePlayerData[][DAMAGE_ON])
}

public CBasePlayer_Spawn_Post(id)
{
    arrayset(g_ePlayerData[id][DAMAGE_ON], 0, sizeof g_ePlayerData[][DAMAGE_ON])
}

public CBasePlayer_TakeDamage_Pre(iVictim, iWeapon, iAttacker, Float:fDamage)
{
    if(is_user_valid(iAttacker) && iVictim != iAttacker && rg_is_player_can_takedamage(iVictim, iAttacker))
    {
        #if ASSIST_ALGORITHM == ADVANCED
            new Float:fHealth; get_entvar(iVictim, var_health, fHealth)
            if(fDamage > fHealth) fDamage = fHealth
        #endif
        g_ePlayerData[iAttacker][DAMAGE_ON][iVictim] += floatround(fDamage)
        g_ePlayerData[iAttacker][DAMAGE_ON_TIME][iVictim] = get_gametime()
    }
}

public CBasePlayer_Killed_Pre(iVictim, iKiller)
{
    new iAssistant, iMaxDamage
    new Float:fDamageForAssist = get_pcvar_float(g_pCvars[CVAR_DAMAGE])

    #if ASSIST_ALGORITHM == ADVANCED
        new iTotalDamage
        for(new id = 1; id < g_iMaxPlayers; id++)
        {
            if(g_ePlayerData[id][CONNECTED])
            {
                if(id != iKiller && g_ePlayerData[id][DAMAGE_ON][iVictim] > 0)
                {
                    if(g_ePlayerData[id][DAMAGE_ON][iVictim] > iMaxDamage)
                    {
                        iAssistant = id
                        iMaxDamage = g_ePlayerData[id][DAMAGE_ON][iVictim]
                    }
                    else if(g_ePlayerData[id][DAMAGE_ON][iVictim] == iMaxDamage)
                        iAssistant = g_ePlayerData[id][DAMAGE_ON_TIME][iVictim] > g_ePlayerData[iAssistant][DAMAGE_ON_TIME][iVictim] ? id : iAssistant
                }
                iTotalDamage += g_ePlayerData[id][DAMAGE_ON][iVictim]
            }
        }
        if((float(iMaxDamage) / float(iTotalDamage)) * 100.0 < fDamageForAssist) iAssistant = 0
    #elseif ASSIST_ALGORITHM == CSSTATSX
        new iNeedDamage = g_pCvarAssistHp ? get_pcvar_num(g_pCvarAssistHp) : floatround(fDamageForAssist)
        for(new id = 1; id < g_iMaxPlayers; id++)
        {
            if(g_ePlayerData[id][CONNECTED] && id != iKiller && g_ePlayerData[id][DAMAGE_ON][iVictim] > iMaxDamage)
            {
                if(g_ePlayerData[id][DAMAGE_ON][iVictim] > iNeedDamage)
                {
                    iAssistant = id
                    iMaxDamage = g_ePlayerData[id][DAMAGE_ON][iVictim]
                }
                else if(g_ePlayerData[id][DAMAGE_ON][iVictim] == iNeedDamage)
                    iAssistant = g_ePlayerData[id][DAMAGE_ON_TIME][iVictim] > g_ePlayerData[iAssistant][DAMAGE_ON_TIME][iVictim] ? id : iAssistant
            }
        }
    #endif

    if(!iAssistant || iKiller == iVictim) return HC_CONTINUE

    new szName[2][32], iLen[2], iExcess
    copy(szName[1], charsmax(szName[]), g_ePlayerData[iAssistant][NAME])
    iLen[1] = strlen(szName[1])

    EnableHookChain(g_pSV_WriteFullClientUpdate)
    
    if(!is_user_valid(iKiller) && g_ePlayerData[iAssistant][CONNECTED])
    {
        static const szWorldName[] = "world"

        iExcess = iLen[1] - NAMES_LENGTH - (sizeof szWorldName)
        if(iExcess > 0) strclip(szName[1], iExcess)
        formatex(g_szDeathString, charsmax(g_szDeathString), "%s + %s", szWorldName, szName[1])

        g_iAssistKiller = iAssistant
        rh_update_user_info(iAssistant)
    }
    else
    {
        g_ePlayerData[iKiller][DAMAGE_ON][iVictim] = 0
        
        copy(szName[0], charsmax(szName[]), g_ePlayerData[iKiller][NAME])
        iLen[0] = strlen(szName[0])

        new iLenSum = (iLen[0] + iLen[1])
        iExcess = iLenSum - NAMES_LENGTH

        if(iExcess > 0)
        {
            new iLongest = iLen[0] > iLen[1] ? 0 : 1
            new iShortest = iLongest == 1 ? 0 : 1

            if(float(iExcess) / float(iLen[iLongest]) > 0.60)
            {
                new iNewLongest = floatround(float(iLen[iLongest]) / float(iLenSum) * float(iExcess))
                strclip(szName[iLongest], iNewLongest)
                strclip(szName[iShortest], iExcess - iNewLongest)
            }
            else strclip(szName[iLongest], iExcess)
        }
        formatex(g_szDeathString, charsmax(g_szDeathString), "%s + %s", szName[0], szName[1])

        g_iAssistKiller = iKiller
        rh_update_user_info(g_iAssistKiller)
    }
    if(g_ePlayerData[iAssistant][CONNECTED])
    {   
        g_ePlayerData[iAssistant][DAMAGE_ON][iVictim] = 0

        new iAddMoney = get_pcvar_num(g_pCvars[CVAR_MONEY])
        if(iAddMoney > 0) rg_add_account(iAssistant, iAddMoney)

        if(get_pcvar_num(g_pCvars[CVAR_FRAG]))
        {
            new Float:fNewFrags; get_entvar(iAssistant, var_frags, fNewFrags)
            fNewFrags++
            set_entvar(iAssistant, var_frags, fNewFrags)

            message_begin(MSG_ALL, g_iMsgScoreInfo)
            write_byte(iAssistant)
            write_short(floatround(fNewFrags))
            write_short(get_member(iAssistant, m_iDeaths))
            write_short(0)
            write_short(get_member(iAssistant, m_iTeam))
            message_end()
        }
    }

    EnableHookChain(g_pCBasePlayer_Killed_Post)
    return HC_CONTINUE
}

public SV_WriteFullClientUpdate(id, pBuffer)
{
    if(id == g_iAssistKiller)
        set_key_value(pBuffer, "name", g_szDeathString)
}

public Message_DeathMsg()
{
    new iWorld = get_msg_arg_int(1)
    if(iWorld == 0 && g_iAssistKiller)
        set_msg_arg_int(1, ARG_BYTE, g_iAssistKiller)
}

public CBasePlayer_Killed_Post(iVictim, iKiller)
{
    DisableHookChain(g_pCBasePlayer_Killed_Post)

    new iAssistKiller = g_iAssistKiller; g_iAssistKiller = 0
    rh_update_user_info(iAssistKiller)
}

strclip(szString[], iClip, szEnding[] = "..")
{
    new iLen = strlen(szString) - 1 - strlen(szEnding) - iClip
    format(szString[iLen], iLen, szEnding)
}

#if defined DEBUG
#include <hamsandwich>
public ClCmd_Assist()
{
    new id[4], szArg[64]
    for(new i; i < 4; i++)
    {
        read_argv(i + 1, szArg, charsmax(szArg))
        id[i] = str_to_num(szArg)
    }
    g_ePlayerData[id[1]][DAMAGE_ON][id[2]] = id[3] ? id[3] : 100
    ExecuteHamB(Ham_Killed, id[2], id[0], 0)
    ExecuteHamB(Ham_CS_RoundRespawn, id[2])
}
#endif
https://next21.ru/2020/01/advanced-kill-assists/
 
Сообщения
270
Реакции
43
Помог
5 раз(а)
medusa,
Настройки FRAGS_FOR_ASSIST, MONEY_FOR_ASSIST, DAMAGE_FOR_ASSIST перенесены в квары

anyway :)
L 02/21/2020 - 15:48:13: Info (map "de_italy") (file "addons/amxmodx/logs/error_20200221.log")
L 02/21/2020 - 15:48:13: [ReAPI] rh_update_user_info: player 9 is not connected
L 02/21/2020 - 15:48:13: [AMXX] Displaying debug trace (plugin "next21_kill_assist.amxx", version "1.2")
L 02/21/2020 - 15:48:13: [AMXX] Run time error 10: native error (native "rh_update_user_info")
L 02/21/2020 - 15:48:13: [AMXX] [0] next21_kill_assist.sma::CBasePlayer_Killed_Pre (line 203)
 
Статус
В этой теме нельзя размещать новые ответы.

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

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