Raised This Month: $ Target: $400
 0% 

How do i get user headshot ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ƒa†es™
Senior Member
Join Date: May 2009
Location: Garena
Old 06-21-2009 , 21:55   Re: How do i get user headshot ?
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
That is a comment, it is letting you know that is the location where you put your code to react when a headshot was made.. as you asked for in your original post.

Here is bomb kill
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
 
new g_iMaxPlayers;
 
#define IsEntity(%1) (%1 > g_iMaxPlayers)
 
public plugin_init() 
{
    
register_plugin"Death by Bomb" "1.0" "bugsy" )
    
RegisterHamHam_Killed "player" "fw_HamKilled" );
 
    
g_iMaxPlayers get_maxplayers();
}
 
public 
fw_HamKillediVictim iKiller iShouldGib )
{
    static 
szKiller[21];
 
    if ( 
IsEntityiKiller ) )
    {
        
peviKiller pev_classname szKiller 20 );
 
        
//env_explosion
        
if ( ( szKiller] == 'e' ) && ( szKiller] == 'v' ) && ( szKiller] == 'x' ) && ( szKiller] == 's' ) )
        {
            
//iVictim was killed by C4 bomb
        
}
    }

I using this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init() {
 
register_plugin("Stats","0.2","Dah-Veeeed")
 
set_task(2.0,"the_main",0,_,_,"b")
 
register_event("Damage","damage_event","b","2!0","3=0","4!0")
 
register_cvar("amx_info","1")
}
new 
damage[33] = 0
public client_putinserver(id) {
 
damage[id] = 0
}
public 
client_disconnect(id) {
 
damage[id] = 0
}
public 
damage_event(id)
{
 new 
attacker get_user_attacker(id)
 new 
dmg read_data(2)
 
 
damage[attacker] += dmg
}

public 
the_main() {
 if(!
get_cvar_num("amx_info")) {
  return 
PLUGIN_HANDLED
 
}
 new 
players[32],num,i
 
new message[200]
 
get_players(players,num)
 for(
0<= numi++)
 {
  new 
id players[i]
  
  if(
is_user_connected(id)) {
   new 
name[33]
   new 
ping
   
new loss
   get_user_name
(id,name,32)
   new 
frags get_user_frags(id)
   new 
deaths get_user_deaths(id)
   
get_user_ping(id,ping,loss)
   
   
set_hudmessage (0,0,2550.010.2906.02.00.10.2)
   
format(message,199," %s ^n Frags: %i ^n Deaths: %i ^n Total Damage: %i ^n Ping: %i",name,frags,deaths,damage,ping)
   
show_hudmessage(id,message
  }
 }
 return 
PLUGIN_CONTINUE

So how it will be ?
__________________
ƒa†es™ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-21-2009 , 11:47   Re: How do i get user headshot ?
Reply With Quote #2

Quote:
Originally Posted by ƒa†es™ View Post
Can i ask something ?

what is this :

// Head Shot was made

Do i have to do something ?
That is where you put your own code which will be called when a headshot was made .. as you requested in your original post.

Here is bomb kill. You can also use this for detecting knife-kill with some modification.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new g_iMaxPlayers;

#define IsEntity(%1) (%1 > g_iMaxPlayers)

public plugin_init() 
{
    
register_plugin"Death by Bomb" "1.0" "bugsy" )
    
RegisterHamHam_Killed "player" "fw_HamKilled" );
    
    
g_iMaxPlayers get_maxplayers();
}

public 
fw_HamKillediVictim iKiller iShouldGib )
{
    static 
szKiller21 ];
    
    if ( 
IsEntityiKiller ) )
    {
        
peviKiller pev_classname szKiller 20 );
        
        
//env_explosion
        
if ( ( szKiller] == 'e' ) && ( szKiller] == 'v' ) && ( szKiller] == 'x' ) && ( szKiller] == 's' ) )
        {
            
//iVictim was killed by C4 bomb
        
}
    }

__________________

