View Single Post
MrPower
Member
Join Date: Feb 2016
Old 04-18-2024 , 14:02   Re: Cerere Plugins Furien
Reply With Quote #12

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>
#include <dhudmessage>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <fun>
#include <fcs>

#define PLUGIN_NAME "AvH_Baza"
#define PLUGIN_AUTHOR "Askhanar"
#define PLUGIN_VERSION "1.0"

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

#define Alien_Team    CS_TEAM_T
#define Human_Team    CS_TEAM_CT

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

// --| Tag-ul mesajului din chat.
new const g_szTag[ ] = "AvH";

new 
FloatWallorigin[33][3]

new 
Float:g_last_LongJump_time[33]

new 
bool:g_hasLongJump[33]

new 
g_iWing[33]

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
new cvar_start_human_hp;
new 
cvar_start_human_ap;
new 
cvar_start_human_gravity;

new 
cvar_alien_longjump_force;
new 
cvar_alien_longjump_height;
new 
cvar_alien_longjump_cooldown;

new 
cvar_start_alien_hp;
new 
cvar_start_alien_ap;
new 
cvar_start_alien_speed;
new 
cvar_start_alien_damage;

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
    
//Cvars Alien
    
cvar_start_alien_hp register_cvar("alien_hp","450");    //Seteaza HP maxim pe care il poate avea Alien (default "500")
    
cvar_start_alien_ap register_cvar("alien_ap","150");    //Seteaza AP maxim pe care il poate avea Alien (default "500")
    
cvar_start_alien_speed register_cvar("alien_speed","400.0");    //Seteaza Speed maxim pe care il poate avea Alien (default "2.0")    
    
cvar_start_alien_damage register_cvar("alien_damage""2.5");    //Seteaza Damage maxim pe care il poate avea Alien (default "10.0")
    
    
cvar_start_human_hp register_cvar("human_hp","300");    //Seteaza HP maxim pe care il poate avea Human (default "500")
    
cvar_start_human_ap register_cvar("human_ap","150");    //Seteaza AP maxim pe care il poate avea Human (default "500")
    
cvar_start_human_gravity register_cvar("human_gravity","0.375");    //Seteaza Gravity maxim pe care il poate avea Human (default "1.0")
    
    
cvar_alien_longjump_force register_cvar("alien_longjump_force""550");
    
cvar_alien_longjump_height register_cvar("alien_longjump_height""255");
    
cvar_alien_longjump_cooldown register_cvar("alien_longjump_cooldown""5.0");
    
    
RegisterHam(Ham_TakeDamage"player""Fw_TakeDamage" );
    
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1);
    
    
RegisterHam(Ham_Player_ResetMaxSpeed"player""Player_ResetMaxSpeed"1);
    
    
RegisterHam(Ham_Touch"player""fw_PlayerTouch"1);
    
    
register_forward(FM_PlayerPostThink"fw_PlayerPostThink");
    
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink");
    
    
register_event("DeathMsg""death""a");
    
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
    
    
register_think("check_speed""Alien_Invizible");
    
    new 
iEnt
    iEnt 
create_entity("info_target");
    
    
set_pev(iEntpev_classname"check_speed")
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1)

}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public client_disconnect(id)
{
    
g_hasLongJump[id] = false;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public death()
{
    
g_hasLongJump[read_data(2)] = false;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public event_round_start()
{
    for (new 
1<= 32i++)
    {
        if (
get_user_team(i) == 1
            
g_hasLongJump[i] = true;
        else
            
g_hasLongJump[i] = false
    }
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public Player_Spawn_Postid )
{
    if( 
is_user_alive(id) )
    {
        if(
cs_get_user_team(id) == Alien_Team )
        {
            
            
set_user_healthidget_pcvar_numcvar_start_alien_hp ) );
            
set_user_armoridget_pcvar_numcvar_start_alien_ap ) );

            
set_user_footsteps(id1)
            
            
g_hasLongJump[id] = true;
            
            
ColorChat(id"!t[!g%s!t] !yYou received a !t[!gLong Jump!t] !g. !yTo use it!g, !ytap !gctrl !yand !gjump !ywhile going forward !t."g_szTag);
            
            
ColorChat(id"!t[!g%s!t] !yPress !t[!gN!t] !yfor !gNighvision !t."g_szTag);
        }
        
        else
        {
            
set_user_footsteps(id0)
            
            
g_hasLongJump[id] = false
        }

        if(
cs_get_user_team(id) == Human_Team )
        {
            
set_user_gravityidget_pcvar_floatcvar_start_human_gravity ) );
            
            
set_user_healthidget_pcvar_numcvar_start_human_hp ) );
            
