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

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
 
Сообщения
53
Реакции
12
Здравствуйте. Можно как то пофиксить этот плагин/модуль, что бы он работал на Half Life? В нем всего два инклюда ( #include <amxmodx>, #include <reapi> ), которые присутствуют на ХЛ сервере. Amx_plugins показывает, что плагин запущен и работает, но при прыжке и нажатии на E, не происходит ни каких действий.
 
Сообщения
53
Реакции
12
Nordic Warrior, Спасибо за ответ. Не подскажешь, существует ли вообще плагин парашюта с моделью, который будет работать на Half Life?
 
Сообщения
4
Реакции
0
I have modified this plugin so people can choose the parachute model but it does not work properly. Can someone take a look on it?

C#:
#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>
#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],
Float:user_gravity[MAX_CLIENTS + 1];

new parachute_model[33][64];
new para_model_index[sizeof(MODELS)]; // Store model indexes in an array

new configDir[64];

new const MODELS[][] = {
    "models/p_normal.mdl",
    "models/p_deportive.mdl",
    "models/p_militar.mdl",
    "models/p_militar_blue.mdl",
    "models/p_dragon.mdl",
    "models/p_fenix.mdl"
};

new const NAMES[][] = {
    "Normal",
    "Deportive Parachute",
    "Militar Parachute",
    "Militar Parachute (Blue)",
    "Dragon Wings",
    "Phoenix Wings"
};

public plugin_init() {
    register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH);

    RegisterHookChain(RG_CBasePlayer_PreThink, "@CBasePlayer_PreThink", .post=false);
    RegisterHookChain(RG_CBasePlayer_Spawn, "@CBasePlayer_Spawn", .post=true);
    RegisterHookChain(RG_CBasePlayer_Killed, "@CBasePlayer_Killed", .post=false);

    register_concmd("parachute", "cmdParachuteMenu");

    get_configsdir(configDir, charsmax(configDir));
}

public client_connect(id)
{
    if(get_user_flags(id) & ADMIN_RESERVATION) {
        @reset_parachute(id);
        if (!loadParachute(id)) {
            format(parachute_model[id], sizeof(parachute_model[]), "models/p_normal.mdl");
            saveParachute(id);
        }
    }
}

public client_disconnected(id)
{
    g_alive[id] = false;
    @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(~get_user_flags(id) & ADMIN_RESERVATION) {
        @reset_parachute(id);
        return;
    }

    static water level;
    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, parachute_model[id]);
                set_entvar(model_ent[id], var_modelindex, para_model_index[find_model_index(parachute_model[id])]);
                set_entvar(model_ent[id], var_movetype, MOVETYPE_FOLLOW);
                set_entvar(model_ent[id], var_aiment, id);
                set_entvar(model_ent[id], var_sequence, 1);
                set_entvar(model_ent[id], var_gaitsequence, 1);
            }

            static Float:gravity;
            gravity = get_entvar(id, var_gravity);

            if(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, 1.0);
    }
}

public plugin_precache()
{
    for (new i = 0; i < sizeof MODELS; i++) {
        para_model_index[i] = precache_model(MODELS[i]);
    }
}

public cmdParachuteMenu(id)
{
    if(~get_user_flags(id) & ADMIN_RESERVATION) {
        client_print_color(id, print_team_red, "No access to this menu");
        return;
    }

    new menu = menu_create("\w[ \rPARACHUTE \w] - \dParachute Skins", "menuHandler");

    for (new i = 0; i < sizeof NAMES; i++) {
        if (equal(parachute_model[id], MODELS[i])) {
            new item_name[64];
            format(item_name, sizeof(item_name), "\d%s \w(\rSelected\w)", NAMES[i]);
            menu_additem(menu, item_name, "", 0);
        } else {
            menu_additem(menu, NAMES[i], "", 0);
        }
    }

    menu_setprop(menu, MPROP_EXITNAME, "\rExit");

    menu_display(id, menu, 0);
}

public menuHandler(id, menu, item)
{
    if (item == MENU_EXIT) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    if (item >= 0 && item < sizeof MODELS) {
        format(parachute_model[id], sizeof(parachute_model[]), "%s", MODELS[item]);
        saveParachute(id);
        cmdParachuteMenu(id);
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

saveParachute(id)
{
    new vaultkey[64], vaultdata[128], filedata[2048] = "";
    get_user_authid(id, vaultkey, sizeof(vaultkey));

    if (equal(vaultkey, "STEAM_ID_LAN")) {
        get_user_name(id, vaultkey, sizeof(vaultkey));
    }

    format(vaultdata, sizeof(vaultdata), "%s", parachute_model[id]);

    new vault_path[128];
    format(vault_path, sizeof(vault_path), "%s/parachutes.ini", configDir);

    new vault = fopen(vault_path, "a+");
    if (vault) {
        fclose(vault);
    }

    vault = fopen(vault_path, "r");
    new found = false;

    if (vault) {
        while (!feof(vault)) {
            new line[128];
            fgets(vault, line, sizeof(line));

            if (strlen(line) > 1) {
                trim(line);
                if (equal(line, vaultkey)) {
                    fgets(vault, line, sizeof(line));
                    found = true;
                    add_string(filedata, vaultkey);
                    add_string(filedata, "^n");
                    add_string(filedata, "{");
                    add_string(filedata, vaultdata);
                    add_string(filedata, "}^n");
                } else {
                    add_string(filedata, line);
                    add_string(filedata, "^n");
                }
            }
        }
        fclose(vault);
    }

    if (!found) {
        add_string(filedata, vaultkey);
        add_string(filedata, "^n");
        add_string(filedata, "{");
        add_string(filedata, vaultdata);
        add_string(filedata, "}^n");
    }

    new new_vault = fopen(vault_path, "w");
    if (new_vault) {
        fprintf(new_vault, "%s", filedata);
        fclose(new_vault);
    }
}

loadParachute(id)
{
    new vaultkey[64];
    get_user_authid(id, vaultkey, sizeof(vaultkey));

    if (equal(vaultkey, "STEAM_ID_LAN")) {
        get_user_name(id, vaultkey, sizeof(vaultkey));
    }

    new vault_path[128];
    format(vault_path, sizeof(vault_path), "%s/parachutes.ini", configDir);

    new vault = fopen(vault_path, "r");
    if (vault) {
        while (!feof(vault)) {
            new line[128];
            fgets(vault, line, sizeof(line));

            if (strlen(line) > 1) {
                trim(line);
                if (equal(line, vaultkey)) {
                    fgets(vault, line, sizeof(line));
                    trim(line);

                    new model[64];
                    parse(line, model, sizeof(model));

                    trim(model);
                    if (model[0] == '{')
                        copy(model, sizeof(model) - 1, model[1]);

                    format(parachute_model[id], sizeof(parachute_model[]), "%s", model);
                    fclose(vault);
                    return true;
                }
            }
        }
        fclose(vault);
    }

    format(parachute_model[id], sizeof(parachute_model[]), "models/p_normal.mdl");
    return false;
}

public add_string(dest[], const source[])
{
    new len = strlen(dest);
    format(dest[len], 2048 - len, "%s", source);
}

find_model_index(model[])
{
    for (new i = 0; i < sizeof MODELS; i++) {
        if (equal(MODELS[i], model)) {
            return i;
        }
    }
    return -1;
}
 

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

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