Last edited by Bugsy; 06-21-2009 at 11:50.
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-21-2009 , 14:59   Re: How do i get user headshot ?
Reply With Quote #3

Quote:
Originally Posted by hleV
PHP Code:
#include <amxmodx>
 
public plugin_init()
{
        
register_event("Damage""eventDamage""b""2!0""3=0""4!0");
        
register_event("DeathMsg""eventDeathMsg""a""1>0");
}
 
public 
eventDamage(iCl)
{
        
// iDmg now holds the amount of damage done
        
new iDmg read_data(2);
}
 
public 
eventDeathMsg()
{
        new 
iHeadShotszWeap[6];
        
read_data(3iHeadShot);
        
read_data(4szWeap5);
 
        if (
iHeadShot)
        {
                
// Head Shot was made
        
}
 
        if (
equal(szWeap"knife"))
        {
                
// Knife kill was made
        
}

Sorry, but can't help you with bomb.
What are you using iDmg for?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 06-21-2009 at 15:02.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-21-2009 , 15:05   Re: How do i get user headshot ?
Reply With Quote #4

Quote:
Originally Posted by TitANious View Post
What are you using iDmg for?
Quote:
Originally Posted by ƒa†es™ View Post
...

2. How do i get user total damage ?

...
Are you asking fates or hlev?

http://wiki.amxmodx.org/Half-Life_1_Game_Events#Damage
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-21-2009 , 15:10   Re: How do i get user headshot ?
Reply With Quote #5

hleV
EDIT:
Sorry for asking here myself, but. How do i get like that i can give the attacker something if he killed with headshot, normal or with knife?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 06-21-2009 at 15:14.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-22-2009 , 00:21   Re: How do i get user headshot ?
Reply With Quote #6

Quote:
Originally Posted by TitANious View Post
hleV
EDIT:
Sorry for asking here myself, but. How do i get like that i can give the attacker something if he killed with headshot, normal or with knife?
untested
PHP Code:
register_event"DeathMsg" "fw_EvDeathMsg" "a" "1>0" );

public 
fw_EvDeathMsg()
{
    static 
iKilleriKiller read_data);
    static 
iVictimiVictim read_data);
    static 
szWeapon]; read_dataszWeapon );
    
    if ( 
read_data) )
    {    
        
//iKiller killed iVictim via headshot
        
        
if ( ( szWeapon] == 'k' ) && ( szWeapon] == 'f' ) && ( szWeapon] == 'e' ) )
        {
            
//... using knife
        
}
        else
        {
            
//... not using knife
        
}
    }

__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-22-2009 , 07:27   Re: How do i get user headshot ?
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
untested
PHP Code:
register_event"DeathMsg" "fw_EvDeathMsg" "a" "1>0" );

public 
fw_EvDeathMsg()
{
    static 
iKilleriKiller read_data);
    static 
iVictimiVictim read_data);
    static 
szWeapon]; read_dataszWeapon );
    
    if ( 
read_data) )
    {    
        
//iKiller killed iVictim via headshot
        
        
if ( ( szWeapon] == 'k' ) && ( szWeapon] == 'f' ) && ( szWeapon] == 'e' ) )
        {
            
//... using knife
        
}
        else
        {
            
//... not using knife
        
}
    }

I can't test it either, my cs fucks up if i go "new game.."
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-22-2009 , 08:13   Re: How do i get user headshot ?
Reply With Quote #8

@titanius: and no one asked you to test

PHP Code:
if( equalszWeapon"grenade" ) ) {
          
// killed with grenade ?

__________________
xPaw is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-22-2009 , 09:43   Re: How do i get user headshot ?
Reply With Quote #9

I'll guess you are right xPawn, but it would be good to test
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
lordshiva
BANNED
Join Date: Aug 2009
Location: Heaven
Old 10-11-2009 , 02:29   Re: How do i get user headshot ?
Reply With Quote #10

how do i get just headshot...only headshots from user
lordshiva 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 00:30.


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