set_user_armoridget_pcvar_numcvar_start_human_ap ) );

            
set_user_footsteps(id1)
            
            
ColorChat(id"!t[!g%s!t] !yPress !t[!gN!t] !yfor !gNighvision !t."g_szTag);
        }
        
        else
        {
            
set_user_footsteps(id0)
            
set_user_gravity(id1.0)
        }        
    }
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public Fw_TakeDamageiVictimiInflictoriAttackerFloat:fDamageiDamageBits )
{
    if( 
iInflictor == iAttacker && is_user_aliveiAttacker ) && get_user_weaponiAttacker ) == CSW_KNIFE && cs_get_user_teamiAttacker ) == Alien_Team )
    {
        
SetHamParamFloat4fDamage get_pcvar_floatcvar_start_alien_damage ) );
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;


/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public Player_ResetMaxSpeedid )
{
    if( 
is_user_alive(id) && cs_get_user_team(id) == Alien_Team && get_user_maxspeed(id) != 1.0 )
    {
        
set_pevidpev_maxspeedget_pcvar_floatcvar_start_alien_speed ) )
    }
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public fw_PlayerTouch(idworld)
{
    if( 
is_user_alive(id) && cs_get_user_team(id) == Alien_Team )
    {     
        new 
ClassName[32];
        
pev(worldpev_classnameClassName,(32-1));
        
        if(
equal(ClassName"worldspawn") || equal(ClassName"func_wall") || equal(ClassName"func_breakable"))
            
pev(idpev_originWallorigin[id]);
    }
    
    return 
HAM_SUPERCEDE;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public fw_PlayerPostThink(id)
{
    if( 
is_user_alive(id) && cs_get_user_team(id) == Alien_Team )
    {
        static 
Float:Origin[3];
        
pev(idpev_originOrigin);
        
        static 
Button;
        
Button pev(idpev_button);
        
        if(
get_distance_f(OriginWallorigin[id]) <= 5.0 && !(pev(idpev_flags) & FL_ONGROUND))
        {
            new 
Float:Velocity[3];
            new 
ClimbSpeed floatround(pev(idpev_maxspeed) / 2.0);
            if(
Button IN_FORWARD)
            {
                
velocity_by_aim(idClimbSpeedVelocity);
                
fm_set_user_velocity(idVelocity);
            }
            
            else if(
Button IN_BACK)
            {
                
velocity_by_aim(id, - ClimbSpeedVelocity);
                
fm_set_user_velocity(idVelocity);
            }
            
            else
            {
                
set_pev(idpev_originWallorigin[id]);
                
velocity_by_aim(id0Velocity);
                
fm_set_user_velocity(idVelocity);
            }
        }
    }
}  

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public Alien_InvizibleiEnt )
{
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1)
    
    new 
iInvisibility
    
new players[32], pnumtempid,Float:fVecVelocity[3], iSpeed;
    
