Raised This Month: $51 Target: $400
 12% 

i need some help with this hero only 1 error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 13:49   i need some help with this hero only 1 error
Reply With Quote #1

this is a rip of vittus hero all credits goes to him and im NEW here this is my idk first post and i have read the rules but well if anyone just could help me fixing the error it would be nice! cuz my ideais that they after ssj lvl 4 will begin to turn into the fusions i have anything readdy.. i would just be sure that i could even be able to make 5 levels instead of 4...

i get this error:/tmp/textntBC3u.sma(610 -- 611) : error 047: array sizes do not match, or destination array is too small

PHP Code:
// GOKU! - from Dragon Ball, Z, GT series.

/* CVARS - copy and paste to shconfig.cfg

//Goku
goku_level 10
goku_aps 5            //The amount of AP gained per second (Default 5)
goku_apl 250            //AP amount multiplied by ssjlevel = AP required for each ssjlevel and cost of ssjlevel power use (Default 250)
goku_hpl 30            //HP amount multiplied by ssjlevel, ex. 30*ssj2 = +60HP (Default 30)
goku_hpmax 500            //Max HP that can be gained (Default 500)
goku_speedbase 300        //Initial Speed boost for ssjlevel 1, only sets if you are slower (Default 300)
goku_speedadd 25        //Speed added to goku_speedbase every next ssjlevel (Default 25)
goku_damage1 70        //Max Damage for ssjlevel 1 power (Default 70)
goku_damage2 100        //Max Damage for ssjlevel 2 power (Default 100)
goku_damage3 175        //Max Damage for ssjlevel 3 power (Default 175)
goku_damage4 300        //Max Damage for ssjlevel 4 power (Default 300)
goku_radius1 100        //Max Radius of Damage for ssjlevel 1 power (Default 100)
goku_radius2 300        //Max Radius of Damage for ssjlevel 2 power (Default 300)
goku_radius3 700        //Max Radius of Damage for ssjlevel 3 power (Default 700)
goku_radius4 1500        //Max Radius of Damage for ssjlevel 4 power (Default 1500)
goku_blast_decals 1        //Show the burn decals on the walls (0-no 1-yes)

*/

/*
* v1.5 - vittu - 11/24/05
*      - Fixed crash to AMX since it can't register a MSG_ONE_UNRELIABLE message.
*
* v1.4 - vittu - 10/24/05
*      - Cleaned/Changed up code and formatted sounds to smaller file size for release.
*      - Consolodated cvars and global variables so less are declared. Instead
*          of individual settings, multipliers of one cvar are now used. Left 
*          damage and radius cvars of powers for more customization.
*
* v1.3 - vittu - 9/10/05
*      - Added guided kamehameha.
*
* v1.2 - vittu - 5/29/05
*      - Added Health and Speed boost to Saiyan level.
*      - Increased time of powerup effect.
*
* v1.1 - vittu - 5/26/05
*      - Recoded from scratch but kept basic premise.
*      - Created entities for power instead of beams.
*
*   Hero concept and originally by |RIC|_ALBANIAN.
*   Entity creation partially based on Bazooka, which is based on Missiles Launcher 3.8.2 by Eric Lidman & jtp10181.
*
*   ***Warning: This hero contains many extra files and may cause problems if you are precaching too much.***
*
*   Extra sprites and sounds used from Earth's Special Forces a HL mod - http://www.esforces.com/
*     and some sounds from http://www.esf-world.com/
*/

#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

// GLOBAL VARIBLES
new g_heroName[]="Goku"
new bool:g_hasGoku[SH_MAXSLOTS+1]
new 
bool:g_weaponSwitched[SH_MAXSLOTS+1]
new 
bool:g_inStun[SH_MAXSLOTS+1]
new 
bool:g_betweenRounds
new g_isSaiyanLevel[SH_MAXSLOTS+1]
new 
g_powerNum[SH_MAXSLOTS+1]
new 
g_powerID[SH_MAXSLOTS+1]
new 
g_maxRadius[SH_MAXSLOTS+1]
new 
g_maxDamage[SH_MAXSLOTS+1]
new 
g_lastWeapon[SH_MAXSLOTS+1]
new 
g_prevWeapon[SH_MAXSLOTS+1]
new 
g_ssjLevel[5]
new 
Float:g_ssjSpeed[5]

new 
g_armorPtsg_spriteSmokeg_spriteTrailYg_spriteTrailBg_spriteTrailRg_spriteTrailG 
new g_spriteExplosionYg_spriteExplosionBg_spriteExplosionRg_spritePowerUp

static const g_burnDecal[3] = {282930}
static const 
g_burnDecalBig[3] = {464748}
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Goku""1.5""|RIC|_ALBANIAN / 0 / vittu")

    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
register_cvar("goku_level""10")
    
register_cvar("goku_aps""5")
    
register_cvar("goku_apl""250")
    
register_cvar("goku_hpl""30")
    
register_cvar("goku_hpmax""500")
    
register_cvar("goku_speedbase""300")
    
register_cvar("goku_speedadd""25")
    
register_cvar("goku_damage1""50")
    
register_cvar("goku_damage2""80")
    
register_cvar("goku_damage3""150")
    
register_cvar("goku_damage4""300")
    
register_cvar("goku_damage5""1600")
    
register_cvar("goku_radius1""100")
    
register_cvar("goku_radius2""300")
    
register_cvar("goku_radius3""700")
    
register_cvar("goku_radius4""1500")
    
register_cvar("goku_radius5""1600")
    
register_cvar("goku_blast_decals""1")

    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
shCreateHero(g_heroName"Ultimate DBZ warrior""Generate KI/Armor to transform into Super Saiyan forms and fuse to gogeta in the last level. Get a Special Power plus an HP/Speed boost for each SSJ Level."true"goku_level")

    
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    // INIT
    
register_srvcmd("goku_init""goku_init")
    
shRegHeroInit(g_heroName"goku_init")

    
// KEY DOWN
    
register_srvcmd("goku_kd""goku_kd")
    
shRegKeyDown(g_heroName"goku_kd")

    
// KEY UP
    
register_srvcmd("goku_ku""goku_ku")
    
shRegKeyUp(g_heroName"goku_ku")

    
// EVENTS
    
register_event("ResetHUD""newSpawn""b")
    
register_event("CurWeapon""curweapon""be""1=1")

    
// LOG EVENTS
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("round_end"2"1=Round_End")
    
register_logevent("round_end"2"1&Restart_Round_")

    
// LOOP
    
