Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSreparachute problem


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
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_NAMEPLUGIN_VERSPLUGIN_AUTH);

    
hook_cvar_change(create_cvar("sv_parachute""1"_"Enable / Disable Parachute"true0.0true1.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 1id <= MaxClientsid++)
        {
            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(idvar_waterlevel);

    if(
waterlevel 0)
    {
        @
reset_parachute(id);
        return;
    }

    static 
buttonoldbuttons;
    
button get_entvar(idvar_button);
    
oldbuttons get_entvar(idvar_oldbuttons);

    if(
button IN_USE)
    {
        static 
Float:velocity[3];
        
get_entvar(idvar_velocityvelocity);

        if(
velocity[2] < 0.0)
        {
            if(!
model_ent[id])
            {
                
model_ent[id] = rg_create_entity("info_target");

                
set_entvar(model_ent[id], var_modelpara_model);
                
set_entvar(model_ent[id], var_modelindexpara_model_index);
                
set_entvar(model_ent[id], var_movetypeMOVETYPE_FOLLOW);
                
set_entvar(model_ent[id], var_aimentid);
                
set_entvar(model_ent[id], var_sequence0);
                     
set_entvar(model_ent[id], var_gaitsequence1); 
            }

            static 
Float:gravity;
            
gravity get_entvar(idvar_gravity);

            if(
gravity_save && gravity != 0.1)
            {
                
user_gravity[id] = gravity;
            }

            
velocity[2] = floatmin(velocity[2] + 40.0, -100.0);
            
set_entvar(idvar_sequence3);
            
set_entvar(idvar_gaitsequence1);
            
set_entvar(idvar_velocityvelocity);
            
set_entvar(idvar_gravity0.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_flagsFL_KILLME);
        
model_ent[id] = 0;
    }

    if(
g_alive[id] && get_entvar(idvar_gravity) == 0.1)
    {
        
set_entvar(idvar_gravitygravity_save user_gravity[id] : 1.0);
    }
}

public 
plugin_precache()
{        
    
    
para_model_index precache_model(para_model);
    
    
    new 
filename[39];
    
get_localinfo("amxx_configsdir"filenamecharsmax(filename));
    
format(filenamecharsmax(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(filebuffercharsmax(buffer));
            
trim(buffer);

            if(
buffer[0] == ';' || !buffer[0])
            {
                continue;
            }

            
strtok(bufferkeycharsmax(key), valuecharsmax(value), '=');

            switch(
key[12])
            {
                case 
'g': {
                    
gravity_save bool:(value[2] == 'N');
                }
                case 
'a': {
                    
replace_all(valuecharsmax(value), " """);
                    
remove_quotes(value);

                    if(
value[0])
                    {
                        
formatex(authorization_flag_strcharsmax(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

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...