View Single Post
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 12-06-2019 , 02:53   Re: Detect c4 carrier
Reply With Quote #9

This code working fine but you also need to add code for spawn c4 func and get his id. else its fine.
Thanks @bugsy

Quote:
Originally Posted by Bugsy View Post
Not thoroughly tested
PHP Code:

#include <amxmodx>
#include <hamsandwich>

new g_iPlayerHasC4;

public 
plugin_init() 
{
    
RegisterHamHam_Killed "player" "HamPlayerKilled" );
    
    
register_logevent"LostBomb" "2=Dropped_The_Bomb" );
    
register_logevent"GotBomb" "2=Got_The_Bomb" );
    
register_event"WeapPickup" "GotBomb2" "be" "1=6" );
}

public 
GotBomb()
{
    
g_iPlayerHasC4 get_loguser_index();
}

public 
GotBomb2id )
{
    
g_iPlayerHasC4 id;
}

public 
LostBomb()
{
    if ( 
is_user_aliveget_loguser_index() ) )
    {
        
g_iPlayerHasC4 0;
    }
}

public 
HamPlayerKillediVictim iAttacker )
{
    if ( 
g_iPlayerHasC4 && ( iVictim == g_iPlayerHasC4 ) )
    {
        new 
szCarrierName[32];
        
get_user_nameiVictim szCarrierName charsmaxszCarrierName ) );
    
        
client_printiAttacker print_chat"You just killed a c4 carrier guy (%s)" szCarrierName );
    }
}

get_loguser_index() 
{
    new 
loguser[80], name[32]
    
read_logargv(0loguser79)
    
parse_loguser(logusername31)
    
    return 
get_user_index(name)

__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh