Code: Select all
#include <amxmodx>#include <fakemeta>#include <hamsandwich>#include <engine> new PLUGIN_NAME[] = "Parasiutas"new PLUGIN_AUTHOR[] = "`GuM"new PLUGIN_VERSION[] = "1.0" new const parachute_model[] = "models/parachute.mdl" new bool:has_parachute[33]new para_ent[33]new parachute_FallSpeed, parachute_Detachpublic plugin_init(){ register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) parachute_FallSpeed = register_cvar("parachute_fallspeed", "30") parachute_Detach = register_cvar("parachute_detach", "1") RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawn", 1); register_forward(FM_PlayerPreThink,"PlayerPree_Think");}public plugin_precache(){ engfunc(EngFunc_PrecacheModel, parachute_model)} public Ham_PlayerSpawn(id){ if (!is_user_alive(id)) return if (get_user_flags(id) & ADMIN_LEVEL_H) has_parachute[id] = true} public PlayerPree_Think(id){ if (!is_user_alive(id) || !has_parachute[id] || !(get_user_flags(id) & ADMIN_LEVEL_H)) return new Float:fallspeed = get_pcvar_float(parachute_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)) { set_view(id, CAMERA_NONE) if (get_pcvar_num(parachute_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 ) { engfunc(EngFunc_RemoveEntity, para_ent[id]) para_ent[id] = 0 } } else { engfunc(EngFunc_RemoveEntity, para_ent[id]) para_ent[id] = 0 } return } if (button & IN_USE && get_user_team(id) == 2) { 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) engfunc(EngFunc_SetModel, para_ent[id], parachute_model) 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 < fallspeed) ? velocity[2] + 40.0 : fallspeed 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) { engfunc(EngFunc_RemoveEntity, para_ent[id]) para_ent[id] = 0 } } else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) { engfunc(EngFunc_RemoveEntity, para_ent[id]) para_ent[id] = 0 }}