RSSy MYGO.pl Opublikowano Lipiec 2, 2024 o 20:17 RSSy Udostępnij Opublikowano Lipiec 2, 2024 o 20:17 I'm using this REAPI parachute. Everything works alright but the model doesn't appear completely, the players just open their arms and fly with no parachute opening. Is there a way to fix this? Thanks! PHP Code: #pragma semicolon 1 #include <amxmodx> #include <reapi> #define PLUGIN_NAME "ReParachute" #define PLUGIN_VERS "1.5" #define PLUGIN_AUTH "PurposeLess" new model_ent[MAX_CLIENTS + 1], bool:g_alive[MAX_CLIENTS + 1], bool:gravity_save, bool:firststart, authorization_flag_str[64], authorization_flag, Float:user_gravity[MAX_CLIENTS + 1]; new const para_model[] = "models/parachute.mdl"; new para_model_index; new HookChain:CBasePlayer_PreThink; public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH); hook_cvar_change(create_cvar("sv_parachute", "1", _, "Enable / Disable Parachute", true, 0.0, true, 1.0), "@sv_gravity"); CBasePlayer_PreThink = RegisterHookChain(RG_CBasePlayer_PreThink, "@CBasePlayer_PreThink", .post=false); RegisterHookChain(RG_CBasePlayer_Spawn, "@CBasePlayer_Spawn", .post=true); RegisterHookChain(RG_CBasePlayer_Killed, "@CBasePlayer_Killed", .post=false); } public plugin_cfg() { if(firststart) { EnableHookChain(CBasePlayer_PreThink); set_cvar_num("sv_parachute", 1); } else { DisableHookChain(CBasePlayer_PreThink); set_cvar_num("sv_parachute", 0); } } public client_disconnected(id) { g_alive[id] = false; @reset_parachute(id); } @sv_gravity(const pcvar, const old_value[], const new_value[]) { if(str_to_num(new_value)) { EnableHookChain(CBasePlayer_PreThink); } else { DisableHookChain(CBasePlayer_PreThink); for(new id = 1; id <= MaxClients; id++) { if(g_alive[id]) { @reset_parachute(id); } } } } @CBasePlayer_Spawn(const id) { g_alive[id] = true; user_gravity[id] = 1.0; @reset_parachute(id); } @CBasePlayer_Killed(const victim, const attacker) { g_alive[victim] = false; @reset_parachute(victim); } @CBasePlayer_PreThink(const id) { if(!g_alive[id]) { return; } if(authorization_flag && ~get_user_flags(id) & authorization_flag) { @reset_parachute(id); return; } static waterlevel; waterlevel = get_entvar(id, var_waterlevel); if(waterlevel > 0) { @reset_parachute(id); return; } static button, oldbuttons; button = get_entvar(id, var_button); oldbuttons = get_entvar(id, var_oldbuttons); if(button & IN_USE) { static Float:velocity[3]; get_entvar(id, var_velocity, velocity); if(velocity[2] < 0.0) { if(!model_ent[id]) { model_ent[id] = rg_create_entity("info_target"); set_entvar(model_ent[id], var_model, para_model); set_entvar(model_ent[id], var_modelindex, para_model_index); set_entvar(model_ent[id], var_movetype, MOVETYPE_FOLLOW); set_entvar(model_ent[id], var_aiment, id); set_entvar(model_ent[id], var_sequence, 0); set_entvar(model_ent[id], var_gaitsequence, 1); } static Float:gravity; gravity = get_entvar(id, var_gravity); if(gravity_save && gravity != 0.1) { user_gravity[id] = gravity; } velocity[2] = floatmin(velocity[2] + 40.0, -100.0); set_entvar(id, var_sequence, 3); set_entvar(id, var_gaitsequence, 1); set_entvar(id, var_velocity, velocity); set_entvar(id, var_gravity, 0.1); } else { @reset_parachute(id); } } else if(oldbuttons & IN_USE) { @reset_parachute(id); } } @reset_parachute(const id) { if(model_ent[id]) { set_entvar(model_ent[id], var_flags, FL_KILLME); model_ent[id] = 0; } if(g_alive[id] && get_entvar(id, var_gravity) == 0.1) { set_entvar(id, var_gravity, gravity_save ? user_gravity[id] : 1.0); } } public plugin_precache() { para_model_index = precache_model(para_model); new filename[39]; get_localinfo("amxx_configsdir", filename, charsmax(filename)); format(filename, charsmax(filename), "%s/reparachute.ini", filename); if(!file_exists(filename)) { log_amx("%s file does not exist. ReParachute is down.", filename); pause("d"); return; } new file = fopen(filename, "rt"); if(file) { new buffer[128], key[32], value[64]; while(!feof(file)) { fgets(file, buffer, charsmax(buffer)); trim(buffer); if(buffer[0] == ';' || !buffer[0]) { continue; } strtok(buffer, key, charsmax(key), value, charsmax(value), '='); switch(key[12]) { case 'g': { gravity_save = bool:(value[2] == 'N'); } case 'a': { replace_all(value, charsmax(value), " ", ""); remove_quotes(value); if(value[0]) { formatex(authorization_flag_str, charsmax(authorization_flag_str), value); authorization_flag = read_flags(authorization_flag_str); } } case 's': { firststart = bool:(value[2] == 'N'); } } } fclose(file); } } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi