Иконка ресурса

ReParachute 1.5

Нет прав для скачивания
Сообщения
12
Реакции
0
No plugin, a configuração é carregada e o modelo é configurado lá.
I'm using the plugin as the original, without modifications

C#:
#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],
    model_location[64],
    parachute_model_index,
    bool:g_alive[MAX_CLIENTS + 1],
    bool:parachute_model,
    bool:gravity_save,
    bool:firststart,
    authorization_flag_str[64],
    authorization_flag,
    Float:user_gravity[MAX_CLIENTS + 1];
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 (parachute_model && !model_ent[id]) {
                model_ent[id] = rg_create_entity("info_target");
                set_entvar(model_ent[id], var_model, model_location);
                set_entvar(model_ent[id], var_modelindex, parachute_model_index);
                set_entvar(model_ent[id], var_movetype, MOVETYPE_FOLLOW);
                set_entvar(model_ent[id], var_aiment, id);
            }
            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 (parachute_model && 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() {
    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 'm': {
                    replace_all(value, charsmax(value), " ", "");
                    remove_quotes(value);
                    if (value[0]) {
                        formatex(model_location, charsmax(model_location), value);
                        parachute_model = true;
                        parachute_model_index = precache_model(model_location);
                    }
                }
                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);
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
 *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
 */
 
Сообщения
12
Реакции
0
Приложу пару фиксов.
Diff:
#if defined REPARACHUTE_MODEL
-new para_ent[MAX_CLIENTS + 1], parachute_model_index;
+new para_ent[MAX_PLAYERS + 1], parachute_model_index;
Diff:
-if(get_pmove(pm_waterlevel) == 0 && get_pmove(pm_onground) == -1)
+if(get_pmove(pm_waterlevel) == 0)
tested with this version and it's working 100%.

grateful
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу