Raised This Month: $ Target: $400
 0% 

How to equip a player with a stock parachute on spawn (CS:GO)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sarrus
Member
Join Date: May 2020
Location: France
Old 12-15-2020 , 11:32   How to equip a player with a stock parachute on spawn (CS:GO)
Reply With Quote #1

Hello,

I'm trying to equip players with the stock parachute when they spawn.
I've tried this plugin, which no longer works.

What I came up with was:
Code:
public void OnPluginStart()
{
	PrecacheModel("models/props_survival/upgrades/parachutepack.mdl");
	PrecacheModel("models/weapons/v_parachute.mdl");
	PrecacheModel("models/props_survival/parachute/chute.mdl");
	PrecacheSound("survival/parachute_pickup_start_01.wav");
	PrecacheSound("survival/parachute_pickup_success_01.wav");
	HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post);
}


public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast) 
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
	int parachute_entity = CreateEntityByName("prop_weapon_upgrade_chute");
	float vecPosition[3];
	GetClientAbsOrigin(client, vecPosition);
	if (parachute_entity != -1)
	{
		DispatchSpawn(parachute_entity);
		TeleportEntity(parachute_entity, vecPosition, NULL_VECTOR , NULL_VECTOR);
	}
	return Plugin_Continue;
}
This works and just spawns a parachute backpack at the feet of the player when they spawn, and then they have to equip manually (not ideal).

I've also tried this:

Code:
	
public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast) 
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
        Event hevent = CreateEvent("parachute_pickup");
	if (hevent != null) {
		hevent.SetInt("userid", GetClientUserId(client));
		hevent.Fire();
	return Plugin_Continue;
}
which doesn't work.

Thanks in advance for your help
__________________
Discord Coding Server | Steam Profile | Community Website | Github Profile

Taking paid requests (add me on Discord)
Sarrus 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 23:06.


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