set_task(1.0"goku_loop"0""0"b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound("shmod/goku_ki_blast.wav")
    
precache_sound("shmod/goku_kamehameha.wav")
    
precache_sound("shmod/goku_10x_kamehameha.wav")
    
precache_sound("shmod/goku_spirit_bomb.wav")
    
precache_sound("shmod/goku_bigbang.wav")
    
precache_sound("shmod/goku_powerup1.wav")
    
precache_sound("shmod/goku_powerup2.wav")
    
precache_sound("shmod/goku_powerup3.wav")
    
precache_sound("shmod/goku_powerup4.wav")
    
precache_sound("shmod/goku_powerup5.wav")
    
precache_sound("player/pl_pain2.wav")
    
precache_model("sprites/shmod/esf_ki_blast.spr")
    
precache_model("sprites/shmod/esf_kamehameha_blue.spr")
    
precache_model("sprites/shmod/esf_kamehameha_red.spr")
    
precache_model("sprites/shmod/esf_spirit_bomb.spr")
    
precache_model("sprites/shmod/esf_bigbang.spr")
    
g_spriteTrailY precache_model("sprites/shmod/esf_trail_yellow.spr")
    
g_spriteTrailB precache_model("sprites/shmod/esf_trail_blue.spr")
    
g_spriteTrailR precache_model("sprites/shmod/esf_trail_red.spr")
    
g_spriteTrailG precache_model("sprites/shmod/esf_trail_bigbang.spr")
    
g_spriteExplosionY precache_model("sprites/shmod/esf_exp_yellow.spr")
    
g_spriteExplosionB precache_model("sprites/shmod/esf_exp_blue.spr")
    
g_spriteExplosionR precache_model("sprites/shmod/esf_exp_red.spr")
    
g_spritePowerUp precache_model("sprites/shmod/esf_powerup.spr")
    
g_spriteSmoke precache_model("sprites/wall_puff4.spr")
}
//----------------------------------------------------------------------------------------------
public goku_init()
{
    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    
// 2nd Argument is 0 or 1 depending on whether the id has the hero
    
read_argv(2,temp,5)
    new 
hasPowers str_to_num(temp)

    if ( 
hasPowers ) {
        
goku_setarmor(id)
    }
    
//This gets run if they had the power but don't anymore
    
else if ( !hasPowers && g_hasGoku[id] ) {
        
shRemArmorPower(id)
        
shRemSpeedPower(id)
        
// remove the power if it was used and user dropped hero
        
if ( g_powerID[id] > ) {
            
remove_power(idg_powerID[id])
        }
    }

    
// Sets this variable to the current status
    
g_hasGoku[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public plugin_cfg()
{
    
loadCVARS()
}
//----------------------------------------------------------------------------------------------
public loadCVARS()
{
    
// These cvars are checked very often
    
g_armorPts get_cvar_num("goku_aps")
    
g_ssjLevel[0] = get_cvar_num("goku_apl")
    
g_ssjLevel[1] = g_ssjLevel[0] * 2
    g_ssjLevel
[2] = g_ssjLevel[0] * 3
    g_ssjLevel
[3] = g_ssjLevel[0] * 4
    g_ssjLevel
[4] = g_ssjLevel[0] * 5
    g_ssjSpeed
[0] = get_cvar_float("goku_speedbase")
    
g_ssjSpeed[1] = g_ssjSpeed[0] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[2] = g_ssjSpeed[1] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[3] = g_ssjSpeed[2] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[4] = g_ssjSpeed[3] + get_cvar_float("goku_speedadd")
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
    
g_inStun[id] = false

    
if ( shModActive() && g_hasGoku[id]  && is_user_alive(id) ) {
        
// Set armor in x seconds to avoid breaking max ap settings in other heroes
        
set_task(0.5"goku_setarmor"id)
        
g_isSaiyanLevel[id] = 0
    
}
}
//----------------------------------------------------------------------------------------------
public goku_setarmor(id)
{
    if ( 
is_user_alive(id) ) {
        
// Start a Goku off with 100 AP, even if user has more from other heroes
        
give_item(id"item_assaultsuit")
        
set_user_armor(id100)
    }
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public goku_kd()
{
    if ( 
g_betweenRounds ) return

    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    if ( !
is_user_alive(id) || !g_hasGoku[id] ) return

    
// Reload CVARS to make sure the variables are current
    
loadCVARS()

    new 
userArmor get_user_armor(id)

    if ( 
userArmor g_ssjLevel[0] ) {
        
playSoundDenySelect(id)
        
client_print(idprint_chat"[SH](Goku) Not enough KI/Armor")
        return
    }

    
// Prevent too many entities, which would cause server problems
    
if( g_powerID[id] ){
        
playSoundDenySelect(id)
        
client_print(id,print_chat,"[SH](Goku) You cannot use more than one power at a time.")
        return
    }

    
// Remember this weapon...
    
new clipammoweaponID get_user_weapon(idclipammo)
    
g_lastWeapon[id] = weaponID
    g_weaponSwitched
[id] = true

    
// Switch to knife
    
engclient_cmd(id"weapon_knife")

    if ( 
userArmor >= g_ssjLevel[0] && userArmor g_ssjLevel[1] ) {
        
client_print(id,print_chat,"[SH](Goku) Ki Blast!")
        
emit_sound(idCHAN_STATIC"shmod/goku_ki_blast.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[0])
        
g_maxDamage[id] = get_cvar_num("goku_damage1")
        
g_maxRadius[id] = get_cvar_num("goku_radius1")
        
g_powerNum[id] = 1
    
}
    else if ( 
userArmor >= g_ssjLevel[1] && userArmor g_ssjLevel[2] ) {
        
client_print(id,print_chat,"[SH](Goku) Kamehameha!!")
        
// Wish this sound was shorter
        
emit_sound(idCHAN_STATIC"shmod/goku_kamehameha.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[1])
        
g_maxDamage[id] = get_cvar_num("goku_damage2")
        
g_maxRadius[id] = get_cvar_num("goku_radius2")
        
g_powerNum[id] = 2
    
}
    else if ( 
userArmor >= g_ssjLevel[2] && userArmor g_ssjLevel[3] ) {
        
client_print(id,print_chat,"[SH](Goku) 10x Kamehameha!!!")
        
// Wish this sound was shorter
        
emit_sound(idCHAN_STATIC"shmod/goku_10x_kamehameha.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[2])
        
g_maxDamage[id] = get_cvar_num("goku_damage3")
        
g_maxRadius[id] = get_cvar_num("goku_radius3")
        
g_powerNum[id] = 3
    
}
    else if ( 
userArmor >= g_ssjLevel[3] ) {
        
// Remove Users glowing since he was ssjlevel 4
        
set_user_rendering(id)

        
client_print(id,print_chat,"[SH](Goku) Spirit Bomb!!!!")
        
emit_sound(idCHAN_STATIC"shmod/goku_spirit_bomb.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[3])
        
g_maxDamage[id] = get_cvar_num("goku_damage4")
        
g_maxRadius[id] = get_cvar_num("goku_radius4")
        
g_powerNum[id] = 4
    
}
    else if ( 
userArmor >= g_ssjLevel[4] ) {
        
// Remove Users glowing since he was ssjlevel 4
        
set_user_rendering(id)

        
client_print(id,print_chat,"[SH](Goku) BIG BANG KAMEHAMEHA")
        
emit_sound(idCHAN_STATIC"shmod/goku_bigbang.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[4])
        
g_maxDamage[id] = get_cvar_num("goku_damage5")
        
g_maxRadius[id] = get_cvar_num("goku_radius5")
        
g_powerNum[id] = 5
    
}

    
create_power(id)
}
//----------------------------------------------------------------------------------------------
public goku_ku()
{
    if ( 
g_betweenRounds ) return

    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    if ( !
is_user_alive(id) || !g_hasGoku[id] || !g_weaponSwitched[id] ) return

    
// Switch back to previous weapon... Only if power was used...
    
if (g_lastWeapon[id] != CSW_KNIFEshSwitchWeaponID(idg_lastWeapon[id])
    
g_weaponSwitched[id] = false
}
//----------------------------------------------------------------------------------------------
public create_power(id)
{
    new 
Float:vOrigin[3], Float:vAngles[3], Float:vAngle[3], entModel[40]
    new 
Float:entScaleFloat:entSpeedtrailModeltrailLengthtrailWidth
    
new Float:VecMins[3] = {-1.0,-1.0,-1.0}
    new 
Float:VecMaxs[3] = {1.0,1.0,1.0}

    
// Seting entSpeed higher then 2000.0 will not go where you aim
    // Vec Mins/Maxes must be below +-5.0 to make a burndecal
    
switch(g_powerNum[id]){
        case 
1:{
            
entModel "sprites/shmod/esf_ki_blast.spr"
            
entScale 0.20
            entSpeed 
2000.0
            trailModel 
g_spriteTrailY
            trailLength 
1
            trailWidth 
2
        
}
        case 
2:{
            
entModel "sprites/shmod/esf_kamehameha_blue.spr"
            
entScale 1.20
            entSpeed 
1500.0
            trailModel 
g_spriteTrailB
            trailLength 
100
            trailWidth 
8
            VecMins
[0] = -2.0
            VecMins
[1] = -2.0
            VecMins
[2] = -2.0
            VecMaxs
[0] = 2.0
            VecMaxs
[1] = 2.0
            VecMaxs
[2] = 2.0
        
}
        case 
3:{
            
entModel "sprites/shmod/esf_kamehameha_red.spr"
            
entScale 2.00
            entSpeed 
1000.0
            trailModel 
g_spriteTrailR
            trailLength 
100
            trailWidth 
16
            VecMins
[0] = -3.0
            VecMins
[1] = -3.0
            VecMins
[2] = -3.0
            VecMaxs
[0] = 3.0
            VecMaxs
[1] = 3.0
            VecMaxs
[2] = 3.0
        
}
        case 
4:{
            
entModel "sprites/shmod/esf_spirit_bomb.spr"
            
entScale 0.70
            entSpeed 
800.0
            VecMins
[0] = -4.0
            VecMins
[1] = -4.0
            VecMins
[2] = -4.0
            VecMaxs
[0] = 4.0
            VecMaxs
[1] = 4.0
            VecMaxs
[2] = 4.0
        
}
        case 
5:{
            
entModel "sprites/shmod/esf_bigbang.spr"
            
entScale 1.20
            entSpeed 
1500.0
            trailModel 
g_spriteTrailG
            trailLength 
100
            trailWidth 
8
            VecMins
[0] = -2.0
            VecMins
[1] = -2.0
            VecMins
[2] = -2.0
            VecMaxs
[0] = 2.0
            VecMaxs
[1] = 2.0
            VecMaxs
[2] = 2.0
        
}
    }

    
// Get users postion and angles
    
Entvars_Get_Vector(idEV_VEC_originvOrigin)
    
Entvars_Get_Vector(idEV_VEC_anglesvAngles)
    
Entvars_Get_Vector(idEV_VEC_v_anglevAngle)

    
// Change height for entity origin
    
if (g_powerNum[id] == 4vOrigin[2] += 110
    
else vOrigin[2] += 6

    
new newEnt CreateEntity("info_target")
    if( 
newEnt == ) {
        
client_print(idprint_chat"[SH](Goku) Power Creation Failure")
        return
    }

    
g_powerID[id] = newEnt

    Entvars_Set_String
(newEntEV_SZ_classname"vexd_goku_power")
    
ENT_SetModel(newEntentModel)

    
Entvars_Set_Vector(newEntEV_VEC_minsVecMins)
    
Entvars_Set_Vector(newEntEV_VEC_maxsVecMaxs)

    
ENT_SetOrigin(newEntvOrigin)
    
Entvars_Set_Vector(newEntEV_VEC_anglesvAngles)
    
Entvars_Set_Vector(newEntEV_VEC_v_anglevAngle)

    
Entvars_Set_Int(newEntEV_INT_solid2)
    
Entvars_Set_Int(newEntEV_INT_movetype5)
    
Entvars_Set_Int(newEntEV_INT_rendermode5)
    
Entvars_Set_Float(newEntEV_FL_renderamt255.0)
    
Entvars_Set_Float(newEntEV_FL_scaleentScale)
    
Entvars_Set_Edict(newEntEV_ENT_ownerid)


    
// Create a VelocityByAim() function, but instead of users
    // eyesight make it start from the entity's origin - vittu
    
new Float:fl_Velocity[3], AimVec[3], velOrigin[3]

    
velOrigin[0] = floatround(vOrigin[0])
    
velOrigin[1] = floatround(vOrigin[1])
    
velOrigin[2] = floatround(vOrigin[2])

    
get_user_origin(idAimVec3)

    new 
distance get_distance(velOriginAimVec)

    
// Stupid Check but lets make sure you don't devide by 0
    
if (!distancedistance 1

    
new Float:invTime entSpeed distance

    fl_Velocity
[0] = (AimVec[0] - vOrigin[0]) * invTime
    fl_Velocity
[1] = (AimVec[1] - vOrigin[1]) * invTime
    fl_Velocity
[2] = (AimVec[2] - vOrigin[2]) * invTime

    Entvars_Set_Vector
(newEntEV_VEC_velocityfl_Velocity)

    
// No trail on Spirit Bomb
    
if ( g_powerNum[id] == ) return

    
// Set Trail on entity
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(22)            // TE_BEAMFOLLOW
    
write_short(newEnt)        // entity:attachment to follow
    
write_short(trailModel)    // sprite index
    
write_byte(trailLength)    // life in 0.1's
    
write_byte(trailWidth)    // line width in 0.1's
    
write_byte(255)    //colour
    
write_byte(255)
    
write_byte(255)
    
write_byte(255)    // brightness
    
message_end()

    if ( 
g_powerNum[id] == || g_powerNum[id] == ) {
        new 
iNewVelocity[3], args[6]
        
iNewVelocity[0] = floatround(fl_Velocity[0])
        
iNewVelocity[1] = floatround(fl_Velocity[1])
        
iNewVelocity[2] = floatround(fl_Velocity[2])

        
// Pass varibles used to guide entity with
        
args[0] = id
        args
[1] = newEnt
        args
[2] = floatround(entSpeed)
        
args[3] = iNewVelocity[0]
        
args[4] = iNewVelocity[1]
        
args[5] = iNewVelocity[2]

        
set_task(0.1"guide_kamehameha"newEntargs6)
    }
}
//----------------------------------------------------------------------------------------------
public guide_kamehameha(args[])
{
    new 
AimVec[3], avgFactor
    
new Float:fl_origin[3]
    new 
id args[0]
    new 
ent args[1]
    new 
speed args[2]

    if ( !
is_valid_ent(ent) ) return

    if ( !
is_user_connected(id) ) {
        
vexd_pfntouch(ent0)
        return
    }

    
get_user_origin(idAimVec3)

    
Entvars_Get_Vector(entEV_VEC_originfl_origin)

    new 
iNewVelocity[3]
    new 
origin[3]

    
origin[0] = floatround(fl_origin[0])
    
origin[1] = floatround(fl_origin[1])
    
origin[2] = floatround(fl_origin[2])

    if ( 
g_powerNum[id] == )
    
avgFactor 3
    
else if ( g_powerNum[id] == )
    
avgFactor 6
    
// stupid check but why not
    
else
    
avgFactor 8

    
new velocityVec[3], length

    velocityVec
[0] = AimVec[0]-origin[0]
    
velocityVec[1] = AimVec[1]-origin[1]
    
velocityVec[2] = AimVec[2]-origin[2]

    
length sqroot(velocityVec[0]*velocityVec[0] + velocityVec[1]*velocityVec[1] + velocityVec[2]*velocityVec[2])
    
// Stupid Check but lets make sure you don't devide by 0
    
if ( !length length 1

    velocityVec
[0] = velocityVec[0]*speed/length
    velocityVec
[1] = velocityVec[1]*speed/length
    velocityVec
[2] = velocityVec[2]*speed/length

    iNewVelocity
[0] = (velocityVec[0] + (args[3] * (avgFactor-1))) / avgFactor
    iNewVelocity
[1] = (velocityVec[1] + (args[4] * (avgFactor-1))) / avgFactor
    iNewVelocity
[2] = (velocityVec[2] + (args[5] * (avgFactor-1))) / avgFactor

    
new Float:fl_iNewVelocity[3]
    
fl_iNewVelocity[0] = float(iNewVelocity[0])
    
fl_iNewVelocity[1] = float(iNewVelocity[1])
    
fl_iNewVelocity[2] = float(iNewVelocity[2])

    
Entvars_Set_Vector(entEV_VEC_velocityfl_iNewVelocity)

    
args[3] = iNewVelocity[0]
    
args[4] = iNewVelocity[1]
    
args[5] = iNewVelocity[2]

    
set_task(0.1"guide_kamehameha"entargs6)
}
//----------------------------------------------------------------------------------------------
#if defined AMX_NEW
public vexd_pfntouch(pToucherpTouched) {
    
entity_touch(pToucherpTouched)
}

public 
entity_touch(entity1entity2) {
    new 
pToucher entity1
#else
public vexd_pfntouch(pToucherpTouched) {
#endif

    
if (pToucher <= 0) return
    if (!
is_valid_ent(pToucher)) return

    new 
szClassName[32]
    
Entvars_Get_String(pToucherEV_SZ_classnameszClassName31)

    if(
equal(szClassName"vexd_goku_power")) {
        new 
id Entvars_Get_Edict(pToucherEV_ENT_owner)
        new 
dmgRadius g_maxRadius[id]
        new 
maxDamage g_maxDamage[id]
        new 
Float:fl_vExplodeAt[3], damageName[16]
        new 
spriteExp g_spriteExplosionY

        
switch(g_powerNum[id]){
            case 
1:{
                
damageName "Ki Blast"
            
}
            case 
2:{
                
damageName "Kamehameha"
                
spriteExp g_spriteExplosionB
            
}
            case 
3:{
                
damageName "10x Kamehameha"
                
spriteExp g_spriteExplosionR
            
}
            case 
4:{
                
damageName "Spirit Bomb"
            
}
            case 
5:{
                
damageName "BigBang Kamehameha"
                
spriteExp g_spriteExplosionB    
            
}
        }

        
Entvars_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])


        
// Cause the Damage
        
new vicOrigin[3], Float:dRatio,  distancedamage
        
new players[SH_MAXSLOTS], pnumvic

        get_players
(playerspnum"a")

        for (new 
0pnumi++) {
            
vic players[i]
            if( !
is_user_alive(vic) ) continue
            if ( 
get_user_team(id) == get_user_team(vic) && !get_cvar_num("mp_friendlyfire") && id != vic ) continue

            
get_user_origin(vicvicOrigin)
            
distance get_distance(vExplodeAtvicOrigin)

            if ( 
distance dmgRadius ) {

                
dRatio floatdiv(float(distance), float(dmgRadius))
                
damage maxDamage floatround(maxDamage dRatio)

                
// Lessen damage taken by self by half
                
if ( vic == id damage floatround(damage 2.0)

                
shExtraDamage(viciddamagedamageName)

                
// Make them feel it
                
sh_screenShake(vic101010)
                
emit_sound(vicCHAN_BODY"player/pl_pain2.wav"1.0ATTN_NORM0PITCH_NORM)

                new 
Float:fl_Time distance 125.0
                
new Float:fl_vicVelocity[3]
                
fl_vicVelocity[0] = (vicOrigin[0] - vExplodeAt[0]) / fl_Time
                fl_vicVelocity
[1] = (vicOrigin[1] - vExplodeAt[1]) / fl_Time
                fl_vicVelocity
[2] = (vicOrigin[2] - vExplodeAt[2]) / fl_Time
                Entvars_Set_Vector
(vicEV_VEC_velocityfl_vicVelocity)
            }
        }

        
// Make some Effects
        
new blastSize floatround(dmgRadius 12.0)

        
// Explosion Sprite
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(23)            //TE_GLOWSPRITE
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(spriteExp)    // model
        
write_byte(01)            // life 0.x sec
        
write_byte(blastSize)    // size
        
write_byte(255)        // brightness
        
message_end()

        
// Explosion (smoke, sound/effects)
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(3)            //TE_EXPLOSION
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(g_spriteSmoke)        // model
        
write_byte(blastSize+5)    // scale in 0.1's
        
write_byte(20)            // framerate
        
write_byte(10)            // flags
        
message_end()

        
// Create Burn Decals, if they are used
        
if ( get_cvar_num("goku_blast_decals") == ) {
            
// Change burn decal according to blast size
            
new decal_id
            
if ( blastSize <= 18 ) {
                
//radius ~< 216
                
decal_id g_burnDecal[random_num(0,2)]
            }
            else {
                
decal_id g_burnDecalBig[random_num(0,2)]
            }

            
// Create the burn decal
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(109)        //TE_GUNSHOTDECAL
            
write_coord(vExplodeAt[0])
            
write_coord(vExplodeAt[1])
            
write_coord(vExplodeAt[2])
            
write_short(0)            //?
            
write_byte(decal_id)    //decal
            
message_end()
        }

        
RemoveEntity(pToucher)

        
// Reset the Varibles
        
g_powerNum[id] = 0
        g_powerID
[id] = 0
    
}
}
//----------------------------------------------------------------------------------------------
public remove_power(idpowerID)
{
    new 
Float:fl_vOrigin[3]

    
Entvars_Get_Vector(powerIDEV_VEC_originfl_vOrigin)

    
// Create an effect of kamehameha being removed
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(14)        //TE_IMPLOSION
    
write_coord(floatround(fl_vOrigin[0]))
    
write_coord(floatround(fl_vOrigin[1]))
    
write_coord(floatround(fl_vOrigin[2]))
    
write_byte(200)    // radius
    
write_byte(40)        // count
    
write_byte(45)        // life in 0.1's
    
message_end()

    
g_powerNum[id] = 0
    g_powerID
[id] = 0

    RemoveEntity
(powerID)
}
//----------------------------------------------------------------------------------------------
public goku_loop()
{
    if ( !
shModActive() || g_betweenRounds ) return

    new 
players[SH_MAXSLOTS], pnumid

    get_players
(playerspnum"a")

    for (new 
0pnumi++) {
        
id players[i]
        if ( 
g_hasGoku[id] && is_user_alive(id) ) {

            new 
userArmor get_user_armor(id)

            
// Give him armor
            
if ( userArmor g_ssjLevel[3] ) {
                if ( 
userArmor g_armorPts g_ssjLevel[3] ) {
                    
set_user_armor(idg_ssjLevel[3])
                }
                else {
                    
// Give the armor item if armor is 0 so CS knows the player has armor
                    
if ( userArmor <= give_item(id"item_assaultsuit")

                    
set_user_armor(iduserArmor g_armorPts)
                }
            }

            
// Check armor again after it's been set
            
userArmor get_user_armor(id)

            if ( 
userArmor g_ssjLevel[0] ) {
                
// run it this way so it doesn't check all the elses
                
if ( g_isSaiyanLevel[id] > ) {
                    
shResetSpeed(id)
                    
g_isSaiyanLevel[id] = 0
                
}
            }
            else if ( 
userArmor >= g_ssjLevel[0] && userArmor g_ssjLevel[1] ) {
                
// Set these items only once when armor is ssjlevel 1
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 5
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"19)

                    
set_hudmessage(255255100, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup1.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 1
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[1] && userArmor g_ssjLevel[2] ) {
                
// Set these items only once when armor is ssjlevel 2
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 7
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"39)

                    
set_hudmessage(2222260, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 2")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup2.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 2
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[2] && userArmor g_ssjLevel[3] ) {
                
// Set these items only once when armor is ssjlevel 3
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 9
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"59)

                    
set_hudmessage(248220117, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 3")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup3.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 3
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[3] ) {
                
// SSJ4 glows red
                
shGlow(id196000000)
                
// Set these items only once when armor is ssjlevel 4
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 11
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"59)

                    
set_hudmessage(19600, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 4")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup4.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 4
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[3] ) {
                
// SSJ4 glows red
                
shGlow(id255000000)
                
// Set these items only once when armor is ssjlevel 4
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 11
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"79)

                    
set_hudmessage(19600, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku and vegetta - you've turned into GOGETA")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup5.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 5
                    shake_n_stun
(id)
                    
ssj_boost(id)
                }
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public ssj_boost(id)
{
    if ( !
shModActive() || !g_hasGoku[id] || !is_user_alive(id) || g_betweenRounds ) return
    if ( !
g_isSaiyanLevel[id] ) return

    
// Speed Boost
    
new speedNum g_isSaiyanLevel[id] - 1
    
if ( get_user_maxspeed(id) < g_ssjSpeed[speedNum] && !g_inStun[id] ) {
        
set_user_maxspeed(idg_ssjSpeed[speedNum])
    }

    
// HP boost
    
new userHealth get_user_health(id)
    if ( 
userHealth get_cvar_num("goku_hpmax") ) {
        new 
addHP get_cvar_num("goku_hpl") * g_isSaiyanLevel[id]
        if ( 
userHealth addHP get_cvar_num("goku_hpmax") ) {
            
set_user_health(idget_cvar_num("goku_hpmax") )
        }
        else {
            
set_user_health(iduserHealth addHP)
        }
    }
}
//----------------------------------------------------------------------------------------------
public curweapon(id)
{
    if ( !
shModActive() || !g_hasGoku[id] || !is_user_alive(id) || g_betweenRounds ) return
    if ( !
g_isSaiyanLevel[id] || g_inStun[id] ) return

    new 
wpnid read_data(2)

    if ( 
g_prevWeapon[id] != wpnid ) {
        switch(
g_isSaiyanLevel[id]) {
            case 
1: if ( get_user_maxspeed(id) < g_ssjSpeed[0] ) set_user_maxspeed(idg_ssjSpeed[0])
            case 
2: if ( get_user_maxspeed(id) < g_ssjSpeed[1] ) set_user_maxspeed(idg_ssjSpeed[1])
            case 
3: if ( get_user_maxspeed(id) < g_ssjSpeed[2] ) set_user_maxspeed(idg_ssjSpeed[2])
            case 
4: if ( get_user_maxspeed(id) < g_ssjSpeed[3] ) set_user_maxspeed(idg_ssjSpeed[3])
            case 
5: if ( get_user_maxspeed(id) < g_ssjSpeed[4] ) set_user_maxspeed(idg_ssjSpeed[4])
        }
    }
    
g_prevWeapon[id] = wpnid
}
//----------------------------------------------------------------------------------------------
public shake_n_stun(id)
{
    new 
idOrigin[3], vicOrigin[3]
    new 
players[SH_MAXSLOTS], pnumvic

    get_user_origin
(ididOrigin)

    
get_players(playerspnum"a")

    
// Shake and Stun all alive users in radius inluding self
    
for (new 0pnumi++) {
        
vic players[i]
        if ( !
is_user_alive(vic) ) continue

        
get_user_origin(vicvicOrigin)

        new 
distance get_distance(idOriginvicOrigin)

        if ( 
distance <= get_cvar_num("goku_radius5") ) {
            
sh_screenShake(vic141414)
            
g_inStun[vic] = true

            shStun
(vic5)
            
set_user_maxspeed(vic150.0)

            
set_task(5.0"reset_instun"vic)

            if ( 
vic == id ) continue
            
// Let them know why they get shaken and stunned, except the person that leveled
            
new gokuName[32]
            
get_user_name(idgokuName31)
            
set_hudmessage(19600, -1.00.2000.253.00.00.084)
            
show_hudmessage(vic"Goku - %s has fused with vegeta and are now GOGETA"gokuName)
        }
    }
}
//----------------------------------------------------------------------------------------------
public reset_instun(id)
{
    
g_inStun[id] = false

    
if ( !shModActive() || !g_hasGoku[id] || !is_user_alive(id) ) return

    switch(
g_isSaiyanLevel[id]) {
        case 
1: if ( get_user_maxspeed(id) < g_ssjSpeed[0] ) set_user_maxspeed(idg_ssjSpeed[0])
        case 
2: if ( get_user_maxspeed(id) < g_ssjSpeed[1] ) set_user_maxspeed(idg_ssjSpeed[1])
        case 
3: if ( get_user_maxspeed(id) < g_ssjSpeed[2] ) set_user_maxspeed(idg_ssjSpeed[2])
        case 
4: if ( get_user_maxspeed(id) < g_ssjSpeed[3] ) set_user_maxspeed(idg_ssjSpeed[3])
        case 
5: if ( get_user_maxspeed(id) < g_ssjSpeed[4] ) set_user_maxspeed(idg_ssjSpeed[4])
    }
}
//----------------------------------------------------------------------------------------------
public powerup_effect(parm[])
{
    if ( !
shModActive() || g_betweenRounds ) return

    new 
id parm[0]

    if ( !
is_user_alive(id) ) return

    new 
Size parm[1]
    new 
players[SH_MAXSLOTS], pnum
    
new idOthersOrigin[3]

    
get_players(playerspnum"a")

    
// Show a powerup to all alive players except the one being powered up.
    
for (new 0pnumi++) {
        
idOthers players[i]
        if ( !
is_user_alive(idOthers) || idOthers == id ) continue

        
get_user_origin(idOrigin)

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0]+5// center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0]-5)    // center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1]+5)
        
write_coord(Origin[2]+10)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1]-5)
        
write_coord(Origin[2]+10)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()
    }
}
//----------------------------------------------------------------------------------------------
public round_end()
{
    
g_betweenRounds true

    
for (new id=1id <= SH_MAXSLOTSid++) {
        if ( 
g_hasGoku[id] ) {
            
g_isSaiyanLevel[id] = 0
            shResetSpeed
(id)
            if ( 
g_powerID[id] > ) {
                
remove_power(idg_powerID[id])
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public round_start()
{
    
g_betweenRounds false
}
//----------------------------------------------------------------------------------------------
public client_disconnect(id)
{
    if( 
g_hasGoku[id] && g_powerID[id] > ) {
        
remove_power(idg_powerID[id])
    }
}
//---------------------------------------------------------------------------------------------- 
raswus9 is offline
Send a message via MSN to raswus9
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-16-2011 , 15:36   Re: i need some help with this hero only 1 error
Reply With Quote #2

PHP Code:
// GOKU! - from Dragon Ball, Z, GT series.

/* CVARS - copy and paste to shconfig.cfg

//Goku
goku_level 10
goku_aps 5            //The amount of AP gained per second (Default 5)
goku_apl 250            //AP amount multiplied by ssjlevel = AP required for each ssjlevel and cost of ssjlevel power use (Default 250)
goku_hpl 30            //HP amount multiplied by ssjlevel, ex. 30*ssj2 = +60HP (Default 30)
goku_hpmax 500            //Max HP that can be gained (Default 500)
goku_speedbase 300        //Initial Speed boost for ssjlevel 1, only sets if you are slower (Default 300)
goku_speedadd 25        //Speed added to goku_speedbase every next ssjlevel (Default 25)
goku_damage1 70        //Max Damage for ssjlevel 1 power (Default 70)
goku_damage2 100        //Max Damage for ssjlevel 2 power (Default 100)
goku_damage3 175        //Max Damage for ssjlevel 3 power (Default 175)
goku_damage4 300        //Max Damage for ssjlevel 4 power (Default 300)
goku_radius1 100        //Max Radius of Damage for ssjlevel 1 power (Default 100)
goku_radius2 300        //Max Radius of Damage for ssjlevel 2 power (Default 300)
goku_radius3 700        //Max Radius of Damage for ssjlevel 3 power (Default 700)
goku_radius4 1500        //Max Radius of Damage for ssjlevel 4 power (Default 1500)
goku_blast_decals 1        //Show the burn decals on the walls (0-no 1-yes)

*/

/*
* v1.5 - vittu - 11/24/05
*      - Fixed crash to AMX since it can't register a MSG_ONE_UNRELIABLE message.
*
* v1.4 - vittu - 10/24/05
*      - Cleaned/Changed up code and formatted sounds to smaller file size for release.
*      - Consolodated cvars and global variables so less are declared. Instead
*          of individual settings, multipliers of one cvar are now used. Left 
*          damage and radius cvars of powers for more customization.
*
* v1.3 - vittu - 9/10/05
*      - Added guided kamehameha.
*
* v1.2 - vittu - 5/29/05
*      - Added Health and Speed boost to Saiyan level.
*      - Increased time of powerup effect.
*
* v1.1 - vittu - 5/26/05
*      - Recoded from scratch but kept basic premise.
*      - Created entities for power instead of beams.
*
*   Hero concept and originally by |RIC|_ALBANIAN.
*   Entity creation partially based on Bazooka, which is based on Missiles Launcher 3.8.2 by Eric Lidman & jtp10181.
*
*   ***Warning: This hero contains many extra files and may cause problems if you are precaching too much.***
*
*   Extra sprites and sounds used from Earth's Special Forces a HL mod - http://www.esforces.com/
*     and some sounds from http://www.esf-world.com/
*/

#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

// GLOBAL VARIBLES
new g_heroName[]="Goku"
new bool:g_hasGoku[SH_MAXSLOTS+1]
new 
bool:g_weaponSwitched[SH_MAXSLOTS+1]
new 
bool:g_inStun[SH_MAXSLOTS+1]
new 
bool:g_betweenRounds
new g_isSaiyanLevel[SH_MAXSLOTS+1]
new 
g_powerNum[SH_MAXSLOTS+1]
new 
g_powerID[SH_MAXSLOTS+1]
new 
g_maxRadius[SH_MAXSLOTS+1]
new 
g_maxDamage[SH_MAXSLOTS+1]
new 
g_lastWeapon[SH_MAXSLOTS+1]
new 
g_prevWeapon[SH_MAXSLOTS+1]
new 
g_ssjLevel[5]
new 
Float:g_ssjSpeed[5]

new 
g_armorPtsg_spriteSmokeg_spriteTrailYg_spriteTrailBg_spriteTrailRg_spriteTrailG 
new g_spriteExplosionYg_spriteExplosionBg_spriteExplosionRg_spritePowerUp

static const g_burnDecal[3] = {282930}
static const 
g_burnDecalBig[3] = {464748}
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Goku""1.5""|RIC|_ALBANIAN / 0 / vittu")

    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
register_cvar("goku_level""10")
    
register_cvar("goku_aps""5")
    
register_cvar("goku_apl""250")
    
register_cvar("goku_hpl""30")
    
register_cvar("goku_hpmax""500")
    
register_cvar("goku_speedbase""300")
    
register_cvar("goku_speedadd""25")
    
register_cvar("goku_damage1""50")
    
register_cvar("goku_damage2""80")
    
register_cvar("goku_damage3""150")
    
register_cvar("goku_damage4""300")
    
register_cvar("goku_damage5""1600")
    
register_cvar("goku_radius1""100")
    
register_cvar("goku_radius2""300")
    
register_cvar("goku_radius3""700")
    
register_cvar("goku_radius4""1500")
    
register_cvar("goku_radius5""1600")
    
register_cvar("goku_blast_decals""1")

    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
shCreateHero(g_heroName"Ultimate DBZ warrior""Generate KI/Armor to transform into Super Saiyan forms and fuse to gogeta in the last level. Get a Special Power plus an HP/Speed boost for each SSJ Level."true"goku_level")

    
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    // INIT
    
register_srvcmd("goku_init""goku_init")
    
shRegHeroInit(g_heroName"goku_init")

    
// KEY DOWN
    
register_srvcmd("goku_kd""goku_kd")
    
shRegKeyDown(g_heroName"goku_kd")

    
// KEY UP
    
register_srvcmd("goku_ku""goku_ku")
    
shRegKeyUp(g_heroName"goku_ku")

    
// EVENTS
    
register_event("ResetHUD""newSpawn""b")
    
register_event("CurWeapon""curweapon""be""1=1")

    
// LOG EVENTS
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("round_end"2"1=Round_End")
    
register_logevent("round_end"2"1&Restart_Round_")

    
// LOOP
    
set_task(1.0"goku_loop"0""0"b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound("shmod/goku_ki_blast.wav")
    
precache_sound("shmod/goku_kamehameha.wav")
    
precache_sound("shmod/goku_10x_kamehameha.wav")
    
precache_sound("shmod/goku_spirit_bomb.wav")
    
precache_sound("shmod/goku_bigbang.wav")
    
precache_sound("shmod/goku_powerup1.wav")
    
precache_sound("shmod/goku_powerup2.wav")
    
precache_sound("shmod/goku_powerup3.wav")
    
precache_sound("shmod/goku_powerup4.wav")
    
precache_sound("shmod/goku_powerup5.wav")
    
precache_sound("player/pl_pain2.wav")
    
precache_model("sprites/shmod/esf_ki_blast.spr")
    
precache_model("sprites/shmod/esf_kamehameha_blue.spr")
    
precache_model("sprites/shmod/esf_kamehameha_red.spr")
    
precache_model("sprites/shmod/esf_spirit_bomb.spr")
    
precache_model("sprites/shmod/esf_bigbang.spr")
    
g_spriteTrailY precache_model("sprites/shmod/esf_trail_yellow.spr")
    
g_spriteTrailB precache_model("sprites/shmod/esf_trail_blue.spr")
    
g_spriteTrailR precache_model("sprites/shmod/esf_trail_red.spr")
    
g_spriteTrailG precache_model("sprites/shmod/esf_trail_bigbang.spr")
    
g_spriteExplosionY precache_model("sprites/shmod/esf_exp_yellow.spr")
    
g_spriteExplosionB precache_model("sprites/shmod/esf_exp_blue.spr")
    
g_spriteExplosionR precache_model("sprites/shmod/esf_exp_red.spr")
    
g_spritePowerUp precache_model("sprites/shmod/esf_powerup.spr")
    
g_spriteSmoke precache_model("sprites/wall_puff4.spr")
}
//----------------------------------------------------------------------------------------------
public goku_init()
{
    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    
// 2nd Argument is 0 or 1 depending on whether the id has the hero
    
read_argv(2,temp,5)
    new 
hasPowers str_to_num(temp)

    if ( 
hasPowers ) {
        
goku_setarmor(id)
    }
    
//This gets run if they had the power but don't anymore
    
else if ( !hasPowers && g_hasGoku[id] ) {
        
shRemArmorPower(id)
        
shRemSpeedPower(id)
        
// remove the power if it was used and user dropped hero
        
if ( g_powerID[id] > ) {
            
remove_power(idg_powerID[id])
        }
    }

    
// Sets this variable to the current status
    
g_hasGoku[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public plugin_cfg()
{
    
loadCVARS()
}
//----------------------------------------------------------------------------------------------
public loadCVARS()
{
    
// These cvars are checked very often
    
g_armorPts get_cvar_num("goku_aps")
    
g_ssjLevel[0] = get_cvar_num("goku_apl")
    
g_ssjLevel[1] = g_ssjLevel[0] * 2
    g_ssjLevel
[2] = g_ssjLevel[0] * 3
    g_ssjLevel
[3] = g_ssjLevel[0] * 4
    g_ssjLevel
[4] = g_ssjLevel[0] * 5
    g_ssjSpeed
[0] = get_cvar_float("goku_speedbase")
    
g_ssjSpeed[1] = g_ssjSpeed[0] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[2] = g_ssjSpeed[1] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[3] = g_ssjSpeed[2] + get_cvar_float("goku_speedadd")
    
g_ssjSpeed[4] = g_ssjSpeed[3] + get_cvar_float("goku_speedadd")
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
    
g_inStun[id] = false

    
if ( shModActive() && g_hasGoku[id]  && is_user_alive(id) ) {
        
// Set armor in x seconds to avoid breaking max ap settings in other heroes
        
set_task(0.5"goku_setarmor"id)
        
g_isSaiyanLevel[id] = 0
    
}
}
//----------------------------------------------------------------------------------------------
public goku_setarmor(id)
{
    if ( 
is_user_alive(id) ) {
        
// Start a Goku off with 100 AP, even if user has more from other heroes
        
give_item(id"item_assaultsuit")
        
set_user_armor(id100)
    }
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public goku_kd()
{
    if ( 
g_betweenRounds ) return

    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    if ( !
is_user_alive(id) || !g_hasGoku[id] ) return

    
// Reload CVARS to make sure the variables are current
    
loadCVARS()

    new 
userArmor get_user_armor(id)

    if ( 
userArmor g_ssjLevel[0] ) {
        
playSoundDenySelect(id)
        
client_print(idprint_chat"[SH](Goku) Not enough KI/Armor")
        return
    }

    
// Prevent too many entities, which would cause server problems
    
if( g_powerID[id] ){
        
playSoundDenySelect(id)
        
client_print(id,print_chat,"[SH](Goku) You cannot use more than one power at a time.")
        return
    }

    
// Remember this weapon...
    
new clipammoweaponID get_user_weapon(idclipammo)
    
g_lastWeapon[id] = weaponID
    g_weaponSwitched
[id] = true

    
// Switch to knife
    
engclient_cmd(id"weapon_knife")

    if ( 
userArmor >= g_ssjLevel[0] && userArmor g_ssjLevel[1] ) {
        
client_print(id,print_chat,"[SH](Goku) Ki Blast!")
        
emit_sound(idCHAN_STATIC"shmod/goku_ki_blast.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[0])
        
g_maxDamage[id] = get_cvar_num("goku_damage1")
        
g_maxRadius[id] = get_cvar_num("goku_radius1")
        
g_powerNum[id] = 1
    
}
    else if ( 
userArmor >= g_ssjLevel[1] && userArmor g_ssjLevel[2] ) {
        
client_print(id,print_chat,"[SH](Goku) Kamehameha!!")
        
// Wish this sound was shorter
        
emit_sound(idCHAN_STATIC"shmod/goku_kamehameha.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[1])
        
g_maxDamage[id] = get_cvar_num("goku_damage2")
        
g_maxRadius[id] = get_cvar_num("goku_radius2")
        
g_powerNum[id] = 2
    
}
    else if ( 
userArmor >= g_ssjLevel[2] && userArmor g_ssjLevel[3] ) {
        
client_print(id,print_chat,"[SH](Goku) 10x Kamehameha!!!")
        
// Wish this sound was shorter
        
emit_sound(idCHAN_STATIC"shmod/goku_10x_kamehameha.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[2])
        
g_maxDamage[id] = get_cvar_num("goku_damage3")
        
g_maxRadius[id] = get_cvar_num("goku_radius3")
        
g_powerNum[id] = 3
    
}
    else if ( 
userArmor >= g_ssjLevel[3] ) {
        
// Remove Users glowing since he was ssjlevel 4
        
set_user_rendering(id)

        
client_print(id,print_chat,"[SH](Goku) Spirit Bomb!!!!")
        
emit_sound(idCHAN_STATIC"shmod/goku_spirit_bomb.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[3])
        
g_maxDamage[id] = get_cvar_num("goku_damage4")
        
g_maxRadius[id] = get_cvar_num("goku_radius4")
        
g_powerNum[id] = 4
    
}
    else if ( 
userArmor >= g_ssjLevel[4] ) {
        
// Remove Users glowing since he was ssjlevel 4
        
set_user_rendering(id)

        
client_print(id,print_chat,"[SH](Goku) BIG BANG KAMEHAMEHA")
        
emit_sound(idCHAN_STATIC"shmod/goku_bigbang.wav"0.8ATTN_NORM0PITCH_NORM)
        
set_user_armor(iduserArmor-g_ssjLevel[4])
        
g_maxDamage[id] = get_cvar_num("goku_damage5")
        
g_maxRadius[id] = get_cvar_num("goku_radius5")
        
g_powerNum[id] = 5
    
}

    
create_power(id)
}
//----------------------------------------------------------------------------------------------
public goku_ku()
{
    if ( 
g_betweenRounds ) return

    
// First Argument is an id
    
new temp[6]
    
read_argv(1,temp,5)
    new 
id str_to_num(temp)

    if ( !
is_user_alive(id) || !g_hasGoku[id] || !g_weaponSwitched[id] ) return

    
// Switch back to previous weapon... Only if power was used...
    
if (g_lastWeapon[id] != CSW_KNIFEshSwitchWeaponID(idg_lastWeapon[id])
    
g_weaponSwitched[id] = false
}
//----------------------------------------------------------------------------------------------
public create_power(id)
{
    new 
Float:vOrigin[3], Float:vAngles[3], Float:vAngle[3], entModel[40]
    new 
Float:entScaleFloat:entSpeedtrailModeltrailLengthtrailWidth
    
new Float:VecMins[3] = {-1.0,-1.0,-1.0}
    new 
Float:VecMaxs[3] = {1.0,1.0,1.0}

    
// Seting entSpeed higher then 2000.0 will not go where you aim
    // Vec Mins/Maxes must be below +-5.0 to make a burndecal
    
switch(g_powerNum[id]){
        case 
1:{
            
entModel "sprites/shmod/esf_ki_blast.spr"
            
entScale 0.20
            entSpeed 
2000.0
            trailModel 
g_spriteTrailY
            trailLength 
1
            trailWidth 
2
        
}
        case 
2:{
            
entModel "sprites/shmod/esf_kamehameha_blue.spr"
            
entScale 1.20
            entSpeed 
1500.0
            trailModel 
g_spriteTrailB
            trailLength 
100
            trailWidth 
8
            VecMins
[0] = -2.0
            VecMins
[1] = -2.0
            VecMins
[2] = -2.0
            VecMaxs
[0] = 2.0
            VecMaxs
[1] = 2.0
            VecMaxs
[2] = 2.0
        
}
        case 
3:{
            
entModel "sprites/shmod/esf_kamehameha_red.spr"
            
entScale 2.00
            entSpeed 
1000.0
            trailModel 
g_spriteTrailR
            trailLength 
100
            trailWidth 
16
            VecMins
[0] = -3.0
            VecMins
[1] = -3.0
            VecMins
[2] = -3.0
            VecMaxs
[0] = 3.0
            VecMaxs
[1] = 3.0
            VecMaxs
[2] = 3.0
        
}
        case 
4:{
            
entModel "sprites/shmod/esf_spirit_bomb.spr"
            
entScale 0.70
            entSpeed 
800.0
            VecMins
[0] = -4.0
            VecMins
[1] = -4.0
            VecMins
[2] = -4.0
            VecMaxs
[0] = 4.0
            VecMaxs
[1] = 4.0
            VecMaxs
[2] = 4.0
        
}
        case 
5:{
            
entModel "sprites/shmod/esf_bigbang.spr"
            
entScale 1.20
            entSpeed 
1500.0
            trailModel 
g_spriteTrailG
            trailLength 
100
            trailWidth 
8
            VecMins
[0] = -2.0
            VecMins
[1] = -2.0
            VecMins
[2] = -2.0
            VecMaxs
[0] = 2.0
            VecMaxs
[1] = 2.0
            VecMaxs
[2] = 2.0
        
}
    }

    
// Get users postion and angles
    
Entvars_Get_Vector(idEV_VEC_originvOrigin)
    
Entvars_Get_Vector(idEV_VEC_anglesvAngles)
    
Entvars_Get_Vector(idEV_VEC_v_anglevAngle)

    
// Change height for entity origin
    
if (g_powerNum[id] == 4vOrigin[2] += 110
    
else vOrigin[2] += 6

    
new newEnt CreateEntity("info_target")
    if( 
newEnt == ) {
        
client_print(idprint_chat"[SH](Goku) Power Creation Failure")
        return
    }

    
g_powerID[id] = newEnt

    Entvars_Set_String
(newEntEV_SZ_classname"vexd_goku_power")
    
ENT_SetModel(newEntentModel)

    
Entvars_Set_Vector(newEntEV_VEC_minsVecMins)
    
Entvars_Set_Vector(newEntEV_VEC_maxsVecMaxs)

    
ENT_SetOrigin(newEntvOrigin)
    
Entvars_Set_Vector(newEntEV_VEC_anglesvAngles)
    
Entvars_Set_Vector(newEntEV_VEC_v_anglevAngle)

    
Entvars_Set_Int(newEntEV_INT_solid2)
    
Entvars_Set_Int(newEntEV_INT_movetype5)
    
Entvars_Set_Int(newEntEV_INT_rendermode5)
    
Entvars_Set_Float(newEntEV_FL_renderamt255.0)
    
Entvars_Set_Float(newEntEV_FL_scaleentScale)
    
Entvars_Set_Edict(newEntEV_ENT_ownerid)


    
// Create a VelocityByAim() function, but instead of users
    // eyesight make it start from the entity's origin - vittu
    
new Float:fl_Velocity[3], AimVec[3], velOrigin[3]

    
velOrigin[0] = floatround(vOrigin[0])
    
velOrigin[1] = floatround(vOrigin[1])
    
velOrigin[2] = floatround(vOrigin[2])

    
get_user_origin(idAimVec3)

    new 
distance get_distance(velOriginAimVec)

    
// Stupid Check but lets make sure you don't devide by 0
    
if (!distancedistance 1

    
new Float:invTime entSpeed distance

    fl_Velocity
[0] = (AimVec[0] - vOrigin[0]) * invTime
    fl_Velocity
[1] = (AimVec[1] - vOrigin[1]) * invTime
    fl_Velocity
[2] = (AimVec[2] - vOrigin[2]) * invTime

    Entvars_Set_Vector
(newEntEV_VEC_velocityfl_Velocity)

    
// No trail on Spirit Bomb
    
if ( g_powerNum[id] == ) return

    
// Set Trail on entity
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(22)            // TE_BEAMFOLLOW
    
write_short(newEnt)        // entity:attachment to follow
    
write_short(trailModel)    // sprite index
    
write_byte(trailLength)    // life in 0.1's
    
write_byte(trailWidth)    // line width in 0.1's
    
write_byte(255)    //colour
    
write_byte(255)
    
write_byte(255)
    
write_byte(255)    // brightness
    
message_end()

    if ( 
g_powerNum[id] == || g_powerNum[id] == ) {
        new 
iNewVelocity[3], args[6]
        
iNewVelocity[0] = floatround(fl_Velocity[0])
        
iNewVelocity[1] = floatround(fl_Velocity[1])
        
iNewVelocity[2] = floatround(fl_Velocity[2])

        
// Pass varibles used to guide entity with
        
args[0] = id
        args
[1] = newEnt
        args
[2] = floatround(entSpeed)
        
args[3] = iNewVelocity[0]
        
args[4] = iNewVelocity[1]
        
args[5] = iNewVelocity[2]

        
set_task(0.1"guide_kamehameha"newEntargs6)
    }
}
//----------------------------------------------------------------------------------------------
public guide_kamehameha(args[])
{
    new 
AimVec[3], avgFactor
    
new Float:fl_origin[3]
    new 
id args[0]
    new 
ent args[1]
    new 
speed args[2]

    if ( !
is_valid_ent(ent) ) return

    if ( !
is_user_connected(id) ) {
        
vexd_pfntouch(ent0)
        return
    }

    
get_user_origin(idAimVec3)

    
Entvars_Get_Vector(entEV_VEC_originfl_origin)

    new 
iNewVelocity[3]
    new 
origin[3]

    
origin[0] = floatround(fl_origin[0])
    
origin[1] = floatround(fl_origin[1])
    
origin[2] = floatround(fl_origin[2])

    if ( 
g_powerNum[id] == )
    
avgFactor 3
    
else if ( g_powerNum[id] == )
    
avgFactor 6
    
// stupid check but why not
    
else
    
avgFactor 8

    
new velocityVec[3], length

    velocityVec
[0] = AimVec[0]-origin[0]
    
velocityVec[1] = AimVec[1]-origin[1]
    
velocityVec[2] = AimVec[2]-origin[2]

    
length sqroot(velocityVec[0]*velocityVec[0] + velocityVec[1]*velocityVec[1] + velocityVec[2]*velocityVec[2])
    
// Stupid Check but lets make sure you don't devide by 0
    
if ( !length length 1

    velocityVec
[0] = velocityVec[0]*speed/length
    velocityVec
[1] = velocityVec[1]*speed/length
    velocityVec
[2] = velocityVec[2]*speed/length

    iNewVelocity
[0] = (velocityVec[0] + (args[3] * (avgFactor-1))) / avgFactor
    iNewVelocity
[1] = (velocityVec[1] + (args[4] * (avgFactor-1))) / avgFactor
    iNewVelocity
[2] = (velocityVec[2] + (args[5] * (avgFactor-1))) / avgFactor

    
new Float:fl_iNewVelocity[3]
    
fl_iNewVelocity[0] = float(iNewVelocity[0])
    
fl_iNewVelocity[1] = float(iNewVelocity[1])
    
fl_iNewVelocity[2] = float(iNewVelocity[2])

    
Entvars_Set_Vector(entEV_VEC_velocityfl_iNewVelocity)

    
args[3] = iNewVelocity[0]
    
args[4] = iNewVelocity[1]
    
args[5] = iNewVelocity[2]

    
set_task(0.1"guide_kamehameha"entargs6)
}
//----------------------------------------------------------------------------------------------
#if defined AMX_NEW
public vexd_pfntouch(pToucherpTouched) {
    
entity_touch(pToucherpTouched)
}

public 
entity_touch(entity1entity2) {
    new 
pToucher entity1
#else
public vexd_pfntouch(pToucherpTouched) {
#endif

    
if (pToucher <= 0) return
    if (!
is_valid_ent(pToucher)) return

    new 
szClassName[32]
    
Entvars_Get_String(pToucherEV_SZ_classnameszClassName31)

    if(
equal(szClassName"vexd_goku_power")) {
        new 
id Entvars_Get_Edict(pToucherEV_ENT_owner)
        new 
dmgRadius g_maxRadius[id]
        new 
maxDamage g_maxDamage[id]
        new 
Float:fl_vExplodeAt[3], damageName[19]
        new 
spriteExp g_spriteExplosionY

        
switch(g_powerNum[id]){
            case 
1:{
                
damageName "Ki Blast"
            
}
            case 
2:{
                
damageName "Kamehameha"
                
spriteExp g_spriteExplosionB
            
}
            case 
3:{
                
damageName "10x Kamehameha"
                
spriteExp g_spriteExplosionR
            
}
            case 
4:{
                
damageName "Spirit Bomb"
            
}
            case 
5:{
                
damageName "BigBang Kamehameha"
                
spriteExp g_spriteExplosionB    
            
}
        }

        
Entvars_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])


        
// Cause the Damage
        
new vicOrigin[3], Float:dRatio,  distancedamage
        
new players[SH_MAXSLOTS], pnumvic

        get_players
(playerspnum"a")

        for (new 
0pnumi++) {
            
vic players[i]
            if( !
is_user_alive(vic) ) continue
            if ( 
get_user_team(id) == get_user_team(vic) && !get_cvar_num("mp_friendlyfire") && id != vic ) continue

            
get_user_origin(vicvicOrigin)
            
distance get_distance(vExplodeAtvicOrigin)

            if ( 
distance dmgRadius ) {

                
dRatio floatdiv(float(distance), float(dmgRadius))
                
damage maxDamage floatround(maxDamage dRatio)

                
// Lessen damage taken by self by half
                
if ( vic == id damage floatround(damage 2.0)

                
shExtraDamage(viciddamagedamageName)

                
// Make them feel it
                
sh_screenShake(vic101010)
                
emit_sound(vicCHAN_BODY"player/pl_pain2.wav"1.0ATTN_NORM0PITCH_NORM)

                new 
Float:fl_Time distance 125.0
                
new Float:fl_vicVelocity[3]
                
fl_vicVelocity[0] = (vicOrigin[0] - vExplodeAt[0]) / fl_Time
                fl_vicVelocity
[1] = (vicOrigin[1] - vExplodeAt[1]) / fl_Time
                fl_vicVelocity
[2] = (vicOrigin[2] - vExplodeAt[2]) / fl_Time
                Entvars_Set_Vector
(vicEV_VEC_velocityfl_vicVelocity)
            }
        }

        
// Make some Effects
        
new blastSize floatround(dmgRadius 12.0)

        
// Explosion Sprite
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(23)            //TE_GLOWSPRITE
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(spriteExp)    // model
        
write_byte(01)            // life 0.x sec
        
write_byte(blastSize)    // size
        
write_byte(255)        // brightness
        
message_end()

        
// Explosion (smoke, sound/effects)
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(3)            //TE_EXPLOSION
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(g_spriteSmoke)        // model
        
write_byte(blastSize+5)    // scale in 0.1's
        
write_byte(20)            // framerate
        
write_byte(10)            // flags
        
message_end()

        
// Create Burn Decals, if they are used
        
if ( get_cvar_num("goku_blast_decals") == ) {
            
// Change burn decal according to blast size
            
new decal_id
            
if ( blastSize <= 18 ) {
                
//radius ~< 216
                
decal_id g_burnDecal[random_num(0,2)]
            }
            else {
                
decal_id g_burnDecalBig[random_num(0,2)]
            }

            
// Create the burn decal
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(109)        //TE_GUNSHOTDECAL
            
write_coord(vExplodeAt[0])
            
write_coord(vExplodeAt[1])
            
write_coord(vExplodeAt[2])
            
write_short(0)            //?
            
write_byte(decal_id)    //decal
            
message_end()
        }

        
RemoveEntity(pToucher)

        
// Reset the Varibles
        
g_powerNum[id] = 0
        g_powerID
[id] = 0
    
}
}
//----------------------------------------------------------------------------------------------
public remove_power(idpowerID)
{
    new 
Float:fl_vOrigin[3]

    
Entvars_Get_Vector(powerIDEV_VEC_originfl_vOrigin)

    
// Create an effect of kamehameha being removed
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(14)        //TE_IMPLOSION
    
write_coord(floatround(fl_vOrigin[0]))
    
write_coord(floatround(fl_vOrigin[1]))
    
write_coord(floatround(fl_vOrigin[2]))
    
write_byte(200)    // radius
    
write_byte(40)        // count
    
write_byte(45)        // life in 0.1's
    
message_end()

    
g_powerNum[id] = 0
    g_powerID
[id] = 0

    RemoveEntity
(powerID)
}
//----------------------------------------------------------------------------------------------
public goku_loop()
{
    if ( !
shModActive() || g_betweenRounds ) return

    new 
players[SH_MAXSLOTS], pnumid

    get_players
(playerspnum"a")

    for (new 
0pnumi++) {
        
id players[i]
        if ( 
g_hasGoku[id] && is_user_alive(id) ) {

            new 
userArmor get_user_armor(id)

            
// Give him armor
            
if ( userArmor g_ssjLevel[3] ) {
                if ( 
userArmor g_armorPts g_ssjLevel[3] ) {
                    
set_user_armor(idg_ssjLevel[3])
                }
                else {
                    
// Give the armor item if armor is 0 so CS knows the player has armor
                    
if ( userArmor <= give_item(id"item_assaultsuit")

                    
set_user_armor(iduserArmor g_armorPts)
                }
            }

            
// Check armor again after it's been set
            
userArmor get_user_armor(id)

            if ( 
userArmor g_ssjLevel[0] ) {
                
// run it this way so it doesn't check all the elses
                
if ( g_isSaiyanLevel[id] > ) {
                    
shResetSpeed(id)
                    
g_isSaiyanLevel[id] = 0
                
}
            }
            else if ( 
userArmor >= g_ssjLevel[0] && userArmor g_ssjLevel[1] ) {
                
// Set these items only once when armor is ssjlevel 1
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 5
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"19)

                    
set_hudmessage(255255100, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup1.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 1
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[1] && userArmor g_ssjLevel[2] ) {
                
// Set these items only once when armor is ssjlevel 2
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 7
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"39)

                    
set_hudmessage(2222260, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 2")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup2.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 2
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[2] && userArmor g_ssjLevel[3] ) {
                
// Set these items only once when armor is ssjlevel 3
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 9
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"59)

                    
set_hudmessage(248220117, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 3")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup3.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 3
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[3] ) {
                
// SSJ4 glows red
                
shGlow(id196000000)
                
// Set these items only once when armor is ssjlevel 4
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 11
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"59)

                    
set_hudmessage(19600, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku - You've turned Super Saiyan 4")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup4.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 4
                    ssj_boost
(id)
                }
            }
            else if ( 
userArmor >= g_ssjLevel[3] ) {
                
// SSJ4 glows red
                
shGlow(id255000000)
                
// Set these items only once when armor is ssjlevel 4
                
if ( g_isSaiyanLevel[id] < ) {
                    new 
parm[2]
                    
parm[0] = id
                    parm
[1] = 11
                    powerup_effect
(parm)
                    
set_task(0.1"powerup_effect"0parm2"a"79)

                    
set_hudmessage(19600, -1.00.2500.253.00.00.084)
                    
show_hudmessage(id"Goku and vegetta - you've turned into GOGETA")
                    
emit_sound(idCHAN_STATIC"shmod/goku_powerup5.wav"0.8ATTN_NORM0PITCH_NORM)

                    
g_isSaiyanLevel[id] = 5
                    shake_n_stun
(id)
                    
ssj_boost(id)
                }
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public ssj_boost(id)
{
    if ( !
shModActive() || !g_hasGoku[id] || !is_user_alive(id) || g_betweenRounds ) return
    if ( !
g_isSaiyanLevel[id] ) return

    
// Speed Boost
    
new speedNum g_isSaiyanLevel[id] - 1
    
if ( get_user_maxspeed(id) < g_ssjSpeed[speedNum] && !g_inStun[id] ) {
        
set_user_maxspeed(idg_ssjSpeed[speedNum])
    }

    
// HP boost
    
new userHealth get_user_health(id)
    if ( 
userHealth get_cvar_num("goku_hpmax") ) {
        new 
addHP get_cvar_num("goku_hpl") * g_isSaiyanLevel[id]
        if ( 
userHealth addHP get_cvar_num("goku_hpmax") ) {
            
set_user_health(idget_cvar_num("goku_hpmax") )
        }
        else {
            
set_user_health(iduserHealth addHP)
        }
    }
}
//----------------------------------------------------------------------------------------------
public curweapon(id)
{
    if ( !
shModActive() || !g_hasGoku[id] || !is_user_alive(id) || g_betweenRounds ) return
    if ( !
g_isSaiyanLevel[id] || g_inStun[id] ) return

    new 
wpnid read_data(2)

    if ( 
g_prevWeapon[id] != wpnid ) {
        switch(
g_isSaiyanLevel[id]) {
            case 
1: if ( get_user_maxspeed(id) < g_ssjSpeed[0] ) set_user_maxspeed(idg_ssjSpeed[0])
            case 
2: if ( get_user_maxspeed(id) < g_ssjSpeed[1] ) set_user_maxspeed(idg_ssjSpeed[1])
            case 
3: if ( get_user_maxspeed(id) < g_ssjSpeed[2] ) set_user_maxspeed(idg_ssjSpeed[2])
            case 
4: if ( get_user_maxspeed(id) < g_ssjSpeed[3] ) set_user_maxspeed(idg_ssjSpeed[3])
            case 
5: if ( get_user_maxspeed(id) < g_ssjSpeed[4] ) set_user_maxspeed(idg_ssjSpeed[4])
        }
    }
    
g_prevWeapon[id] = wpnid
}
//----------------------------------------------------------------------------------------------
public shake_n_stun(id)
{
    new 
idOrigin[3], vicOrigin[3]
    new 
players[SH_MAXSLOTS], pnumvic

    get_user_origin
(ididOrigin)

    
get_players(playerspnum"a")

    
// Shake and Stun all alive users in radius inluding self
    
for (new 0pnumi++) {
        
vic players[i]
        if ( !
is_user_alive(vic) ) continue

        
get_user_origin(vicvicOrigin)

        new 
distance get_distance(idOriginvicOrigin)

        if ( 
distance <= get_cvar_num("goku_radius5") ) {
            
sh_screenShake(vic141414)
            
g_inStun[vic] = true

            shStun
(vic5)
            
set_user_maxspeed(vic150.0)

            
set_task(5.0"reset_instun"vic)

            if ( 
vic == id ) continue
            
// Let them know why they get shaken and stunned, except the person that leveled
            
new gokuName[32]
            
get_user_name(idgokuName31)
            
set_hudmessage(19600, -1.00.2000.253.00.00.084)
            
show_hudmessage(vic"Goku - %s has fused with vegeta and are now GOGETA"gokuName)
        }
    }
}
//----------------------------------------------------------------------------------------------
public reset_instun(id)
{
    
g_inStun[id] = false

    
if ( !shModActive() || !g_hasGoku[id] || !is_user_alive(id) ) return

    switch(
g_isSaiyanLevel[id]) {
        case 
1: if ( get_user_maxspeed(id) < g_ssjSpeed[0] ) set_user_maxspeed(idg_ssjSpeed[0])
        case 
2: if ( get_user_maxspeed(id) < g_ssjSpeed[1] ) set_user_maxspeed(idg_ssjSpeed[1])
        case 
3: if ( get_user_maxspeed(id) < g_ssjSpeed[2] ) set_user_maxspeed(idg_ssjSpeed[2])
        case 
4: if ( get_user_maxspeed(id) < g_ssjSpeed[3] ) set_user_maxspeed(idg_ssjSpeed[3])
        case 
5: if ( get_user_maxspeed(id) < g_ssjSpeed[4] ) set_user_maxspeed(idg_ssjSpeed[4])
    }
}
//----------------------------------------------------------------------------------------------
public powerup_effect(parm[])
{
    if ( !
shModActive() || g_betweenRounds ) return

    new 
id parm[0]

    if ( !
is_user_alive(id) ) return

    new 
Size parm[1]
    new 
players[SH_MAXSLOTS], pnum
    
new idOthersOrigin[3]

    
get_players(playerspnum"a")

    
// Show a powerup to all alive players except the one being powered up.
    
for (new 0pnumi++) {
        
idOthers players[i]
        if ( !
is_user_alive(idOthers) || idOthers == id ) continue

        
get_user_origin(idOrigin)

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0]+5// center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0]-5)    // center position
        
write_coord(Origin[1])
        
write_coord(Origin[2]+20)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1]+5)
        
write_coord(Origin[2]+10)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()

        
// power up sprite - additive sprite, plays 1 cycle
        
message_begin(MSG_ONESVC_TEMPENTITYOriginidOthers)
        
write_byte(17)            // TE_SPRITE
        
write_coord(Origin[0])    // center position
        
write_coord(Origin[1]-5)
        
write_coord(Origin[2]+10)
        
write_short(g_spritePowerUp)    // sprite index
        
write_byte(Size)        // scale in 0.1's
        
write_byte(50)            // brightness
        
message_end()
    }
}
//----------------------------------------------------------------------------------------------
public round_end()
{
    
g_betweenRounds true

    
for (new id=1id <= SH_MAXSLOTSid++) {
        if ( 
g_hasGoku[id] ) {
            
g_isSaiyanLevel[id] = 0
            shResetSpeed
(id)
            if ( 
g_powerID[id] > ) {
                
remove_power(idg_powerID[id])
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public round_start()
{
    
g_betweenRounds false
}
//----------------------------------------------------------------------------------------------
public client_disconnect(id)
{
    if( 
g_hasGoku[id] && g_powerID[id] > ) {
        
remove_power(idg_powerID[id])
    }
}
//---------------------------------------------------------------------------------------------- 
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 15:53   Re: i need some help with this hero only 1 error
Reply With Quote #3

that didnt really work, i added custom sprites and sounds, and they sure are loaded.. the problem is that i still cant change to ssj 5 so i cant launch my big bang attack
raswus9 is offline
Send a message via MSN to raswus9
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 15:59   Re: i need some help with this hero only 1 error
Reply With Quote #4

well the sprites dotn really work either.. and i dont understand that becausse i added them and changed in the .sma that they should be loaded from prites/shmod/goku/ their own map.. but it still just use the original sprites.. and i cant change them cuz then i will change the sprites for all my other heroes like sephiroth..
raswus9 is offline
Send a message via MSN to raswus9
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-16-2011 , 16:03   Re: i need some help with this hero only 1 error
Reply With Quote #5

I have no interest in why it doesn't work, I just got your code to compile. You forgot to add more blocks to the array to hold the name of the attack, or whatever.

I have no interest in this at all, and therefor I wont even look at it further, sorry.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 16:06   Re: i need some help with this hero only 1 error
Reply With Quote #6

well still thanks u tried but im really like.. UBER novice.. i have watched your tutorials and stuff but i just cant figure this one out myself.. well still thanks for making it compile
raswus9 is offline
Send a message via MSN to raswus9
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 16:14   Re: i need some help with this hero only 1 error
Reply With Quote #7

are there any other people out there that can help me with this one? its really though to make..
raswus9 is offline
Send a message via MSN to raswus9
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 06-16-2011 , 17:04   Re: i need some help with this hero only 1 error
Reply With Quote #8

1. Learn to edit

2. Because of that I didnt even read your post properly, and you can totally forget about looking at the code.

3. But this is what came to my mind, did it myself once while working on that thing (or actually converting it).

4.

******ARRAY OVERFLOW******

But yeh it would have crashed the moment you would have fired the attack if that was the case, so I guess not. I guess I could look at it as I have done that many times but yeh, sorry. Lol that sounded bitchy.
__________________
The Art of War is offline
raswus9
Junior Member
Join Date: Oct 2010
Location: Denmark
Old 06-16-2011 , 17:14   Re: i need some help with this hero only 1 error
Reply With Quote #9

cmon -.- why so offensive? if there is more to learn then i would love if u could show me some links? cuz im pretty sure i watched all damn tutorials before asking for help -.- but now ive tried for 8 hours or something.. why cant u just look it throw? it takes 0 time at all. and it wouldnt owerflow my server. its 1000 fps and i have heroes larger than this one with even more sprites and sound.. but this is the first hero im trying to rip.. so please guys just look at it..
raswus9 is offline
Send a message via MSN to raswus9
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 06-16-2011 , 18:17   Re: i need some help with this hero only 1 error
Reply With Quote #10

Quote:
Originally Posted by raswus9 View Post
cmon -.- why so offensive? if there is more to learn then i would love if u could show me some links? cuz im pretty sure i watched all damn tutorials before asking for help -.- but now ive tried for 8 hours or something.. why cant u just look it throw? it takes 0 time at all. and it wouldnt owerflow my server. its 1000 fps and i have heroes larger than this one with even more sprites and sound.. but this is the first hero im trying to rip.. so please guys just look at it..
Sorry, I'm pissed. Not as in drunk, but angry.

Actually it would take quite some time... If it really is the Goku I know of, its about 1000 lines if I recall correctly... But yeh sure why not....

And an array overflow would still crash you server. It has absolutely nothing to do with how big, large or how many lines a hero has, it's all about how many slots or whatever you want to call it an array has. If for example you have a string as an array, and the string is 60 letters, and the number of slots the array has, is 40, the array will get overflowed and boom, your server will crash. This is an example:

(If I remember correctly this was actually what caused my version to overflow, but it was a long, long time ago:

Code:
new entModel[40]
if the entModel string of a case will be over 39, it will overflow.

Code:
entModel = "sprites/shmod/esf_ki_blast.spr"
If it instead would be

Code:
entModel = "sprites/shmod/11111111111111111111111111111111111111111111111111111111111111111111111.spr"
or anything over 39 it would overflow the array and crash the server.
This is because the server needs one extra slot at all times, so if you have a string that is to be used in an array ( or anything in an array, but yeh most things except for strings tend not to be huge I guess), and the thing/string is 40 letters, the slots of the array should be 41, always + 1 of the actual number.
__________________
The Art of War is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode