Raised This Month: $ Target: $400
 0% 

How do I get when 2 players were stabbed at the same time?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-10-2009 , 09:16   How do I get when 2 players were stabbed at the same time?
Reply With Quote #1

How do I get when 2 players were stabbed at the same time?
__________________
alan_el_more is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-10-2009 , 09:21   Re: How do I get when 2 players were stabbed at the same time?
Reply With Quote #2

TakeDamage, get_gametime()

EDIT: Hai bugsy
__________________
xPaw is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-10-2009 , 09:21   Re: How do I get when 2 players were stabbed at the same time?
Reply With Quote #3

Check get_gametime() and weapons at ham_takedamage

Edit: xPaw FTW
__________________

Last edited by Bugsy; 06-10-2009 at 09:24.
Bugsy is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-10-2009 , 09:25   Re: How do I get when 2 players were stabbed at the same time?
Reply With Quote #4

how?
__________________
alan_el_more is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-10-2009 , 09:42   Re: How do I get when 2 players were stabbed at the same time?
Reply With Quote #5

Untested

Edit: You will probably get no results with the previous code since the time value is float [25.31] and it is very unlikely that two numbers will ever be identical. I edited the code to allow you to specify if the knife attacks happened within g_fKnifeTime seconds from one another then it is considered the same time. Default is 1 second

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "Detect knife at same time"
#define VERSION "1.0"
#define AUTHOR "bugsy"

new Floatg_fKnifeAttacked[33];
new 
g_iMaxPlayers;

const 
Floatg_fKnifeTime 1.0;

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" )
    
    
g_iMaxPlayers get_maxplayers();
}

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iBitDamage )
{
    static 
i;
    
    if ( 
IsPlayeriAttacker ) && ( get_user_weaponiAttacker ) == CSW_KNIFE ) )
    {
        
g_fKnifeAttackediVictim ] = get_gametime();
        
        for ( 
<= g_iMaxPlayers i++ )
            if ( ( 
!= iVictim ) && g_fKnifeAttacked] && ( floatabsg_fKnifeAttacked] - g_fKnifeAttackediVictim ] ) <= g_fKnifeTime ) )
                
client_printiVictim print_chat "Knifed at same time as player id - %d" );
    }

__________________

Last edited by Bugsy; 06-10-2009 at 10:06.
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-10-2009 , 10:06   Re: How do I get when 2 players were stabbed at the same time?
Reply With Quote #6

Edited above code
__________________
Bugsy 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 13:54.


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