Raised This Month: $12 Target: $400
 3% 

Solved [GetEventString]What should i add to make this work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 11-01-2016 , 12:48   [GetEventString]What should i add to make this work?
Reply With Quote #1

PHP Code:
public Action OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
String:classname[64];
    
GetEventString(event"weapon"classnamesizeof(classname));
    if (
StrEqual(classname"tf_weapon_fireaxe) && weaponID == 214)
    {
        //Do something
    }

Don't pay much attention for the weaponID(i already defined it), i just put it here in case it could cause problems.

Last edited by Nursik; 11-01-2016 at 13:51.
Nursik is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 11-01-2016 , 12:57   Re: [GetEventString]What should i add to make this work?
Reply With Quote #2

Code:
public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) 
{ 
    char classname[64]; 
    GetEventString(event, "weapon", classname, sizeof(classname)); 
    if (StrEqual(classname, "tf_weapon_fireaxe") && weaponID == 214) 
    { 
        //Do something 
    } 
}
Mitchell is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 11-01-2016 , 13:05   Re: [GetEventString]What should i add to make this work?
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
Code:
public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) 
{ 
    char classname[64]; 
    GetEventString(event, "weapon", classname, sizeof(classname)); 
    if (StrEqual(classname, "tf_weapon_fireaxe") && weaponID == 214) 
    { 
        //Do something 
    } 
}
I'll see if this works. EDIT: doesn't work, guess i have to use only the ID check. :/
EDIT2: even weaponID doesn't work alone, ah.

Last edited by Nursik; 11-01-2016 at 13:32.
Nursik is offline
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 11-01-2016 , 13:34   Re: [GetEventString]What should i add to make this work?
Reply With Quote #4

Maybe get weapon_itemid and get the edict classname?
Michael Shoe Maker is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 11-01-2016 , 13:37   Re: [GetEventString]What should i add to make this work?
Reply With Quote #5

I don't even know what "doesn't work" means, are you even hooking the event 'player_death', you need to HookEvent for the function to fire when the event is played.
Mitchell is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 11-01-2016 , 13:45   Re: [GetEventString]What should i add to make this work?
Reply With Quote #6

Guys, i think the weaponID and weapon string are swapped so i got confused. Weaponid works like this: if (weaponID == TF_WEAPON_CLASSNAME), haven't tested weapon string yet.
EDIT: idk what weapon string does, but i can't find the item ID index of the weapon, but i don't need it that much, i'll just find the index of the weapon slot.

Last edited by Nursik; 11-01-2016 at 14:15.
Nursik 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 08:25.


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