AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved (HELP) Detect self grenade kill (https://forums.alliedmods.net/showthread.php?t=308122)

Question x Mark 06-07-2018 12:59

(HELP) Detect self grenade kill
 
How do I detect self grenade kill?
Is it possible using DeathMsg?

instinctpt1 06-07-2018 13:20

Re: (HELP) Detect self grenade kill
 
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")



^SmileY 06-07-2018 14:09

Re: (HELP) Detect self grenade kill
 
Quote:

Originally Posted by instinctpt1 (Post 2595716)
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

Question x Mark 06-07-2018 14:13

Re: (HELP) Detect self grenade kill
 
Quote:

Originally Posted by ^SmileY (Post 2595729)
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

^SmileY 06-07-2018 14:16

Re: (HELP) Detect self grenade kill
 
Quote:

Originally Posted by Question x Mark (Post 2595732)
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

CrazY. 06-07-2018 14:34

Re: (HELP) Detect self grenade kill
 
Ham_Killed is a better way.

instinctpt1 06-07-2018 14:35

Re: (HELP) Detect self grenade kill
 
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 06-07-2018 14:37

Re: (HELP) Detect self grenade kill
 
@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 ?

^SmileY 06-07-2018 14:45

Re: (HELP) Detect self grenade kill
 
Quote:

Originally Posted by CrazY. (Post 2595738)
Ham_Killed is a better way.

Definitely not

CrazY. 06-07-2018 16:15

Re: (HELP) Detect self grenade kill
 
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.


All times are GMT -4. The time now is 04:40.

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