Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
|
02-24-2022
, 12:41
Re: freezing shield
|
#3
|
If in the end I end up seeing the conditions in magneto, and use part of the subzero code, although I should see a better way to make it work, but it works when you get hit with knife
PHP Code:
// Frozen!
/* CVARS - copy and paste to shconfig.cfg
// Frozen Shield
frozen_level 10
frozen_cooldown 25 //cooldown para tener el escudo
frozen_stuntime 3 //cuanto tiempo queda stuneado
frozen_percent 0.15 //porcentaje segun el cual se activa el poder
*/
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Frozen"
new bool:gHasFrozen[SH_MAXSLOTS+1]
new const gSoundDisarm[] = "shmod/freezed.wav"
new pCvarCooldown, pCvarStun, pcvarPercent
new const MODEL_FROZENS[] = "models/shmod/frozenshield.mdl";
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Frozen", SH_VERSION_STR, "AssKicR / JTP10181 / Lucas Arje")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("frozen_level", "10")
pCvarCooldown = register_cvar("frozen_cooldown", "3")
pCvarStun = register_cvar("frozen_stuntime", "3")
pcvarPercent = register_cvar("frozen_percent", "0.15")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Congela a quién quiera lastimarte.", "Cuando te pegan un Fakaso tenes una probabilidad de poder congelarlos.")
sh_set_hero_shield(gHeroID, true)
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_sound(gSoundDisarm)
precache_model(MODEL_FROZENS)
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
gHasFrozen[id] = mode ? true : false
sh_debug_message(id, 1, "%s %s", gHeroName, mode ? "ADDED" : "DROPPED")
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
if ( gHasFrozen[id] ) {
gPlayerInCooldown[id] = false
RemoveByClass(id)
}
}
//----------------------------------------------------------------------------------------------
public client_damage(attacker, victim, damage, wpnindex)
{
if ( !sh_is_active() ) return
if ( damage <= 0 || victim == attacker ) return
if ( !is_user_alive(victim) || !is_user_alive(attacker) ) return
if ( !gHasFrozen[victim] || gPlayerInCooldown[victim] ) return
new slot = sh_get_weapon_slot(wpnindex)
new randnum = random_num(0, 100)
new frozenchanche = floatround(get_pcvar_float(pcvarPercent) * 100)
if ( slot == 3 && frozenchanche >= randnum ) {
new Float:cooldown = get_pcvar_float(pCvarCooldown)
if ( cooldown > 0.0 ) sh_set_cooldown(victim, cooldown)
// Disarm enemy and get their gun!
//play_sound(victim)
new id = attacker
new Float:stuntime = get_pcvar_float(pCvarStun)
sh_set_stun(id, stuntime, 1.0)
//Screen Flash - sse le pone la pantalla al que te ataco por un segundo de color celeste
new alphanum = clamp((damage * 2), 40, 200)
sh_screen_fade(attacker, 1.0, 0.5, 0, 255, 255, alphanum)
//Poner model y sacar model
freezed(id)
play_sound(id)
set_task(stuntime, "RemoveByClass", id)
// ESto es para que no se le reste hp - Lado de la victima es decir el que tiene el frozen
new u_health = get_user_health(victim)
new newlife = u_health + damage + 1
shAddHPs(victim, damage, newlife)
set_hudmessage(0, 100, 200, 0.02, 0.65, 0, 0.0, 2.0, 0.0, 0.0, 3)
show_hudmessage(victim, "[%s] Congelaste a un Enemigo.", gHeroName)
sh_set_rendering(victim, 0, 255, 255, 16, kRenderFxGlowShell)
set_task(1.0, "frozen_unglow", victim)
}
}
//----------------------------------------------------------------------------------------------
play_sound(id)
{
emit_sound(id, CHAN_AUTO, gSoundDisarm, VOL_NORM, ATTN_NORM, 0, PITCH_HIGH)
set_task(1.5, "stop_sound", id)
}
//----------------------------------------------------------------------------------------------
public stop_sound(id)
emit_sound(id, CHAN_AUTO, gSoundDisarm, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
//----------------------------------------------------------------------------------------------
public freezed(id)
{
new Float:vOrigin[3]
entity_get_vector(id, EV_VEC_origin, vOrigin)
//vOrigin[2] -= 25 //esto es para bajar mas el model.
new icecube = create_entity("info_target")
entity_set_string(icecube, EV_SZ_classname, "icecube")
entity_set_model(icecube, MODEL_FROZENS)
entity_set_size(icecube, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5}) //este es el original
entity_set_int(icecube, EV_INT_solid, 0)
entity_set_int(icecube, EV_INT_movetype, MOVETYPE_NOCLIP)
entity_set_vector(icecube, EV_VEC_origin, vOrigin)
// random orientation //esto es del frostnades esta demas?
new Float:angles[3];
angles[1] = random_float(0.0,360.0);
set_pev(icecube,pev_angles,angles);
//drop_to_floor(icecube)
}
//----------------------------------------------------------------------------------------------
public frozen_unglow(victim)
{
sh_set_rendering(victim)
}
//----------------------------------------------------------------------------------------------
public RemoveByClass(id)
{
new icecube = 0
do {
icecube = find_ent_by_class(icecube, "icecube")
if (icecube > 0)
remove_entity(icecube)
}
while (icecube)
}
|
|