View Single Post
MasterMind420
BANNED
Join Date: Nov 2010
Old 08-15-2018 , 14:44   Re: [L4D & L4D2] Survivor Starter Pack
Reply With Quote #8

Crasher use something like this to fix your item giving...I used this method to fix starting backpack contents for my backpack plugin.

Code:
//THIS EVENT FIRES WHEN PLAYERS FIRST SPAWN ON THE SERVER AND WHEN A NEW CAMPAIGN STARTS
//YOU MUST FILTER OUT FAKECLIENTS(THEY FIRE THIS EVENT EVERY TIME A PLAYER GOES IDLE)
public void ePlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));

	if(IsValidClient(client) && !IsFakeClient(client) && GetClientTeam(client) == 2)
	{
		int userid = GetClientUserId(client);
		CreateTimer(1.0, GiveItems, userid, TIMER_FLAG_NO_MAPCHANGE);
	}
}

public Action GiveItems(Handle timer, any userid)
{
	int client = GetClientOfUserId(userid);

	//AS A PRECAUTION REMOVE ALL ITEMS FROM THE PLAYER
	//I DO THIS TO MAKE THE PROCESS CLEANER FOR MY BACKPACK

	int slot;

	slot = GetPlayerWeaponSlot(client, 2);

	if(slot > -1)
	{
		RemovePlayerItem(client, slot);
		AcceptEntityInput(slot, "kill");
	}

	slot = GetPlayerWeaponSlot(client, 3);

	if(slot > -1)
	{
		RemovePlayerItem(client, slot);
		AcceptEntityInput(slot, "kill");
	}

	slot = GetPlayerWeaponSlot(client, 4);

	if(slot > -1)
	{
		RemovePlayerItem(client, slot);
		AcceptEntityInput(slot, "kill");
	}

	//GIVE YOUR ITEMS BELOW THIS
}

Last edited by MasterMind420; 08-15-2018 at 14:50.
MasterMind420 is offline