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 Float: Wallorigin[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_NAME, PLUGIN_VERSION, PLUGIN_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(iEnt, pev_classname, "check_speed")
set_pev(iEnt, pev_nextthink, get_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 i = 1; i <= 32; i++)
{
if (get_user_team(i) == 1)
g_hasLongJump[i] = true;
else
g_hasLongJump[i] = false;
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public Player_Spawn_Post( id )
{
if( is_user_alive(id) )
{
if(cs_get_user_team(id) == Alien_Team )
{
set_user_health( id, get_pcvar_num( cvar_start_alien_hp ) );
set_user_armor( id, get_pcvar_num( cvar_start_alien_ap ) );
set_user_footsteps(id, 1)
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(id, 0)
g_hasLongJump[id] = false;
}
if(cs_get_user_team(id) == Human_Team )
{
set_user_gravity( id, get_pcvar_float( cvar_start_human_gravity ) );
set_user_health( id, get_pcvar_num( cvar_start_human_hp ) );
set_user_armor( id, get_pcvar_num( cvar_start_human_ap ) );
set_user_footsteps(id, 1)
ColorChat(id, "!t[!g%s!t] !yPress !t[!gN!t] !yfor !gNighvision !t.", g_szTag);
}
else
{
set_user_footsteps(id, 0)
set_user_gravity(id, 1.0)
}
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public Fw_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits )
{
if( iInflictor == iAttacker && is_user_alive( iAttacker ) && get_user_weapon( iAttacker ) == CSW_KNIFE && cs_get_user_team( iAttacker ) == Alien_Team )
{
SetHamParamFloat( 4, fDamage * get_pcvar_float( cvar_start_alien_damage ) );
return HAM_HANDLED;
}
return HAM_IGNORED;
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public Player_ResetMaxSpeed( id )
{
if( is_user_alive(id) && cs_get_user_team(id) == Alien_Team && get_user_maxspeed(id) != 1.0 )
{
set_pev( id, pev_maxspeed, get_pcvar_float( cvar_start_alien_speed ) )
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public fw_PlayerTouch(id, world)
{
if( is_user_alive(id) && cs_get_user_team(id) == Alien_Team )
{
new ClassName[32];
pev(world, pev_classname, ClassName,(32-1));
if(equal(ClassName, "worldspawn") || equal(ClassName, "func_wall") || equal(ClassName, "func_breakable"))
pev(id, pev_origin, Wallorigin[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(id, pev_origin, Origin);
static Button;
Button = pev(id, pev_button);
if(get_distance_f(Origin, Wallorigin[id]) <= 5.0 && !(pev(id, pev_flags) & FL_ONGROUND))
{
new Float:Velocity[3];
new ClimbSpeed = floatround(pev(id, pev_maxspeed) / 2.0);
if(Button & IN_FORWARD)
{
velocity_by_aim(id, ClimbSpeed, Velocity);
fm_set_user_velocity(id, Velocity);
}
else if(Button & IN_BACK)
{
velocity_by_aim(id, - ClimbSpeed, Velocity);
fm_set_user_velocity(id, Velocity);
}
else
{
set_pev(id, pev_origin, Wallorigin[id]);
velocity_by_aim(id, 0, Velocity);
fm_set_user_velocity(id, Velocity);
}
}
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public Alien_Invizible( iEnt )
{
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
new iInvisibility
new players[32], pnum, tempid,Float:fVecVelocity[3], iSpeed;
get_players(players, pnum, "a");
for( new i; i<pnum; i++ )
{
tempid = players[i];
if ( get_user_team ( tempid ) == 1 )
{
if( get_user_weapon(tempid) == CSW_KNIFE )
{
entity_get_vector(tempid, EV_VEC_velocity, fVecVelocity)
iSpeed = floatround( vector_length(fVecVelocity) )
if( iSpeed <255) // und langsamer als 255 ist
{
iInvisibility = iSpeed - (256 - iSpeed) / 3
if( iInvisibility < 0 )
{
iInvisibility = 0
}
set_user_rendering(tempid, kRenderFxNone, 0, 0, 0, kRenderTransAlpha,iInvisibility)
}
else
{
set_user_rendering(tempid, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}
}
else
{
set_user_rendering(tempid, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}
}
}
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(id, pev_button) & IN_JUMP))
{
if (is_valid_ent(g_iWing[id]))
{
remove_entity(g_iWing[id]);
}
}
else if (!(prev_buttons[id] & IN_JUMP) && (pev(id, pev_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(iEntity, EV_INT_movetype, MOVETYPE_FOLLOW);
entity_set_edict(iEntity, EV_ENT_aiment, id);
}
}
prev_buttons[id] = pev(id, pev_button);
if (allow_LongJump(id))
{
static Float:velocity[3];
velocity_by_aim(id, get_pcvar_num(cvar_alien_longjump_force), velocity);
velocity[2] = get_pcvar_float(cvar_alien_longjump_height);
set_pev(id, pev_velocity, velocity);
g_last_LongJump_time[id] = get_gametime();
}
return FMRES_IGNORED;
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
public allow_LongJump(id)
{
if (!g_hasLongJump[id])
return false;
if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
return false;
static buttons
buttons = pev(id, pev_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(0, 127, 255, 0.81, 0.79, 0, 6.0, 1.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 = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^4"); // verde
replace_all(msg, 190, "!y", "^1"); // galben/alb/negru
replace_all(msg, 190, "!t", "^3"); // rosu/albastru/gri
if(id) players[0] = id;
else get_players(players, count, "ch"); {
for(new i = 0; i < count; i++) {
if(is_user_connected(id)) {
message_begin(MSG_ONE_UNRELIABLE, get_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 }
*