AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [GetEventString]What should i add to make this work? (https://forums.alliedmods.net/showthread.php?t=289930)

Nursik 11-01-2016 12:48

[GetEventString]What should i add to make this work?
 
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.

Mitchell 11-01-2016 12:57

Re: [GetEventString]What should i add to make this work?
 
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
    }
}


Nursik 11-01-2016 13:05

Re: [GetEventString]What should i add to make this work?
 
Quote:

Originally Posted by Mitchell (Post 2466873)
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.

Michael Shoe Maker 11-01-2016 13:34

Re: [GetEventString]What should i add to make this work?
 
Maybe get weapon_itemid and get the edict classname?

Mitchell 11-01-2016 13:37

Re: [GetEventString]What should i add to make this work?
 
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.

Nursik 11-01-2016 13:45

Re: [GetEventString]What should i add to make this work?
 
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.


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

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