View Single Post
SVC
Junior Member
Join Date: Mar 2021
Old 04-04-2023 , 20:16   Re: [TUT] Properly Detect Weapon Shot (Every Shot)
Reply With Quote #6

I'm from phone now.

But, his is not enough?
PHP Code:

new g_iShots[33]


public 
plugin_init()
{
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_x","OnWeapon_PrimaryAttack_Post"true)
    
    
register_clcmd("shoots_count""OnClientCommand_ShootsCount")
}

public 
OnWeapon_PrimaryAttack_Post(const iWeapon)
{
    new 
iOwner //get weapon owner...
    
    // get m_fFireOnEmpty offset value
    
if (!m_fFireOnEmpty)
       
g_iShots[iOwner]++
}

public 
OnClientCommand_ShootsCount(const iPlayer)
{
    print(
"shoots count: %d"g_iShots[iPlayer])

Of course, is a concept, because I'm writting from phone now, and I dont remember the natives to get entity's CBase offets values. But I thinks code is understandable.

Reference: clickme

Sorry for my english

Last edited by SVC; 04-04-2023 at 20:21.
SVC is offline