Raised This Month: $ Target: $400
 0% 

Detect if a player has made damage to another player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 11-16-2014 , 09:14   Re: Detect if a player has made damage to another player
Reply With Quote #1

look what connor said

https://forums.alliedmods.net/showthread.php?t=236270
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
Hackerpcs
Member
Join Date: Jul 2012
Location: Greece
Old 11-16-2014 , 13:46   Re: Detect if a player has made damage to another player
Reply With Quote #2

I've done it like this
PHP Code:
public fw_takedamage(victiminflictorattackerFloat:damagebits)
{

    if ( 
damage )
    {
        if( 
//condition I need )
        
{
            if( 
//condition I need )
            
{
                
bGivenDamage[attacker]=true;
            }
        }
    }

    return 
HAM_IGNORED;

It works as I need it. Conditions commented out assure that self hurt isn't taken into account

Last edited by Hackerpcs; 11-16-2014 at 13:52.
Hackerpcs is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-16-2014 , 09:48   Re: Detect if a player has made damage to another player
Reply With Quote #3

The damage passed into the TakeDamage is not the real damage because there the game doesn't take into account the player armour and stuffs like that. You can use pev_dmg_taken in the TakeDamage() registerd as post. Didn't know that the offset is updated correctly.
__________________
HamletEagle is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 11-16-2014 , 13:46   Re: Detect if a player has made damage to another player
Reply With Quote #4

here another way

PHP Code:
#include <amxmodx>

#define MAX_PLAYERS    32

new const Float:g_flCoords[][] = 
{
    {
0.500.40},
    {
0.560.44},
    {
0.600.50},
    {
0.560.56},
    {
0.500.60},
    {
0.440.56},
    {
0.400.50},
    {
0.440.44}
}

new 
g_iPlayerPos[MAX_PLAYERS+1]

new 
g_iMaxPlayers
new g_pCvarEnabled

public plugin_init()
{

    
register_event("Damage""Event_Damage""b""2>0""3=0")

    
g_iMaxPlayers get_maxplayers()
}

public 
Event_DamageiVictim )
{
    if(
read_data(4) || read_data(5) || read_data(6)) 
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) )
        {
            new 
iPos = ++g_iPlayerPos[id]
            if( 
iPos == sizeof(g_flCoords) )
            {
                
iPos g_iPlayerPos[id] = 0
            
}
            
set_hudmessage(04080Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
            
show_hudmessage(id"%d"read_data(2))
        }
    }

__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
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 17:37.


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