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

[L4D] Get the name of infected by Entityid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 11-08-2017 , 18:24   [L4D] Get the name of infected by Entityid
Reply With Quote #1

Hi !

Please, tip me, how can I get the name of infected (usual zombie, hunter, smoker, e.t.c.) from event?

I made such code, but it can differentiate only "infected" and "witch":

Code:
public EventDamageInfected(Handle:Event, const String:Name[], bool:Broadcast)
{
	decl Ent;

	Ent = GetEventInt(Event, "entityid");

	char classname[128];
	GetEdictClassname(Ent, classname, sizeof(classname));

	PrintToServer("Infected is: %s", classname);
	PrintToChatAll("Infected is: %s", classname);
}

public OnPluginStart()
{
	HookEvent("infected_death", EventDeathInfected);
}
Thanks.

Last edited by Dragokas; 11-08-2017 at 18:25.
Dragokas is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 11-08-2017 , 19:05   Re: [L4D] Get the name of infected by Entityid
Reply With Quote #2

Try this:

char classname[128];
GetEntPropString(Ent, Prop_Data, "m_iName", classname, 128 );

Last edited by Facksy; 11-08-2017 at 19:06.
Facksy is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-09-2017 , 05:59   Re: [L4D] Get the name of infected by Entityid
Reply With Quote #3

If your game is L4D, that "entityid" parameter not exist in event "infected_death"
And "infected_death" not get called if special zombie dies. (tested L4D2)



*

use player death event (have tested in l4d2)
Code:
    "player_death"                // a game event, name may be 32 charaters long
    {
        // this extents the original player_death by a new fields
        "userid"    "short"       // user ID who died                
        "entityid"    "long"       // entity ID who died, userid should be used first, to get the dead Player.  Otherwise, it is not a player, so use this.        
        "attacker"    "short"         // user ID who killed
        "attackername" "string" // What type of zombie, so we don't have zombie names
        "attackerentid" "long"    // if killer not a player, the entindex of who killed.  Again, use attacker first
        "weapon"    "string"     // weapon name killer used 
        "headshot"    "bool"        // singals a headshot
        "attackerisbot" "bool"  // is the attacker a bot
        "victimname" "string"   // What type of zombie, so we don't have zombie names
        "victimisbot" "bool"    // is the victim a bot
        "abort" "bool"    // did the victim abort
        "type"        "long"        // damage type
        "victim_x"    "float"
        "victim_y"    "float"
        "victim_z"    "float"
    }

in net_showevents 2
Code:
11/09/2017 - 12:48:20: Server event "player_death", Tick 3555:
11/09/2017 - 12:48:20: - "userid" = "0"
11/09/2017 - 12:48:20: - "entityid" = "647"
11/09/2017 - 12:48:20: - "attacker" = "5"
11/09/2017 - 12:48:20: - "attackername" = ""
11/09/2017 - 12:48:20: - "attackerentid" = "0"
11/09/2017 - 12:48:20: - "weapon" = "rifle_ak47"
11/09/2017 - 12:48:20: - "headshot" = "0"
11/09/2017 - 12:48:20: - "attackerisbot" = "1"
11/09/2017 - 12:48:20: - "victimname" = "Infected"
11/09/2017 - 12:48:20: - "victimisbot" = "1"
11/09/2017 - 12:48:20: - "abort" = "0"
11/09/2017 - 12:48:20: - "type" = "-2147483646"
11/09/2017 - 12:48:20: - "victim_x" = "4811.58"
11/09/2017 - 12:48:20: - "victim_y" = "6334.62"
11/09/2017 - 12:48:20: - "victim_z" = "38.43"
11/09/2017 - 12:48:20: Server event "infected_death", Tick 3555:
11/09/2017 - 12:48:20: - "attacker" = "5"
11/09/2017 - 12:48:20: - "infected_id" = "0"
11/09/2017 - 12:48:20: - "gender" = "1"
11/09/2017 - 12:48:20: - "weapon_id" = "26"
11/09/2017 - 12:48:20: - "headshot" = "0"
11/09/2017 - 12:48:20: - "minigun" = "0"
11/09/2017 - 12:48:20: - "blast" = "0"
11/09/2017 - 12:48:20: - "submerged" = "0"










11/09/2017 - 12:48:25: Server event "player_death", Tick 3690:
11/09/2017 - 12:48:25: - "userid" = "6"
11/09/2017 - 12:48:25: - "entityid" = "0"
11/09/2017 - 12:48:25: - "attacker" = "5"
11/09/2017 - 12:48:25: - "attackername" = ""
11/09/2017 - 12:48:25: - "attackerentid" = "0"
11/09/2017 - 12:48:25: - "weapon" = "rifle_ak47"
11/09/2017 - 12:48:25: - "headshot" = "0"
11/09/2017 - 12:48:25: - "attackerisbot" = "1"
11/09/2017 - 12:48:25: - "victimname" = "Boomer"
11/09/2017 - 12:48:25: - "victimisbot" = "1"
11/09/2017 - 12:48:25: - "abort" = "0"
11/09/2017 - 12:48:25: - "type" = "-2147483646"
11/09/2017 - 12:48:25: - "victim_x" = "4826.96"
11/09/2017 - 12:48:25: - "victim_y" = "5984.34"
11/09/2017 - 12:48:25: - "victim_z" = "34.51"
11/09/2017 - 12:48:25: Server event "weapon_drop", Tick 3690:
11/09/2017 - 12:48:25: - "userid" = "6"
11/09/2017 - 12:48:25: - "item" = ""
11/09/2017 - 12:48:25: - "propid" = "0"
__________________
Do not Private Message @me

Last edited by Bacardi; 11-09-2017 at 06:04.
Bacardi is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 11-09-2017 , 07:19   Re: [L4D] Get the name of infected by Entityid
Reply With Quote #4

Quote:
Server event "player_death", Tick 59073:
- "userid" = "206"
- "entityid" = "0"
- "attacker" = "202"
- "attackername" = ""
- "attackerentid" = "0"
- "weapon" = "autoshotgun"
- "headshot" = "0"
- "attackerisbot" = "0"
- "victimname" = "Smoker"
- "victimisbot" = "1"
- "abort" = "0"
Nice, thanks.
net_showevents 2 is a good var.

Quote:
Originally Posted by Facksy View Post
Ent, Prop_Data, "m_iName"
Where can I get a manual for the list of supported names of properties for entity (or, just the list)?
Dragokas is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-09-2017 , 07:41   Re: [L4D] Get the name of infected by Entityid
Reply With Quote #5

there is SM server commands
sm_dump_netprops prop_send.txt
sm_dump_datamaps prop_data.txt


you get dump file in server folder.


But m_iName is entity targetname what have been set example in Hammer level editor or by plugin...
__________________
Do not Private Message @me
Bacardi 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 12:39.


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