AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting knife kill on DeathMsg Event (https://forums.alliedmods.net/showthread.php?t=226456)

devWaleed 09-18-2013 09:54

Getting knife kill on DeathMsg Event
 
How do I get knife kill on DeathMsg event?

I am trying this:

PHP Code:

public OnPlayerDeath(){
    new 
Killer    =    read_data(1);
    
//new Victim    =    read_data(2);
    
new headshot    =    read_data(3);
    new 
weapon[20]; 
    
read_data(4weaponcharsmax(weapon));
        if(
weapon == "weapon_knife"){
 
//it gives error
//Error: Array must be indexed (variable "weapon") on line 33
}



<VeCo> 09-18-2013 10:13

Re: Getting knife kill on DeathMsg Event
 
Weapon is returned as a string. To check a string, use equal.
Also weapon is returned without "weapon_" in front of it's name.

But if you need the function only for knife kill, you can just register the event like this:
PHP Code:

register_event("DeathMsg","OnPlayerDeath","a","4=knife"



All times are GMT -4. The time now is 18:48.

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