Raised This Month: $ Target: $400
 0% 

Solved (HELP) Detect self grenade kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Question x Mark
Junior Member
Join Date: May 2018
Old 06-07-2018 , 12:59   (HELP) Detect self grenade kill
Reply With Quote #1

How do I detect self grenade kill?
Is it possible using DeathMsg?

Last edited by Question x Mark; 06-09-2018 at 05:42.
Question x Mark is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 06-07-2018 , 13:20   Re: (HELP) Detect self grenade kill
Reply With Quote #2

Yes its possible, here it is :

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("Self Nade Kill""1.0""DiGiTaL")
    
register_event("DeathMsg""onDeathMsgEvent""a");
}

public 
onDeathMsgEvent()
{
    new 
id read_data(2)
    new 
szWeapon[32];
    
read_data(4szWeaponcharsmax(szWeapon));
    if(
equal(szWeapon"grenade"))
        
client_print(idprint_chat"Self Nade kill xD")

instinctpt1 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-07-2018 , 14:09   Re: (HELP) Detect self grenade kill
Reply With Quote #3

Quote:
Originally Posted by instinctpt1 View Post
Yes its possible, here it is :

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("Self Nade Kill""1.0""DiGiTaL")
    
register_event("DeathMsg""onDeathMsgEvent""a");
}

public 
onDeathMsgEvent()
{
    new 
id read_data(2)
    new 
szWeapon[32];
    
read_data(4szWeaponcharsmax(szWeapon));
    if(
equal(szWeapon"grenade"))
        
client_print(idprint_chat"Self Nade kill xD")

where is the part that check for the killer and victim? LOL

PHP Code:
#include <amxmodx>
#include <csx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("AL AKHBAR","0.0.1","SmileY");
}

public 
client_death(Killer,Victim,WeaponId,HitPlace,TK)
{
    if(
Killer == Victim && WeaponId == CSW_HEGRENADE)
    {
        new 
Name[32];
        
get_user_name(Victim,Name,charsmax(Name));

        
client_print(0,print_chat,"%s says: AL AKHBAR",Name);
    }

Not Tested
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-07-2018 at 14:13. Reason: Name
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Question x Mark
Junior Member
Join Date: May 2018
Old 06-07-2018 , 14:13   Re: (HELP) Detect self grenade kill
Reply With Quote #4

Quote:
Originally Posted by ^SmileY View Post
where is the part that check for the killer and victim? LOL

PHP Code:
#include <amxmodx>
#include <csx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("AL AKHBAR","0.0.1","SmileY");
}

public 
client_death(Killer,Victim,WeaponId,HitPlace,TK)
{
    if(
Killer == Victim && WeaponId == CSW_HEGRENADE)
    {
        new 
Name[32];
        
get_user_name(Victim,Name,charsmax(Name));

        
client_print(0,print_chat,"%s says: AL AKHBAR");
    }

Not Tested
I already said that I want to use it with DeathMsg
Question x Mark is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-07-2018 , 14:16   Re: (HELP) Detect self grenade kill
Reply With Quote #5

Quote:
Originally Posted by Question x Mark View Post
I already said that I want to use it with DeathMsg
Why only with DeathMsg?

anyway is here

PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Self Detonate Check","0.0.1","SmileY");

    
register_event("DeathMsg","DeathMsg","a");
}

public 
DeathMsg()
{
    new 
Killer read_data(1);
    new 
Victim read_data(2);

    if(
Killer == Victim && get_user_weapon(Killer) == CSW_HEGRENADE)
    {
        new 
Name[32];
        
get_user_name(Victim,Name,charsmax(Name));

        
client_print(0,print_chat,"%s says: AL AKHBAR",Name);
    }

Ps. using csx will use less natives call
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 06-07-2018 at 14:19.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-07-2018 , 14:34   Re: (HELP) Detect self grenade kill
Reply With Quote #6

Ham_Killed is a better way.
__________________








CrazY. is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-07-2018 , 14:45   Re: (HELP) Detect self grenade kill
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
Ham_Killed is a better way.
Definitely not
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 06-07-2018 , 14:35   Re: (HELP) Detect self grenade kill
Reply With Quote #8

Ohh lol, forgot the check xD
Yes use this one
PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Self Detonate Check","0.0.1","SmileY");

    
register_event("DeathMsg","DeathMsg","a");
}

public 
DeathMsg()
{
    new 
Killer read_data(1);
    new 
Victim read_data(2);

    if(
Killer == Victim && get_user_weapon(Killer) == CSW_HEGRENADE)
    {
        new 
Name[32];
        
get_user_name(Victim,Name,charsmax(Name));

        
client_print(0,print_chat,"%s says: AL AKHBAR",Name);
    }

instinctpt1 is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 06-07-2018 , 14:37   Re: (HELP) Detect self grenade kill
Reply With Quote #9

@CrazY he doesn't want any advice xD
He has decided that he will only use "DEATHMSG" then who are u trying to change his decision xD ?
instinctpt1 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-07-2018 , 16:15   Re: (HELP) Detect self grenade kill
Reply With Quote #10

I'm not trying to chage his way. Ham_Killed is better in my opnion, otherwise amx developers team would not need add, or I'm wrong? Think about this.
__________________








CrazY. 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 04:40.


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