View Single Post
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 01-21-2022 , 15:58   Help with touch teammates
Reply With Quote #1

Hello, my problem is that this power also freezes your team, I would like this not to happen

PHP Code:
//Sub-Zero From Mortal Kombat

//Credits go to SRGety for forge

/*
//Subzero
subzero_level 0 //At what level is this hero available
subzero_cooldown  2.0 //cooldown for his ice balst
subzero_blastspeed 600 //Speed of SubZero's ice blast
subzero_freezetime 5 //for How long is the player Freezed
subzero_freezeradius 50 //radius for the ice blast
subzero_freezedamage 35 //how much damage the ice blast does

*/
/*
* Version 1.0 Posted
* Version 1.1 Better Freeze Effect + a Freeze Sound
* Version 1.1 Fully converted to amxmodx
*/

#include <amxmodx>
#include <superheromod>
#include <engine>

new gHeroName[]="Sub Zero"
new bool:g_HasSubZeroPower[SH_MAXSLOTS+1]
new 
gLastWeapon[SH_MAXSLOTS+1]
new 
blastring
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Sub-Zero","1.2","Om3gA/Yang")

    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
register_cvar("subzero_level""7" )
    
register_cvar("subzero_cooldown""2.0")
    
register_cvar("subzero_blastspeed""600")
    
register_cvar("subzero_freezetime""5" )
    
register_cvar("subzero_freezeradius""50")
    
register_cvar("subzero_freezedamage""35")

    
shCreateHero(gHeroName"Ice Blast!""Dispara una Bola de Hielo para Congelar a tus Enemigos."true"subzero_level" )

    
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    
register_event("ResetHUD","new_spawn","b")
    
register_touch("ice_blast","*","frozen")
    
// KEY DOWN
    
register_srvcmd("subzero_kd""subzero_kd")
    
shRegKeyDown(gHeroName"subzero_kd")

    
// INIT
    
register_srvcmd("subzero_init""subzero_init")
    
shRegHeroInit(gHeroName"subzero_init")

}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_model("sprites/shmod/iceball.spr")
    
precache_sound("shmod/freezed.wav")
    
precache_model("models/shmod/freezed.mdl")
    
blastring precache_model("sprites/white.spr")
}
//----------------------------------------------------------------------------------------------
public subzero_init()
{
    new 
temp[6]
    
read_argv(1,temp,5)
    new 
id=str_to_num(temp)
    
read_argv(2,temp,5)
    new 
hasPowers=str_to_num(temp)

    
g_HasSubZeroPower[id]=(hasPowers!=0)
}
//----------------------------------------------------------------------------------------------
public subzero_kd()
{
    new 
temp[6]

    if ( !
hasRoundStarted() ) return PLUGIN_HANDLED

    
// First Argument is an id with SubZero Powers!
    
read_argv(1,temp,5)
    new 
id=str_to_num(temp)
    if ( !
is_user_alive(id) || !g_HasSubZeroPower[id] || !shModActive() ) return PLUGIN_HANDLED
    
if ( gPlayerUltimateUsed[id] ) {
        
playSoundDenySelect(id)
        return 
PLUGIN_HANDLED
    
}

    new 
clip,ammo,weaponID get_user_weapon(id,clip,ammo)
    
gLastWeapon[id] = weaponID


    engclient_cmd
(id,"weapon_knife")

    
make_iceblast(id)

    if(
get_cvar_float("subzero_cooldown") > 0.0)
    
ultimateTimer(idget_cvar_float("subzero_cooldown"))

    
// Switch back to previous weapon...
    
if ( gLastWeapon[id] != CSW_KNIFE shSwitchWeaponIDidgLastWeapon[id] )

    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public frozen(pToucherpTouched)
{

    new 
szClassName[32]
    new 
victim pTouched
    entity_get_string
(pToucherEV_SZ_classnameszClassName31)

    if(
equal(szClassName"ice_blast") )
    {
        new 
freezeradius get_cvar_num("subzero_freezeradius")
        new 
freezedamage get_cvar_num("subzero_freezedamage")

        new 
Float:fl_vExplodeAt[3]
        
entity_get_vector(pToucherEV_VEC_originfl_vExplodeAt)
        new 
vExplodeAt[3]
        
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
        
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
        
vExplodeAt[2] = floatround(fl_vExplodeAt[2])
        new 
id entity_get_edict(pToucherEV_ENT_owner)
        new 
origin[3],dist,i,Float:dRatio,damage

        
for ( 1<= SH_MAXSLOTSi++)
        {

            if( !
is_user_alive(i) ) continue
            
get_user_origin(i,origin)
            
dist get_distance(origin,vExplodeAt)
            if (
dist <= freezeradius) {

                
dRatio floatdiv(float(dist),float(freezeradius))
                
damage freezedamage floatroundfreezedamage dRatio)

                
shExtraDamage(iiddamage"Ice Blast" )
                
shStun(iget_cvar_num("subzero_freezetime"))
                
set_user_maxspeed(i0.1)
                
set_hudmessage(50100255, -1.00.4020.024.00.010.17)
                
show_hudmessage(i"You Got Frozen")
                
emit_sound(iCHAN_WEAPON"shmod/freezed.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                
freezed(victim)
            }
        }

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte21 )
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2] + freezeradius )
        
