Raised This Month: $ Target: $400
 0% 

Getting knife kill on DeathMsg Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 09-18-2013 , 09:54   Getting knife kill on DeathMsg Event
Reply With Quote #1

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
}

devWaleed is offline
Send a message via Skype™ to devWaleed
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-18-2013 , 10:13   Re: Getting knife kill on DeathMsg Event
Reply With Quote #2

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"
__________________
<VeCo> 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 18:48.


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