get_players(playerspnum"a"); 
    
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i];
        
        if ( 
get_user_team tempid ) == 
        {
            if( 
get_user_weapon(tempid) == CSW_KNIFE )
            {
                
entity_get_vector(tempidEV_VEC_velocityfVecVelocity)
                
iSpeed floatroundvector_length(fVecVelocity) )
                
                if( 
iSpeed <255// und langsamer als 255 ist
                
{
                    
iInvisibility iSpeed - (256 iSpeed) / 3
                    
                    
if( iInvisibility )
                    {
                        
iInvisibility 0
                    
}
                    
set_user_rendering(tempidkRenderFxNone000kRenderTransAlpha,iInvisibility)
                    
                    
                }
                
                else
                {
                    
set_user_rendering(tempidkRenderFxNone000kRenderNormal0
                }
            }
            
            else
            {
                
set_user_rendering(tempidkRenderFxNone000kRenderNormal0)
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED;

    static 
prev_buttons[33];

    if (
prev_buttons[id] & IN_JUMP && !(pev(idpev_button) & IN_JUMP)) 
    {
        if (
is_valid_ent(g_iWing[id])) 
        {
            
remove_entity(g_iWing[id]);
        }
    }
    
    else if (!(
prev_buttons[id] & IN_JUMP) && (pev(idpev_button) & IN_JUMP) && g_hasLongJump[id]) 
    {
        new 
iEntity g_iWing[id];
        
        if (!
is_valid_ent(iEntity)) 
        {
            if (!(
iEntity g_iWing[id] = create_entity("info_target"))) 
            {
                return 
FMRES_IGNORED;
            }

            
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_FOLLOW);
            
entity_set_edict(iEntityEV_ENT_aimentid);
        }
    }

    
prev_buttons[id] = pev(idpev_button);
   
    if (
allow_LongJump(id))
    {
        static 
Float:velocity[3];
        
velocity_by_aim(idget_pcvar_num(cvar_alien_longjump_force), velocity);
      
        
velocity[2] = get_pcvar_float(cvar_alien_longjump_height);
      
        
set_pev(idpev_velocityvelocity);
      
        
g_last_LongJump_time[id] = get_gametime();
    }
   
    return 
FMRES_IGNORED;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------*/

public allow_LongJump(id)
{
    if (!
g_hasLongJump[id])
        return 
false;

    if (!(
pev(idpev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
        return 
false;

    static 
buttons
    buttons 
pev(idpev_button)

    if (!
is_user_bot(id) && (!(buttons IN_JUMP) || !(buttons IN_DUCK)))
        return 
false;

    static 
Float:cooldown
    cooldown 
get_pcvar_float(cvar_alien_longjump_cooldown)

    
// Verificăm dacă long jump-ul este gata să fie folosit din nou
    
if (get_gametime() >= g_last_LongJump_time[id] + cooldown)
    {
        
g_last_LongJump_time[id] = get_gametime(); 
        
        
// Afișăm mesajul doar atunci cānd longjump-ul este complet īncărcat și este gata să fie folosit din nou
        
set_hudmessage(01272550.810.7906.01.0);
        
show_hudmessage(id"-=== LONG JUMP ===- ^nIs ready to use again !");
        
        return 
true
    }

    return 
false;
}

/*=================================================================================================================*/
/*----------------------------------------------[ ColorChat ]-----------------------------------------*/
/*=================================================================================================================*/

stock ColorChat(const id, const input[], any:...) {
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // verde
    
replace_all(msg190"!y""^1"); // galben/alb/negru
    
replace_all(msg190"!t""^3"); // rosu/albastru/gri
    
    
if(idplayers[0] = id;
    else 
get_players(playerscount"ch"); {
        for(new 
0counti++) {
            if(
is_user_connected(id)) {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _id);
                
write_byte(id);
                
write_string(msg);
                
message_end();
            }
        }
    } 
}

/*=================================================================================================================*/
/*----------------------------------------------[ ColorChat Sfarsit ]---------------------------------*/
/*=================================================================================================================*/

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }


Last edited by MrPower; 04-18-2024 at 14:04.
MrPower is offline