Raised This Month: $ Target: $400
 0% 

headshot drop bonus [Zombie Panic Source]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-07-2023 , 08:56   Re: headshot drop bonus [Zombie Panic Source]
Reply With Quote #6

Code:
#include <sdktools>

#define ZPS_TEAM_NONE			0	// player running on map but haven't choose team
#define ZPS_TEAM_SPECTATOR	1	// observer
#define ZPS_TEAM_HUMAN		2	// human
#define ZPS_TEAM_ZOMBIE		3	// zombie


char items[][] = {
	//"item_ammo_barricade",
	//"item_ammo_barricade_clip",
	//"item_ammo_barricadepile",
	//"item_ammo_flare",
	"item_ammo_pistol",
	"item_ammo_pistol_clip",
	"item_ammo_revolver",
	"item_ammo_revolver_clip",
	"item_ammo_rifle",
	"item_ammo_rifle_clip",
	"item_ammo_shotgun",
	"item_ammo_shotgun_clip",
	"item_armor",
	//"item_deliver",
	"item_healthkit",
	"item_pills"
}

public void OnPluginStart()
{
	HookEvent("player_feed", player_feed)
}

public void player_feed(Event event, const char[] name, bool dontBroadcast)
{
	if(!event.GetBool("death") || !event.GetBool("headshot"))
		return;

	int client = GetClientOfUserId(event.GetInt("userid"));

	if(GetClientTeam(client) == ZPS_TEAM_ZOMBIE) // && ZPS_IsCarrier(client))
	{
		char weapon[50];
		event.GetString("weapon", weapon, sizeof(weapon));

		if(StrContains(weapon, "sledgehammer", false) == -1)
			return;

		float pos[3];
		GetClientEyePosition(client, pos);
		
		DataPack pack = new DataPack();
		pack.WriteFloatArray(pos, sizeof(pos));
		
		RequestFrame(delay, pack);
	}
}

public void delay(DataPack data)
{
	data.Reset();

	float pos[3];
	data.ReadFloatArray(pos, sizeof(pos));

	delete data;

	int item = CreateEntityByName(items[GetRandomInt(0, sizeof(items)-1)]);
		
	if(item != -1)
	{
		TeleportEntity(item, pos, NULL_VECTOR, NULL_VECTOR);
		DispatchSpawn(item);
	}
}

stock bool ZPS_IsCarrier(int client)
{
	if(HasEntProp(client, Prop_Send, "m_bIsCarrier") &&
		GetEntProp(client, Prop_Send, "m_bIsCarrier"))
	{
		return true;
	}

	return false;
}
__________________
Do not Private Message @me
Bacardi is offline
 



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 05:02.


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