Raised This Month: $32 Target: $400
 8% 

[HowTo] Properly catch shot event in CS


Post New Thread Reply   
 
Thread Tools Display Modes
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 06-10-2013 , 15:37   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #61

This doesnt detect a usp with a silincer on.
Can this be done? to detect
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-10-2013 , 16:35   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #62

This detects silenced weapons shots.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 06-10-2013 , 17:16   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #63

Quote:
Originally Posted by ConnorMcLeod View Post
This detects silenced weapons shots.
Nope this doesnt detect silence USP

I have tested without silencer and it worked perfect.
But With silencer it doesnt work
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-10-2013 , 19:26   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #64

With/out silencer is unrelated. The event sent is the same. The problem is either your code or how you test.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-01-2015 , 19:24   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #65

By request from another forum member, I added the ability to get the CSW_ weapon index of the fired weapon. Not sure if this is the best way to capture weapon fire anymore, but thought I'd share.
PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_fwid g_max_clients g_guns_eventids_bitsum;

new const 
g_guns_events[][] = 
{
    
"events/awp.sc""events/g3sg1.sc""events/ak47.sc""events/scout.sc""events/m249.sc",
    
"events/m4a1.sc""events/sg552.sc""events/aug.sc""events/sg550.sc""events/m3.sc",
    
"events/xm1014.sc""events/usp.sc""events/mac10.sc""events/ump45.sc""events/fiveseven.sc",
    
"events/p90.sc""events/deagle.sc""events/p228.sc""events/glock18.sc""events/mp5n.sc",
    
"events/tmp.sc""events/elite_left.sc""events/elite_right.sc""events/galil.sc""events/famas.sc"
};

new const 
g_guns_weaponid[] =
{
    
0CSW_AWPCSW_G3SG1CSW_AK47CSW_SCOUTCSW_M249CSW_M4A1CSW_SG552CSW_AUGCSW_SG550,
    
CSW_M3CSW_XM1014CSW_USPCSW_MAC10CSW_UMP45CSW_FIVESEVENCSW_P90CSW_DEAGLE,
    
CSW_P2280CSW_GLOCK18CSW_MP5NAVY0CSW_ELITECSW_ELITE00CSW_GALILCSW_FAMAS
};

public 
plugin_precache() 
{
    
g_fwid register_forwardFM_PrecacheEvent "fwPrecacheEvent" true );
}

public 
fwPrecacheEventtype , const name[] ) 
{
    for ( new 
sizeofg_guns_events ) ; ++
    {
        if ( 
equalg_guns_events] , name ) ) 
        {
            
g_guns_eventids_bitsum |= ( << get_orig_retval() );
            return 
FMRES_HANDLED;
        }
    }
    
    return 
FMRES_IGNORED;
}

public 
plugin_init() 
{
    
unregister_forwardFM_PrecacheEvent g_fwid true );
    
register_forwardFM_PlaybackEvent "fwPlaybackEvent" );
    
    
g_max_clients global_getglb_maxClients );
}

public 
fwPlaybackEventflags invoker eventid )
 {
    if ( !( 
g_guns_eventids_bitsum & ( << eventid ) ) || !( <= invoker <= g_max_clients ) )
        return 
FMRES_IGNORED;

    
//Player fired weapon. WeaponID is stored in g_guns_weaponid[ eventid ]
    
    
new szWeapon20 ];
    
get_weaponnameg_guns_weaponideventid ] , szWeapon charsmaxszWeapon ) );
    
client_printinvoker print_chat "You fired %s" szWeapon );
    
    return 
FMRES_HANDLED;

__________________
Bugsy is offline
waza123a
Member
Join Date: Mar 2010
Old 03-14-2016 , 13:54   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #66

Why this code does not have grenade event ? How to add it ?
__________________
Life is good, sometimes...
waza123a is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-14-2016 , 14:16   Re: [HowTo] Properly catch shot event in CS
Reply With Quote #67

There's grenade_throw forward provided by CSX.
klippy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode