Post by Morgoneth on Jul 18, 2022 16:43:47 GMT
hi, everyone
I have an idea for an existing parachute plugins
Many parachute plugins have to hold E to deploy the parachute this makes my fingers not feeling well, so I want to modify the parachute to not need to hold E
When I'm in mid-air, I press E to automatically deploy the parachute
When I deploy the parachute in mid-air, I press E again to close the parachute
Is this possible?
This is the parachute plugin I'm using
Plugin source: [ZP] GamePlay modifier: Parachute v1.4
I have an idea for an existing parachute plugins
Many parachute plugins have to hold E to deploy the parachute this makes my fingers not feeling well, so I want to modify the parachute to not need to hold E
When I'm in mid-air, I press E to automatically deploy the parachute
When I deploy the parachute in mid-air, I press E again to close the parachute
Is this possible?
This is the parachute plugin I'm using
Plugin source: [ZP] GamePlay modifier: Parachute v1.4
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <zombieplague>
new const MODEL_PARACHUTE[] = "models/93parachute2.mdl"
new g_has_parachute[33], g_para_ent[33];
new g_cvar_hum, g_cvar_surv, g_cvar_zomb, g_cvar_nem, g_cvar_fallspeed, g_cvar_detach, Float:g_FallSpeed
public plugin_init()
{
register_plugin("[ZPNM] Parachute", "1.4", "Random1, D i 5 7 i n c T, C")
RegisterHam(Ham_Spawn, "player", "fwHamSpawnPlayer", 1)
RegisterHam(Ham_Killed, "player", "fwHamKilledPlayer", 1)
g_cvar_hum = register_cvar("zpnm_parachute_hum", "1")
g_cvar_surv = register_cvar("zpnm_parachute_surv", "1")
g_cvar_zomb = register_cvar("zpnm_parachute_zomb", "1")
g_cvar_nem = register_cvar("zpnm_parachute_nem", "1")
g_cvar_fallspeed = register_cvar("zpnm_parachute_fallspeed", "25")
g_cvar_detach = register_cvar("zpnm_parachute_detach", "1")
}
public plugin_precache()
precache_model(MODEL_PARACHUTE)
public plugin_cfg()
set_task(1.57, "cache_settings")
public cache_settings()
{
g_cvar_hum = get_pcvar_num(g_cvar_hum)
g_cvar_surv = get_pcvar_num(g_cvar_surv)
g_cvar_zomb = get_pcvar_num(g_cvar_zomb)
g_cvar_nem = get_pcvar_num(g_cvar_nem)
g_FallSpeed = get_pcvar_float(g_cvar_fallspeed) * -1.0
g_cvar_detach = get_pcvar_num(g_cvar_detach)
}
public client_disconnect(id)
parachute_reset(id, 1)
parachute_reset(id, remove = 0)
{
if (g_para_ent[id] > 0 && is_valid_ent(g_para_ent[id]))
{
remove_entity(g_para_ent[id]);
g_para_ent[id] = 0
}
if (!remove)
g_has_parachute[id] = true
else
g_has_parachute[id] = false
}
public fwHamSpawnPlayer(id)
{
if (!is_user_alive(id))
return;
if (!g_cvar_hum)
{
if (g_has_parachute[id])
parachute_reset(id, 1)
return;
}
parachute_reset(id)
}
public zp_user_infected_post(id, infector, nemesis)
{
if (!nemesis && g_cvar_zomb || nemesis && g_cvar_nem)
parachute_reset(id)
else
parachute_reset(id, 1)
}
public zp_user_humanized_post(id, survivor)
{
if (!survivor && g_cvar_hum || survivor && g_cvar_surv)
parachute_reset(id)
else
parachute_reset(id, 1)
}
public fwHamKilledPlayer(id)
parachute_reset(id, 1)
public client_PreThink(id)
{
//Parachute model animation information
//0 - deploy - 84 frames
//1 - idle - 39 frames
//2 - detach - 29 frames
if (!g_has_parachute[id])
return;
static flags, Float:frame, button, oldbutton
button = get_user_button(id)
oldbutton = get_user_oldbutton(id)
flags = get_entity_flags(id)
if (g_para_ent[id] > 0 && (flags & FL_ONGROUND))
{
if (g_cvar_detach)
{
if (entity_get_int(g_para_ent[id],EV_INT_sequence) != 2)
{
entity_set_int(g_para_ent[id], EV_INT_sequence, 2)
entity_set_int(g_para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(g_para_ent[id], EV_FL_frame, 0.0)
entity_set_float(g_para_ent[id], EV_FL_fuser1, 0.0)
entity_set_float(g_para_ent[id], EV_FL_animtime, 0.0)
return;
}
frame = entity_get_float(g_para_ent[id],EV_FL_fuser1) + 2.0
entity_set_float(g_para_ent[id],EV_FL_fuser1,frame)
entity_set_float(g_para_ent[id],EV_FL_frame,frame)
if (frame > 254.0)
parachute_reset(id)
}
else
parachute_reset(id)
return;
}
if (button & IN_USE)
{
new Float:velocity[3];
entity_get_vector(id, EV_VEC_velocity, velocity);
if (velocity[2] < 0.0)
{
if(g_para_ent[id] <= 0)
{
g_para_ent[id] = create_entity("info_target")
if(g_para_ent[id] > 0)
{
entity_set_string(g_para_ent[id],EV_SZ_classname,"parachute")
entity_set_edict(g_para_ent[id], EV_ENT_aiment, id)
entity_set_edict(g_para_ent[id], EV_ENT_owner, id)
entity_set_int(g_para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_model(g_para_ent[id], MODEL_PARACHUTE)
entity_set_int(g_para_ent[id], EV_INT_sequence, 0)
entity_set_int(g_para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(g_para_ent[id], EV_FL_frame, 0.0)
entity_set_float(g_para_ent[id], EV_FL_fuser1, 0.0)
}
}
else if (g_para_ent[id] > 0)
{
entity_set_int(id, EV_INT_sequence, 3)
entity_set_int(id, EV_INT_gaitsequence, 1)
entity_set_float(id, EV_FL_frame, 1.0)
entity_set_float(id, EV_FL_framerate, 1.0)
velocity[2] = (velocity[2] + 40.0 < g_FallSpeed) ? velocity[2] + 40.0 : g_FallSpeed
entity_set_vector(id, EV_VEC_velocity, velocity)
if (entity_get_int(g_para_ent[id],EV_INT_sequence) == 0)
{
frame = entity_get_float(g_para_ent[id],EV_FL_fuser1) + 1.0
entity_set_float(g_para_ent[id],EV_FL_fuser1,frame)
entity_set_float(g_para_ent[id],EV_FL_frame,frame)
if (frame > 100.0)
{
entity_set_float(g_para_ent[id], EV_FL_animtime, 0.0)
entity_set_float(g_para_ent[id], EV_FL_framerate, 0.4)
entity_set_int(g_para_ent[id], EV_INT_sequence, 1)
entity_set_int(g_para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(g_para_ent[id], EV_FL_frame, 0.0)
entity_set_float(g_para_ent[id], EV_FL_fuser1, 0.0)
}
}
}
}
else if (g_para_ent[id] > 0)
parachute_reset(id)
}
else if ((oldbutton & IN_USE) && g_para_ent[id] > 0)
parachute_reset(id)
}