How To track Weapon In reapi

Soumyadip Dutta

Пользователь
Регистрация
5 Сен 2017
Сообщения
9
Симпатии
0
Пол
Мужской
#1
I want to know how we can get know about killer weapon name and check in any if else condition help me please
 

Soumyadip Dutta

Пользователь
Регистрация
5 Сен 2017
Сообщения
9
Симпатии
0
Пол
Мужской
#3
Siridont got reapi weapon hook they used Weapon == CSW_KNIFE and new Weapon = get_user_weapon(Attacker) i want same but with reapi
 

Vaqtincha

Разработчик
Регистрация
28 Янв 2018
Сообщения
376
Симпатии
211
#4
C++:
#include <amxmodx>
#include <reapi>

public plugin_init()
{
    RegisterHookChain(RG_CSGameRules_DeathNotice, "CSGameRules_DeathNotice", .post = true)
}

public CSGameRules_DeathNotice(const pVictim, const pKiller, pInflictor)
{
    if (pVictim == pKiller || !is_user_connected(pKiller))
    {
        return HC_CONTINUE
    }

    new szWeaponName[32]
   
    if (pKiller == pInflictor)
    {
        pInflictor = get_member(pKiller, m_pActiveItem)
    }
   
    if (is_nullent(pInflictor))
    {
        return HC_CONTINUE
    }
   
    get_entvar(pInflictor, var_classname, szWeaponName, charsmax(szWeaponName))  

    if (szWeaponName[0] == 'g' && szWeaponName[6] == 'e') // grenade
    {
        server_print("WEAPON: %s | WEAPON ID: %d | HEADSHOT: NO", szWeaponName, WEAPON_HEGRENADE)
    }
    else
    {
        server_print("WEAPON: %s | WEAPON ID: %d | HEADSHOT: %s",
        szWeaponName[7], get_member(pInflictor, m_iId), get_member(pVictim, m_bHeadshotKilled) ? "YES" : "NO")
    }

    return HC_CONTINUE
}