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

L4D2 Using Zombie Types for Buy Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
africanspacejesus
Senior Member
Join Date: Nov 2016
Location: Bay Area, CA
Old 02-19-2017 , 16:50   L4D2 Using Zombie Types for Buy Menu
Reply With Quote #1

Hey everyone. I'm working on a buy menu for a L4D2 server and I need to know when a player kills each type of zombie to be able to reward them with a specific amount of money. So far I have found everything except for the zombie types from hordes. Here is what I have. Please let me know if I my way works and how I can get the information for hordes.

Code:
#define ZOMBIECLASS_SMOKER 1
#define ZOMBIECLASS_BOOMER 2
#define ZOMBIECLASS_HUNTER 3
#define ZOMBIECLASS_SPITTER 4
#define ZOMBIECLASS_JOCKEY 5
#define ZOMBIECLASS_CHARGER 6
#define ZOMBIECLASS_WITCH 7
#define ZOMBIECLASS_TANK 8

public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
	int attacker = GetEventInt(event, "attacker");
	int client = GetClientOfUserId(attacker);
	int user = GetEventInt(event, "userid");
	int deadclient = GetClientOfUserId("user");
	int victim = GetEventString(event, "victimname");
	int class = GetZombieType(client);
	int money;
	if(!IsFakeClient(client))
	{
//		if(StrEqual(class, "commoninfected")
//			money = GetConVarInt(h_MoneyfromCommonInfected);
		if(class == ZOMBIECLASS_HUNTER)
			money = GetConVarInt(h_MoneyfromHunter);
		else if(class == ZOMBIECLASS_SMOKER)
			money = GetConVarInt(h_MoneyfromSmoker);
		else if(class == ZOMBIECLASS_BOOMER)
			money = GetConVarInt(h_MoneyfromBoomer);
		else if(class == ZOMBIECLASS_TANK)
			money = GetConVarInt(h_MoneyfromTank);
		else if(GetClientTeam(deadclient)==2)
			money = GetConVarInt(h_MoneyfromSurvivor);
		else if(class == ZOMBIECLASS_WITCH)
			money = GetConVarInt(h_MoneyfromWitch);
		else if(class == ZOMBIECLASS_JOCKEY)
			money = GetConVarInt(h_MoneyfromJockey);
		else if(class == ZOMBIECLASS_CHARGER)
			money = GetConVarInt(h_MoneyfromCharger);
		else if(class == ZOMBIECLASS_SPITTER)
			money = GetConVarInt(h_MoneyfromSpitter);
//		else if(StrEqual(class, "ceda")
//			money = GetConVarInt(h_MoneyfromCEDA);
//		else if(StrEqual(class, "jim")
//			money = GetConVarInt(h_MoneyfromJim);
//		else if(StrEqual(class, "fallen")
//			money = GetConVarInt(h_MoneyfromFallen);
//		else if(StrEqual(class, "clown")
//			money = GetConVarInt(h_MoneyfromClown);
//		else if(StrEqual(class, "mud")
//			money = GetConVarInt(h_MoneyfromMud);
//		else if(StrEqual(class, "riot")
//			money = GetConVarInt(h_MoneyfromRiot);	
		i_Money[client] += money;
	}
	
}


stock GetZombieType(client)
{
    return GetEntProp(client, Prop_Send, "m_zombieClass");
}
__________________
Taking paid plugin requests
africanspacejesus is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 02-19-2017 , 18:00   Re: L4D2 Using Zombie Types for Buy Menu
Reply With Quote #2

https://wiki.alliedmods.net/Left_4_dead_2_netprops
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
africanspacejesus
Senior Member
Join Date: Nov 2016
Location: Bay Area, CA
Old 02-19-2017 , 18:12   Re: L4D2 Using Zombie Types for Buy Menu
Reply With Quote #3

Quote:
Originally Posted by OSWO View Post
I like the information that that has to offer but that's very difficult to read and find information that is needed
__________________
Taking paid plugin requests
africanspacejesus is offline
aleeexxx
Member
Join Date: May 2014
Location: Valhalla
Old 02-19-2017 , 19:12   Re: L4D2 Using Zombie Types for Buy Menu
Reply With Quote #4

Code:
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
	int Attacker = GetClientOfUserId(event.GetInt("attacker")),
		Victim = GetClientOfUserId(event.GetInt("userid"));

	// if(!IsFakeClient(client))
	// {
		int money = 0,
			z_class = GetZombieType(Victim);

		if(z_class == ZOMBIECLASS_HUNTER)
			money = GetConVarInt(h_MoneyfromHunter);
		else if(z_class == ZOMBIECLASS_SMOKER)
			money = GetConVarInt(h_MoneyfromSmoker);
		else if(z_class == ZOMBIECLASS_BOOMER)
			money = GetConVarInt(h_MoneyfromBoomer);
		else if(z_class == ZOMBIECLASS_TANK)
			money = GetConVarInt(h_MoneyfromTank);
		else if(GetClientTeam(Victim)==2)
			money = GetConVarInt(h_MoneyfromSurvivor);
		else if(z_class == ZOMBIECLASS_WITCH)
			money = GetConVarInt(h_MoneyfromWitch);
		else if(z_class == ZOMBIECLASS_JOCKEY)
			money = GetConVarInt(h_MoneyfromJockey);
		else if(z_class == ZOMBIECLASS_CHARGER)
			money = GetConVarInt(h_MoneyfromCharger);
		else if(z_class == ZOMBIECLASS_SPITTER)
			money = GetConVarInt(h_MoneyfromSpitter);
		else{
			char VictimName[30];
			event.GetString("victimname", VictimName, sizeof(VictimName));
			PrintToChatAll("%s", VictimName);
		}

		i_Money[Attacker] += money;
	// }
}
Test with this code I dont have experience with the name from Infected, I dont sure if you can get with "victimname" but well testing or looking for that info...
__________________

Last edited by aleeexxx; 02-19-2017 at 19:15.
aleeexxx is offline
Send a message via MSN to aleeexxx
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 22:01.


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