write_shortblastring )
        
write_byte// startframe
        
write_byte// framerate
        
write_byte// 3 life 2
        
write_byte// width 16
        
write_byte// noise
        
write_byte50 // r
        
write_byte50 // g
        
write_byte255 // b
        
write_byte200 //brightness
        
write_byte// speed
        
message_end()

        
remove_entity(pToucher)
    }
}
//----------------------------------------------------------------------------------------------
public freezed(victim)
{
    new 
Float:vOrigin[3]
    
entity_get_vector(victimEV_VEC_originvOrigin)
    
vOrigin[2] -= 25
    
    
new frozenground create_entity("info_target")
    
entity_set_string(frozengroundEV_SZ_classname"freezed")
    
entity_set_model(frozenground"models/shmod/freezed.mdl")
    
entity_set_size(frozengroundFloat:{-2.5, -2.5, -1.5}, Float:{2.52.51.5})
    
entity_set_int(frozengroundEV_INT_solid0)
    
entity_set_int(frozenground,EV_INT_movetypeMOVETYPE_NOCLIP)
    
entity_set_vector(frozengroundEV_VEC_originvOrigin)
}
//----------------------------------------------------------------------------------------------
public make_iceblast(id)
{
    new 
Float:Origin[3]
    new 
Float:Velocity[3]
    new 
Float:vAngle[3]

    new 
BlastSpeed get_cvar_num("subzero_blastspeed")

    
entity_get_vector(idEV_VEC_origin Origin)
    
entity_get_vector(idEV_VEC_v_anglevAngle)

    new 
NewEnt create_entity("info_target")

    
entity_set_string(NewEntEV_SZ_classname"ice_blast")

    
entity_set_model(NewEnt"sprites/shmod/iceball.spr")

    
entity_set_size(NewEntFloat:{-1.5, -1.5, -1.5}, Float:{1.51.51.5})

    
entity_set_origin(NewEntOrigin)
    
entity_set_vector(NewEntEV_VEC_anglesvAngle)
    
entity_set_int(NewEntEV_INT_solid2)

    
//thanx to vittu for this part.
    
entity_set_int(NewEntEV_INT_rendermode5)
    
entity_set_float(NewEntEV_FL_renderamt200.0)
    
entity_set_float(NewEntEV_FL_scale1.00)

    
entity_set_int(NewEntEV_INT_movetype5)
    
entity_set_edict(NewEntEV_ENT_ownerid)

    
velocity_by_aim(idBlastSpeed Velocity)
    
entity_set_vector(NewEntEV_VEC_velocity ,Velocity)

    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public new_spawn(id)
{
    
gPlayerUltimateUsed[id]=false
    RemoveByClass
(id)

    return 
PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public RemoveByClass(id)
{
    new 
frozenground 0
    
do {
        
frozenground find_ent_by_class(frozenground"freezed")
        if (
frozenground 0)
            
remove_entity(frozenground)
    }
    while (
frozenground)
}
//---------------------------------------------------------------------------------------------- 
Arje is offline