Raised This Month: $ Target: $400
 0% 

what best method detect double kill ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fantastiko
BANNED
Join Date: Feb 2013
Old 11-23-2013 , 13:02   what best method detect double kill ?
Reply With Quote #1

what best method detect double kill ?
with ham killed

i can't search forum this !

Last edited by ConnorMcLeod; 11-24-2013 at 04:22. Reason: bring back original post
fantastiko is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 11-23-2013 , 14:20   Re: what best method detect double kill ?
Reply With Quote #2

PHP Code:
new g_hasKilledTimer[33]

ham_killed(...)
{
   if(
g_hasKilledTimer[attacker])
   {
      
g_hasKilledTimer[attacker] = false

      
// *********************
      // attacker did a double kill
      // add actions here
      // *********************
   
}
   else
   {
      
g_hasKilledTimer[attacker] = true
      set_task
(5.0"resetTimer"attacker)
   }
}

public 
resetTimer(id)
{
     
g_hasKilledTimer[id] = false

Like this you could detect a doublekill in 5.0 seconds. Make sure you validate the attacker and the victim in ham_killed...
mottzi is offline
Send a message via MSN to mottzi
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 11-23-2013 , 17:43   Re: what best method detect double kill ?
Reply With Quote #3

Instead of using set_task, get_systime() would be easier and more efficient
akcaliberg is offline
Pastout
Senior Member
Join Date: Dec 2010
Location: 1337 Street LeetTown
Old 11-23-2013 , 21:38   Re: what best method detect double kill ?
Reply With Quote #4

If this is what you mean by double kill then this is what you want. This will detect if player has killed 2 or more players with one bullet.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
 
#define VERSION "1.0"
 
new g_iMaxPlayers
#define FIRST_PLAYER_ID 1
#define IsPlayer(%1) ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )
 
#define GetBit(%1,%2)       ( %1 &   1 << ( %2 & 31 ) )
#define SetBit(%1,%2)       ( %1 |=  ( 1 << ( %2 & 31 ) ) )
#define DelBit(%1,%2)       ( %1 &= ~( 1 << ( %2 & 31 ) ) )
 
const MAX_PLAYERS 32
 
new is_Aliveis_ConnectediKillerShot
new g_iGunEvent_IDsBitsumg_fwid
new g_iShotKillsMAX_PLAYERS ]
 
//Cvar
new g_pCvar_Enabled
 
new const g_iGunEvents[][] = {
    
"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"
}
 
public 
plugin_init() {
    
register_plugin"Bullet Kill"VERSION"Pastout!" )
    
    
g_pCvar_Enabled register_cvar("bulletkill_enable""1")// 1 = on || 0 = off
    
if ( !get_pcvar_numg_pCvar_Enabled ) )
        return;
    
    
g_iMaxPlayers get_maxplayers( )
    
    new 
g_szPlayer[] = "player"
    
RegisterHamHam_Spawng_szPlayer"Ham_CBasePlayer_Spawn", .Post true )
    
RegisterHamHam_Killedg_szPlayer"Ham_CBasePlayer_Killed", .Post true )
    
RegisterHamHam_TraceAttackg_szPlayer"Ham_CBasePlayer_TraceAttack", .Post false )
    
    
unregister_forwardFM_PrecacheEventg_fwid)
    
register_forwardFM_PlaybackEvent"Fwd_Playback_Event" )
}
 
public 
plugin_unpause() {
    
is_Connected 0;
    
is_Alive 0;
    static 
iPlayers32 ], iNumiPlayer
    get_players
iPlayersiNum"ch" )
    
    for( new 
0iNumi++ ) 
    {
        
iPlayer iPlayers]
        
SetBitis_ConnectediPlayer 
        if( 
is_user_aliveiPlayer ) )
        {
            
SetBitis_AliveiPlayer )
        }
    }
}
 
public 
plugin_precache()
    
g_fwid register_forwardFM_PrecacheEvent"Fwd_Precache_Event")
 
public 
Fwd_Precache_Eventtype, const name[] ) {
    for( new 
0sizeof g_iGunEvents; ++) {
        if( 
equalg_iGunEvents], name ) ) {
            
g_iGunEvent_IDsBitsum |= ( << get_orig_retval() )
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED
}
 
public 
Fwd_Playback_Eventflagsideventid ) {
    if( !( 
g_iGunEvent_IDsBitsum & ( << eventid ) ) || !IsPlayerid ) )
        return 
FMRES_IGNORED;
        
    
DelBitiKillerShotid )
    
g_iShotKillsid ] = 0
    
return FMRES_HANDLED
}
 
public 
Ham_CBasePlayer_TraceAttackthisiAttackerFloat:damageFloat:direction], traceresultdamagebits ) {
    if( 
GetBitis_ConnectediAttacker ) && GetBitis_AliveiAttacker ) )
    {
        static 
g_iWeapong_iWeapon get_user_weaponiAttacker )
        if( 
g_iWeapon == CSW_KNIFE || g_iWeapon == CSW_HEGRENADE )
        {
            return 
HAM_HANDLED
        
}
        
        
SetBitiKillerShotiAttacker )
    
    }
    return 
HAM_HANDLED
}
 
public 
Ham_CBasePlayer_KillediVictimiKiller ) {
    if( 
GetBitis_AliveiKiller 
    && 
GetBitis_ConnectediVictim 
    && 
GetBitiKillerShotiKiller ) )
    {
        
g_iShotKillsiKiller ]++
        if( 
g_iShotKillsiKiller ] >= )
        {
            new 
szName32 ]; get_user_nameiKillerszNamecharsmaxszName ) );
            
client_print0print_chat"%s killed %d players with one stone"szNameg_iShotKillsiKiller ] ) 
            
g_iShotKillsiKiller ] = 
        
}
    }
}
 
public 
Ham_CBasePlayer_Spawnid ) {
    if( !
is_user_aliveid ) )
        return 
HAM_IGNORED;
    
    
SetBitis_Aliveid )
    
    return 
HAM_IGNORED;
}
 
public 
client_putinserverid ) {
    
SetBitis_Connectedid );
    
DelBitis_Aliveid );
}
 
public 
client_disconnectid ) {
    
DelBitis_Connectedid );
    
DelBitis_Aliveid );

Pastout is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 11-24-2013 , 04:12   Re: fantastiko
Reply With Quote #5

Why did you edit your post and change the title of your thread?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Reply



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 06:28.


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