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
__________________