Galera porque sempre q ativo o para-queda a gravidade fica baixa ?
eu pulo e ja cai rapidamente ! pula bem baixo porq ?
eu pulo e ja cai rapidamente ! pula bem baixo porq ?
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >
new const paramodel[] = "models/93parachute2.mdl"
new const paramodel_zm[] = "models/93parachute2.mdl"
new bool:has_parachute[33], para_ent[33];
enum pcvar
{
humans = 1,
survivors,
zombies,
nemesis,
fallspeed,
detach
}
new pcvars[pcvar]
public plugin_init()
{
register_plugin("[ZP] Sub-Plugin: Parachute", "1.2", "Random1, 93()|29!/<")
pcvars[humans] = register_cvar("zp_parachute_humans", "1")
pcvars[survivors] = register_cvar("zp_parachute_survivors", "1")
pcvars[zombies] = register_cvar("zp_parachute_zombies", "0")
pcvars[nemesis] = register_cvar("zp_parachute_nemesis", "0")
pcvars[fallspeed] = register_cvar("zp_parachute_fallspeed", "75")
pcvars[detach] = register_cvar("zp_parachute_detach", "1")
/*=====
register_forward(FM_CmdStart, "fw_CmdStart")
=======*/
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, paramodel)
engfunc(EngFunc_PrecacheModel, paramodel_zm)
}
public client_connect(id)
parachute_reset(id, 1)
public client_disconnect(id)
parachute_reset(id)
parachute_reset(id, keep = 0)
{
if(para_ent[id] > 0 && pev_valid(para_ent[id]))
{
engfunc(EngFunc_RemoveEntity, para_ent[id]);
para_ent[id] = 0
}
if (!keep)
has_parachute[id] = false
else
has_parachute[id] = true
}
public fw_PlayerKilled(victim)
parachute_reset(victim)
public fw_PlayerSpawn_Post(id)
{
if (!is_user_alive(id))
return;
if (get_pcvar_num(pcvars[humans]))
{
parachute_reset(id, 1)
return;
}
parachute_reset(id)
}
/*=====
public fw_CmdStart(id, handle)
{
if (!has_parachute[id])
return;
static button
button = get_uc(UC_Handle, UC_Buttons)
}
=======*/
public fw_PreThink(id)
{
//Parachute model animation information
//0 - deploy - 84 frames
//1 - idle - 39 frames
//2 - detach - 29 frames
if (!has_parachute[id])
return;
new Float:fallingspeed = get_pcvar_float(pcvars[fallspeed]) * -1.0;
new Float:frame;
new button = pev(id, pev_button);
new oldbutton = pev(id, pev_oldbuttons);
new flags = pev(id, pev_flags);
if (para_ent[id] > 0 && (flags & FL_ONGROUND))
{
if (get_pcvar_num(pcvars[detach]))
{
if (pev(para_ent[id],pev_sequence)!= 2)
{
set_pev(para_ent[id], pev_sequence, 2);
set_pev(para_ent[id], pev_gaitsequence, 1);
set_pev(para_ent[id], pev_frame, 0.0);
set_pev(para_ent[id], pev_fuser1, 0.0);
set_pev(para_ent[id], pev_animtime, 0.0);
return;
}
pev(para_ent[id],pev_fuser1, frame);
frame += 2.0;
set_pev(para_ent[id],pev_fuser1,frame);
set_pev(para_ent[id],pev_frame,frame);
if (frame > 254.0)
parachute_reset(id, 1)
}
else
parachute_reset(id, 1)
return;
}
if (button & IN_USE)
{
new Float:velocity[3];
pev(id, pev_velocity, velocity);
if (velocity[2] < 0.0)
{
if(para_ent[id] <= 0)
{
para_ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if(para_ent[id] > 0)
{
set_pev(para_ent[id],pev_classname,"parachute");
set_pev(para_ent[id], pev_aiment, id)
set_pev(para_ent[id], pev_owner, id);
set_pev(para_ent[id], pev_movetype, MOVETYPE_FOLLOW);
if (!zp_get_user_zombie(id))
engfunc(EngFunc_SetModel, para_ent[id], paramodel);
else
engfunc(EngFunc_SetModel, para_ent[id], paramodel_zm);
set_pev(para_ent[id], pev_sequence, 0);
set_pev(para_ent[id], pev_gaitsequence, 1);
set_pev(para_ent[id], pev_frame, 0.0);
set_pev(para_ent[id], pev_fuser1, 0.0);
}
}
if (para_ent[id] > 0)
{
set_pev(id, pev_sequence, 3)
set_pev(id, pev_gaitsequence, 1)
set_pev(id, pev_frame, 1.0)
set_pev(id, pev_framerate, 1.0)
velocity[2] = (velocity[2] + 40.0 < fallingspeed)? velocity[2] + 40.0 : fallingspeed
set_pev(id, pev_velocity, velocity)
if (pev(para_ent[id],pev_sequence)== 0)
{
pev(para_ent[id],pev_fuser1, frame);
frame += 1.0;
set_pev(para_ent[id],pev_fuser1,frame);
set_pev(para_ent[id],pev_frame,frame);
if (frame > 100.0)
{
set_pev(para_ent[id], pev_animtime, 0.0);
set_pev(para_ent[id], pev_framerate, 0.4);
set_pev(para_ent[id], pev_sequence, 1);
set_pev(para_ent[id], pev_gaitsequence, 1);
set_pev(para_ent[id], pev_frame, 0.0);
set_pev(para_ent[id], pev_fuser1, 0.0);
}
}
}
}
else if (para_ent[id] > 0)
parachute_reset(id, 1)
}
else if ((oldbutton & IN_USE) && para_ent[id] > 0)
parachute_reset(id, 1)
}
public zp_user_infected_post(id, nemesis)
{
if ((nemesis && !get_pcvar_num(pcvars[nemesis]))
|| !get_pcvar_num(pcvars[zombies]))
return;
parachute_reset(id)
}
public zp_user_humanized_post(id, survivor)
{
if ((survivor && !get_pcvar_num(pcvars[survivors]))
|| !get_pcvar_num(pcvars[humans]))
return;
parachute_reset(id)
}