Raised This Month: $32 Target: $400
 8% 

Help event_deathmsg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 04-09-2021 , 21:37   Help event_deathmsg
Reply With Quote #1

Hi , first of all im new on this forums so i don't know if i posted this corectly ..
So in one of my plugins i use the ev_deathmsg function , that count the knife kills ! My questions is how can i detect the killer's death , ofc killed by a knife ! I tried this but idk if is corectly

PHP Code:
#define EventGun CSW_KNIFE

...Rest of the plugin...

public 
Event_DeathMsg()
{
    new 
killer read_data(1);
    new 
victim read_data(2);
    new 
killer_weapon get_user_weapon(killer);
    new 
victim_weapon get_user_weapon(victim);

    if(!
is_user_alive(killer) || is_user_hltv(killer) || is_user_bot(killer) && killer_weapon != EventGun ) return;
    else
    {
        ++
KillsWithKnife[killer]; // this count how many kills with knife the killer did
    
}
    if(
victim == killer)
    {
        if(!
is_user_alive(victim) || is_user_hltv(victim) || is_user_bot(victim) && victim_weapon != EventGun ) return;
        else
        {
            ++
Knifed[killer]; // this count how many times the killer got knifed
        
}
    }

N3v3rM1nd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-09-2021 , 21:47   Re: Help event_deathmsg
Reply With Quote #2

I think you may be misunderstanding how this event works. It fires when all players die. If the player dies, he is the victim.

This should be all you need:
PHP Code:
register_event"DeathMsg" "Event_DeathMsg" "a" "3=knife" );

public 
Event_DeathMsg()
{
    new 
killer read_data(1);
    new 
victim read_data(2);

    if ( !
is_user_bot(killer) ) 
    {
        ++
KillsWithKnife[killer]; // this count how many kills with knife the killer did
        
++Knifed[victim]; // this count how many times the killer got knifed
    
}

__________________

Last edited by Bugsy; 04-09-2021 at 22:19.
Bugsy is offline
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 04-09-2021 , 21:51   Re: Help event_deathmsg
Reply With Quote #3

Thank you but is not what i need ! im still learning amxx ... what event should i use to detect what i need ?

Last edited by N3v3rM1nd; 04-09-2021 at 21:52.
N3v3rM1nd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-09-2021 , 21:53   Re: Help event_deathmsg
Reply With Quote #4

I just gave you what you need?

You're trying to count how many times a player kills and gets killed by knife, right?
__________________
Bugsy is offline
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 04-09-2021 , 21:58   Re: Help event_deathmsg
Reply With Quote #5

Yes, thats what im trying to do , to detect how many kills a player did with knife and how many times he got knifed.

Last edited by N3v3rM1nd; 04-09-2021 at 22:01.
N3v3rM1nd is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-09-2021 , 22:01   Re: Help event_deathmsg
Reply With Quote #6

That's what my code does, please try what I provided before claiming it's not what you need. You had it coded incorrectly and I was able to reduce much of your code so you probably assumed it was wrong.
__________________
Bugsy is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 04-09-2021 , 22:14   Re: Help event_deathmsg
Reply With Quote #7

Trust me, i'm his friend and he's very dizzy so that's why he's been struggling to understand how it works
AnimalMonster is offline
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 04-09-2021 , 22:14   Re: Help event_deathmsg
Reply With Quote #8

Is working , sorry ! Yep i misunderstanding ! +karma
N3v3rM1nd is offline
Reply


Thread Tools
Display Modes

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 21:39.


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