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

Bazooka


Post New Thread Reply   
 
Thread Tools Display Modes
rodrigo
Senior Member
Join Date: Jul 2010
Location: Brasil
Old 08-12-2010 , 19:06   Re: Bazooka
Reply With Quote #61

WOOWW, got it! I'm so happy, even if it was just tidying up the bazooka, and I just edited it for my need, I'm happy!

Then post the code completely ready, and clean!

PHP Code:
//Bazooka

//Based on Missiles Launcher 3.8.2 (amx_ejl_missiles.sma)
//    by Eric Lidman & jtp10181

/* CVARS - copy and paste to shconfig.cfg

// ---START OF BAZOOKA CVARS---

//Bazooka
bazooka_level 8
bazooka_buy 0            //Set to 1 to require missiles to be purchased

//
//The following "COST" settings only apply if buying mode is ON
//

bazooka_cost1 1000        //Common missile cost
bazooka_cost2 3000        //Laser guided missile cost
bazooka_cost3 3000        //Gun camera missile cost
bazooka_cost4 2000        //Anti-missile shot
bazooka_cost5 4000        //Heat seeking missile cost
bazooka_cost6 4000        //Rope seeking missile cost
bazooka_cost7 5000        //Swirling death missile cost

//
//The following "AMMO" settings only apply if buying mode is OFF
//

bazooka_ammo1 1        //Free Common missiles
bazooka_ammo2 1          //Free Laser guided missiles
bazooka_ammo3 1          //Free Gun camera missiles
bazooka_ammo4 2          //Free Anti-missile shots
bazooka_ammo5 1          //Free Heat seeking missiles
bazooka_ammo6 1          //Free Rope seeking missiles
bazooka_ammo7 1          //Free Swirling death missiles

//If set to 1, this cvar causes swirling death missile to use 7 missiles in the
//player's missile inventory. It draws from all types of missiles instead of
//it having its own indepedent inventory count.
bazooka_ammo7ta 0


bazooka_speed 1000        //Sets the default speed of most missiles
bazooka_rsspeed 1400    //Sets the speed of ropeseeking missiles
bazooka_hsspeed 1100    //Sets the speed of heatseeking missiles
bazooka_fuel 6.0        //Number of seconds a missile is driven before it falls to the ground out of fuel
bazooka_sdfuel 2.0        //Number of seconds a swirling death missile is driven before it "mirvs" or breaks then falls to the ground out of fuel
bazooka_sdspeed 750        //Sets the speed of swirling death missiles
bazooka_sdcount 6        //Sets the number missiles in swirling death
bazooka_sdrotate 6        //Sets the rotation speed of swirling death
bazooka_sdradius 32        //Sets the radius of swirling death missiles
bazooka_obeygravity 1    //Makes missile obey server gravity rules
bazooka_damradius 240    //Max distance from the blast that damage will occur at
bazooka_maxdamage 140    //Maximum Blast damage from explosion
bazooka_radarbattery 100        //Sets the amount of time a player can use his anti-missile radar per round.

//This cvar limits the two types of missiles responsible for spawn rape, guncamera and
//swirling death, from being fired until 15 seconds of a round has passed. Set cvar to 0
//to allow those missiles to be fired without being limited by round start
bazooka_spawndelay 0

// ---END OF BAZOOKA CVARS---
*/

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

#if defined AMX98
  #include <cmath>
#endif

#define DT 0.1
#define PI 3.1415926535897932384626433832795

new beamboomls_dot
new Float:fAngleBaz
new bool:roundfreeze
new round_delay
new has_rocket[33]

/* missile_inv:  fake,common,laserguide,guncam,antimissile,heatseeker,ropeseeking,multimissile */
new missile_inv[33][8]
new 
using_menu[33]
new 
is_scan_rocket[33]
new 
is_heat_rocket[33]
new 
radar_batt[33]

new 
gHeroName[]="Bazooka"
new bool:gHasBazookaPowers[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Bazooka","4.0","JTP10181 / AssKicR")

    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
register_cvar("bazooka_level""8" )
    
register_cvar("bazooka_buy","0")
    
register_cvar("bazooka_fuel","6.0")
    
register_cvar("bazooka_sdfuel","2.0")
    
register_cvar("bazooka_sdcount","6")
    
register_cvar("bazooka_sdrotate","6")
    
register_cvar("bazooka_sdradius","32")
    
register_cvar("bazooka_ammo1","2")
    
register_cvar("bazooka_ammo2","2")
    
register_cvar("bazooka_ammo3","1")
    
register_cvar("bazooka_ammo4","1")
    
register_cvar("bazooka_ammo5","1")
    
register_cvar("bazooka_ammo6","1")
    
register_cvar("bazooka_ammo7","1")
    
register_cvar("bazooka_ammo7ta","0")
    
register_cvar("bazooka_cost1","1000")
    
register_cvar("bazooka_cost2","3000")
    
register_cvar("bazooka_cost3","3000")
    
register_cvar("bazooka_cost4","2000")
    
register_cvar("bazooka_cost5","4000")
    
register_cvar("bazooka_cost6","4000")
    
register_cvar("bazooka_cost7","5000")
    
register_cvar("bazooka_speed","1000")
    
register_cvar("bazooka_sdspeed","750")
    
register_cvar("bazooka_hsspeed","1200")
    
register_cvar("bazooka_rsspeed","1200")
    
register_cvar("bazooka_obeygravity","1")
    
register_cvar("bazooka_damradius","240")
    
register_cvar("bazooka_maxdamage","140")
    
register_cvar("bazooka_radarbattery","100")
    
register_cvar("bazooka_spawndelay","0")

    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
shCreateHero(gHeroName"Rocket-Laucher""Fire Many Different Types of Rockets"true"bazooka_level" )

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

    
// KEYDOWN
    
register_srvcmd("bazooka_kd""bazooka_kd")
    
shRegKeyDown(gHeroName"bazooka_kd")

    
//CLIENT QUICK COMMANDS
    
register_clcmd("bazooka_missile","fire_missile")
    
//register_clcmd("bazooka_laserguided_missile","fire_missile")
    //register_clcmd("bazooka_guncamera_missile","fire_missile")
    //register_clcmd("bazooka_anti_missile","fire_missile")
    //register_clcmd("bazooka_heatseeking_missile","fire_missile")
    //register_clcmd("bazooka_ropeseeking_missile","fire_missile")
    //register_clcmd("bazooka_swirlingdeath_missile","fire_missile")

    //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_")
    
register_event("DeathMsg","death_event","a")

    
//MISSILE MENU
    
register_menucmd(register_menuid("Fire Missile Menu"),1023,"action_main_menu")

    
//MISSILE CHECKS
    
register_srvcmd("lasermissile_chk","laser_check")

    
//SWIRLING DEATH MISSILES
    
set_task(0.1,"RocketThink",0,"",0,"b")
}
//----------------------------------------------------------------------------------------------
public bazooka_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 BlackLotus
    
read_argv(2,temp,5)
    new 
hasPowers str_to_num(temp)

    
gHasBazookaPowers[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public bazooka_kd()
{
    if ( !
hasRoundStarted() ) return PLUGIN_HANDLED

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

    if ( !
is_user_alive(id) || !gHasBazookaPowers[id] ) return PLUGIN_HANDLED

    client_cmd
(id,"bazooka_missile")

    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound("vox/_period.wav")
    
precache_sound("debris/beamstart8.wav")
    
precache_sound("weapons/explode3.wav")
    
precache_sound("weapons/rocketfire1.wav")
    
precache_sound("ambience/rocket_steam1.wav")
    
precache_sound("weapons/rocket1.wav")
    
precache_sound("ambience/particle_suck2.wav")
    
precache_model("models/rpgrocket.mdl")

    
beam precache_model("sprites/smoke.spr")
    
boom precache_model("sprites/zerogxplode.spr")
    
ls_dot precache_model("sprites/laserdot.spr")
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
    
is_scan_rocket[id] = 0
    is_heat_rocket
[id] = 0
    using_menu
[id] = 0
    has_rocket
[id] = 0

    
if(get_cvar_num("bazooka_buy") == 0){
        
missile_inv[id][1] = get_cvar_num("bazooka_ammo1")
        
missile_inv[id][2] = get_cvar_num("bazooka_ammo2")
        
missile_inv[id][3] = get_cvar_num("bazooka_ammo3")
        
missile_inv[id][4] = get_cvar_num("bazooka_ammo4")
        
missile_inv[id][5] = get_cvar_num("bazooka_ammo5")
        
missile_inv[id][6] = get_cvar_num("bazooka_ammo6")
        
missile_inv[id][7] = get_cvar_num("bazooka_ammo7")
    }

    
radar_batt[id] = get_cvar_num("bazooka_radarbattery")
}
//----------------------------------------------------------------------------------------------
public client_disconnect(id)
{
    
remove_task(id)
    
is_scan_rocket[id] = 0
    is_heat_rocket
[id] = 0
    has_rocket
[id] = 0
}
//----------------------------------------------------------------------------------------------
#if defined AMX_NEW
public vexd_pfntouch(pToucherpTouched) {
    
entity_touch(pToucherpTouched)
}

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

    
if ( !is_valid_ent(pToucher) ) return

    new 
szClassName[32]
    
Entvars_Get_String(pToucherEV_SZ_classnameszClassName31)

    if(
equal(szClassName"bazooka_missile_ent")) {
        new 
damradius get_cvar_num("bazooka_damradius")
        new 
maxdamage get_cvar_num("bazooka_maxdamage")

        if (
damradius <= 0) {
            
debugMessage("(Bazooka) Damage Radius must be set higher than 0, defaulting to 240",0,0)
            
damradius 240
            set_cvar_num
("bazooka_damradius",damradius)
        }
        if (
maxdamage <= 0) {
            
debugMessage("(Bazooka) Max Damage must be set higher than 0, defaulting to 140",0,0)
            
maxdamage 140
            set_cvar_num
("bazooka_maxdamage",maxdamage)
        }

        
remove_task(pToucher)
        new 
Float:fl_vExplodeAt[3]
        
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])
        new 
id Entvars_Get_Edict(pToucherEV_ENT_owner)
        new 
origin[3],dist,i,Float:dRatio,damage
        AttachView
(idid)
        if(
has_rocket[id] == pToucher)
        
has_rocket[id] = 0

        
for ( 1<= SH_MAXSLOTSi++) {

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

                
dRatio floatdiv(float(dist),float(damradius))
                
damage maxdamage floatroundmaxdamage dRatio)

                
shExtraDamage(iiddamage"Bazooka" )

            }
        }

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(3)
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(boom)
        
write_byte(100)
        
write_byte(15)
        
write_byte(0)
        
message_end()

        
emit_sound(pToucherCHAN_WEAPON"weapons/explode3.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
emit_sound(pToucherCHAN_VOICE"weapons/explode3.wav"VOL_NORMATTN_NORM0PITCH_NORM)

        
RemoveEntity(pToucher)
        
is_heat_rocket[id] = 0
        is_scan_rocket
[id] = 0

        
if ( is_valid_ent(pTouched) ) {
            new 
szClassName2[32]
            
Entvars_Get_String(pTouchedEV_SZ_classnameszClassName231)

            if(
equal(szClassName2"bazooka_missile_ent")) {
                
remove_task(pTouched)
                
emit_sound(pTouchedCHAN_WEAPON"weapons/explode3.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                
emit_sound(pTouchedCHAN_VOICE"weapons/explode3.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                new 
id2 Entvars_Get_Edict(pTouchedEV_ENT_owner)
                
AttachView(id2id2)
                if(
has_rocket[id2] == pTouched){
                    
has_rocket[id2] = 0
                    is_heat_rocket
[id2] = 0
                    is_scan_rocket
[id2] = 0
                
}
                
RemoveEntity(pTouched)
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public fire_missile(id)
{
    if( 
roundfreeze || !is_user_alive(id))
        return 
PLUGIN_HANDLED

    
if ( !gHasBazookaPowers[id] ) {
        
client_print(id,print_chat,"[SH](Bazooka) You do not have this hero")
        return 
PLUGIN_HANDLED
    
}

    
show_missile_inv(id)

    if(
has_rocket[id]){
        
client_print(id,print_chat,"[SH](Bazooka) You cannot have more than one missile in the air at a time.")
        return 
PLUGIN_HANDLED
    
}

    new 
cmd[32],icmd
    read_argv
(0,cmd,31)

    if(
equal(cmd,"bazooka_missile"))                    icmd 1
    
if(get_cvar_num("bazooka_buy") == 1) {
        new 
cvarname[32]
        
format(cvarname,31,"bazooka_cost%d",icmd)
        new 
umoney get_user_money(id)
        new 
m_cost get_cvar_num(cvarname)
        if(
umoney m_cost){
            
client_print(id,print_chat,"[SH](Bazooka) Insufficient funds. Each of these missiles costs %d money",m_cost)
            return 
PLUGIN_HANDLED
        
}
        else {
            
set_user_money(id,umoney-m_cost,1)
        }
    }
    else {
        if( 
icmd == && get_cvar_num("bazooka_ammo7ta")){
            new 
sum
            
for(new 1<= 7i++)
                
sum += missile_inv[id][i]

            if(
sum 7) {
                
client_print(id,print_chat,"[SH](Bazooka) You do not have enough missiles to make a Swirling Death Missile.")
                if (
using_menu[id]) show_main_menu(id)
                return 
PLUGIN_HANDLED
            
}
            else{
                new 
take
                
for(new 1<= 7b++){
                    if(
take 7) {
                        for(new 
i=1<= 7i++){
                            if( (
missile_inv[id][i] > 0) && (take 7) ){
                                
missile_inv[id][i]--
                                
take++
                            }
                        }
                    }
                }
            }
        }
        else if( 
missile_inv[id][icmd] <= ){
            switch(
icmd){
                case 
1client_print(id,print_chat,"[SH](Bazooka) You have no more Common Missiles.")
            }
            return 
PLUGIN_HANDLED
        
}
        else {
            
missile_inv[id][icmd] -= 1
        
}
    }
    if(
icmd != 4){
        
show_missile_inv(id)
        switch(
icmd){
            case 
1make_rocket(id,icmd,get_cvar_num("bazooka_speed"),0)
            default: 
make_rocket(id,icmd,get_cvar_num("bazooka_speed"),0)
        }
    }
    else {
        
is_scan_rocket[id] = 1
        set_task
(0.2,"anti_missile_radar",id,"",0,"b")
        
set_task(0.3,"amr_pay",id,"",0,"b")
        
set_hudmessage(0,255,0, -1.00.2600.023.01.011.154)
        
show_hudmessage(id,"ANTIMISSILE RADAR SYSTEM ACTIVATED^nAim at missile you want to shoot down")
    }
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public amr_pay(id)
{
    
set_hudmessage(255,0,0, -1.00.2600.023.01.011.154)
    if(
radar_batt[id] < 1){
        
show_hudmessage(id,"WARNING: ANTIMISSILE RADAR SYSTEM FAILURE")
        
client_print(id,print_center,"^n^nBattery is dead")
        
is_scan_rocket[id] = 0
        remove_task
(id)
    }
    else{
        
client_print(id,print_center,"^n^n^nBattery %d",radar_batt[id])
    }
    
radar_batt[id]--
    
client_cmd(id,"spk fvox/blip")
    return 
PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
//make_rocket(userindex,commandtype,missilespeed,antimissleid)
make_rocket(id,icmd,iarg1,antimissile)
{

    new 
args[16]
    new 
Float:vOrigin[3]
    new 
Float:vAngles[3]
    
Entvars_Get_Vector(idEV_VEC_originvOrigin)
    
Entvars_Get_Vector(idEV_VEC_v_anglevAngles)
    new 
notFloat_vOrigin[3]
    
notFloat_vOrigin[0] = floatround(vOrigin[0])
    
notFloat_vOrigin[1] = floatround(vOrigin[1])
    
notFloat_vOrigin[2] = floatround(vOrigin[2])

    if(
icmd == 5){
        new 
aimvec[3]
        
get_user_origin(id,aimvec,3)
        new 
dist get_distance(notFloat_vOrigin,aimvec)
        new 
found
        
new dist1 20000

        
new players[32], inum
        get_players
(players,inum,"a")
        for(new 
;inum ;++i){
            if(
players[i] == id) continue

            new 
soutput[8],output
            get_user_info
(players[i],"JP",soutput,7)
            
output str_to_num(soutput)

            if(
output == 1){
                new 
temp[3]
                
get_user_origin(players[i],temp)
                
dist1 get_distance(temp,aimvec)
                if(
dist1 dist){
                    
dist dist1
                    found 
1
                    args
[6] = players[i]
                }
            }
        }
        if(!
found){
            
client_print(id,print_chat,"[SH](Bazooka) Cannot fire Heat-Seeking Missile, no running JetPacks in view.")

            if(
get_cvar_num("bazooka_buy") == 1){
                new 
umoney get_user_money(id)
                new 
m_cost get_cvar_num("bazooka_cost5")
                
set_user_money(id,umoney+m_cost,1)
            }
            else {
                
missile_inv[id][5] += 1
                show_missile_inv
(id)
            }
            if(
using_menu[id])
                
show_main_menu(id)

            return 
PLUGIN_HANDLED
        
}
    }
    else if(
icmd == 6){
        new 
aimvec[3]
        
get_user_origin(id,aimvec,3)
        new 
dist get_distance(notFloat_vOrigin,aimvec)
        new 
found
        
new dist1 20000
        
new players[32], inum
        get_players
(players,inum,"a")
        for(new 
;inum ;++i){
            if(
players[i] == id) continue

            new 
soutput[8],output
            get_user_info
(players[i],"ROPE",soutput,7)
            
output str_to_num(soutput)
            if(
output == 1){
                new 
temp[3]
                
get_user_origin(players[i],temp)
                
dist1 get_distance(temp,aimvec)
                if(
dist1 dist){
                    
dist dist1
                    found 
1
                    args
[6] = players[i]
                }
            }
        }
        if(!
found){
            
client_print(id,print_chat,"[SH](Bazooka) Cannot fire Rope-Seeking Missile, no Ropes in view.")

            if(
get_cvar_num("bazooka_buy") == 1){
                new 
umoney get_user_money(id)
                new 
m_cost get_cvar_num("bazooka_cost6")
                
set_user_money(id,umoney+m_cost,1)
            }
            else {
                
missile_inv[id][6] += 1
                show_missile_inv
(id)
            }
            if(
using_menu[id])
                
show_main_menu(id)

            return 
PLUGIN_HANDLED
        
}
    }
    
using_menu[id] = 0

    
new NewEnt
    NewEnt 
CreateEntity("info_target")
    if(
NewEnt == 0) {
        
client_print(id,print_chat,"[SH](Bazooka) Rocket Failure")
        return 
PLUGIN_HANDLED
    
}
    
has_rocket[id] = NewEnt
    missile_inv
[id][0] = 0

    Entvars_Set_String
(NewEntEV_SZ_classname"bazooka_missile_ent")
    
ENT_SetModel(NewEnt"models/rpgrocket.mdl")

    new 
Float:fl_vecminsx[3] = {-1.0, -1.0, -1.0}
    new 
Float:fl_vecmaxsx[3] = {1.01.01.0}

    
Entvars_Set_Vector(NewEntEV_VEC_mins,fl_vecminsx)
    
Entvars_Set_Vector(NewEntEV_VEC_maxs,fl_vecmaxsx)

    
ENT_SetOrigin(NewEntvOrigin)
    
Entvars_Set_Vector(NewEntEV_VEC_anglesvAngles)
    
Entvars_Set_Int(NewEntEV_INT_effects64)
    
Entvars_Set_Int(NewEntEV_INT_solid2)

    if(
get_cvar_num("bazooka_obeygravity")) {
        
Entvars_Set_Int(NewEntEV_INT_movetype6)
    }
    else {
        
Entvars_Set_Int(NewEntEV_INT_movetype5)
    }

    
Entvars_Set_Edict(NewEntEV_ENT_ownerid)
    
Entvars_Set_Float(NewEntEV_FL_health10000.0)
    
Entvars_Set_Float(NewEntEV_FL_takedamage100.0)
    
Entvars_Set_Float(NewEntEV_FL_dmg_take100.0)

    new 
Float:fl_iNewVelocity[3]
    new 
iNewVelocity[3]
    
VelocityByAim(idiarg1fl_iNewVelocity)
    
Entvars_Set_Vector(NewEntEV_VEC_velocityfl_iNewVelocity)
    
iNewVelocity[0] = floatround(fl_iNewVelocity[0])
    
iNewVelocity[1] = floatround(fl_iNewVelocity[1])
    
iNewVelocity[2] = floatround(fl_iNewVelocity[2])

    
emit_sound(NewEntCHAN_WEAPON"weapons/rocketfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(NewEntCHAN_VOICE"weapons/rocket1.wav"VOL_NORMATTN_NORM0PITCH_NORM)

    
args[0] = id
    args
[1] = NewEnt
    args
[2] = iarg1
    args
[3] = iNewVelocity[0]
    
args[4] = iNewVelocity[1]
    
args[5] = iNewVelocity[2]
    
args[8] = notFloat_vOrigin[0]
    
args[9] = notFloat_vOrigin[1]
    
args[10] = notFloat_vOrigin[2]

    switch(
icmd){
        case 
1: {
            
make_trail(NewEnt,icmd)
            
Entvars_Set_Float(NewEntEV_FL_gravity0.25)
            
set_task(0.1,"guide_rocket_comm",NewEnt,args,16,"b")
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
2: {
            
make_trail(NewEnt,icmd)
            
Entvars_Set_Float(NewEntEV_FL_gravity0.25)
            
set_task(0.1,"guide_rocket_las",NewEnt,args,16)
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
3: {
            
make_trail(NewEnt,icmd)
            
Entvars_Set_Float(NewEntEV_FL_gravity0.25)
            
Entvars_Set_Int(NewEntEV_INT_rendermode,1)
            
AttachView(idNewEnt)
            
args[11] = 1
            set_task
(0.1,"guide_rocket_dir",NewEnt,args,16,"b")
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
4: {
            
make_trail(NewEnt,icmd)
            
args[6] = antimissile
            Entvars_Set_Float
(NewEntEV_FL_gravity0.25)
            
set_task(0.1,"guide_rocket_anti",NewEnt,args,16)
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
5: {
            
is_heat_rocket[id] = 1
            make_trail
(NewEnt,icmd)
            
Entvars_Set_Float(NewEntEV_FL_gravity0.25)
            
set_task(0.1,"guide_rocket_het",NewEnt,args,16)
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
6: {
            
make_trail(NewEnt,icmd)
            
Entvars_Set_Float(NewEntEV_FL_gravity0.25)
            
set_task(0.1,"guide_rocket_rope",NewEnt,args,16)
            
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
        case 
7: {
            
Entvars_Set_Float(NewEntEV_FL_gravity0.000001)
            
SD_CircleRockets(NewEnt)
            
set_task(0.1,"guide_rocket_swirl",NewEnt,args,16)
            
set_task(get_cvar_float("bazooka_sdfuel"),"rocket_fuel_timer",NewEnt,args,16)
        }
    }
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
make_trail(NewEnt,style)
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(22)
    
write_short(NewEnt)
    
write_short(beam)
    
write_byte(45)
    
write_byte(4)
    switch(
style){
        case 
1: {
            
write_byte(254)
            
write_byte(254)
            
write_byte(254)
            
write_byte(100)
        }
        case 
2: {
            
write_byte(254)
            
write_byte(254)
            
write_byte(100)
            
write_byte(100)
        }
        case 
3: {
            
write_byte(100)
            
write_byte(254)
            
write_byte(254)
            
write_byte(100)
        }
        case 
4: {
            
write_byte(254)
            
write_byte(150)
            
write_byte(50)
            
write_byte(100)
        }
        case 
5: {
            
write_byte(250)
            
write_byte(100)
            
write_byte(100)
            
write_byte(100)
        }
        case 
6: {
            
write_byte(100)
            
write_byte(250)
            
write_byte(100)
            
write_byte(100)
        }
        case 
7: {
            
write_byte(100)
            
write_byte(100)
            
write_byte(250)
            
write_byte(100)
        }
        default: {
            
write_byte(254)
            
write_byte(254)
            
write_byte(254)
            
write_byte(100)
        }
    }
    
message_end()
}
//----------------------------------------------------------------------------------------------
public guide_rocket_comm(args[])
{
    new 
ent args[1]
    if (!
is_valid_ent(ent)) return
    new 
Float:missile_health Entvars_Get_Float(entEV_FL_health)
    if(
missile_health 10000.0)
        
vexd_pfntouch(ent,0)
}
//----------------------------------------------------------------------------------------------
public guide_rocket_dir(args[])
{
    new 
id args[0]
    new 
ent args[1]
    new 
speed args[2]
    new 
Float:fl_iNewVelocity[3]
    if (!
is_valid_ent(ent)) return
    
VelocityByAim(idspeedfl_iNewVelocity)
    
Entvars_Set_Vector(entEV_VEC_velocityfl_iNewVelocity)

    new 
Float:vAngles[3]
    
Entvars_Get_Vector(idEV_VEC_v_anglevAngles)
    
Entvars_Set_Vector(entEV_VEC_anglesvAngles)

    new 
Float:missile_health Entvars_Get_Float(entEV_FL_health)
    if(
missile_health <10000.0) {
        
vexd_pfntouch(ent,0)
    }
}
//----------------------------------------------------------------------------------------------
public guide_rocket_las(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
    
get_user_origin(id,aimvec,3)

    
//Make the Laser Dot
    
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte17 )
    
write_coord(aimvec[0])
    
write_coord(aimvec[1])
    
write_coord(aimvec[2])
    
write_shortls_dot )
    
write_byte10 )
    
write_byte255 )
    
message_end()

    
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(
speed 400)
        
avgFactor 10
    
else if(speed 850)
        
avgFactor 4
    
else
        
avgFactor 2

    
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])
    
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] = iNewVelocity[0] + 0.0
    fl_iNewVelocity
[1] = iNewVelocity[1] + 0.0
    fl_iNewVelocity
[2] = iNewVelocity[2] + 0.0
    Entvars_Set_Vector
(entEV_VEC_velocityfl_iNewVelocity)
    
args[3] = iNewVelocity[0]
    
args[4] = iNewVelocity[1]
    
args[5] = iNewVelocity[2]
    
args[8] = origin[0]
    
args[9] = origin[1]
    
args[10] = origin[2]
    
set_task(0.1,"guide_rocket_las",ent,args,16)

    new 
Float:missile_health
    missile_health 
Float:Entvars_Get_Float(entEV_FL_health)
    if(
missile_health 10000.0) {
        
vexd_pfntouch(ent,0)
    }
}
//----------------------------------------------------------------------------------------------
public guide_rocket_het(args[])
{
    new 
aimvec[3],avgFactor
    
new Float:fl_origin[3]
    new 
t_aimvec[33][3]
    new 
t_index[33]
    new 
t_jp,dist
    
new jp_dist 20000
    
new id args[0]
    new 
ent args[1]
    new 
speed args[2]
    new 
iNewVelocity[3]
    if (!
is_valid_ent(ent)) return
    
Entvars_Get_Vector(entEV_VEC_originfl_origin)
    new 
origin[3]
    
origin[0] = floatround(fl_origin[0])
    
origin[1] = floatround(fl_origin[1])
    
origin[2] = floatround(fl_origin[2])

    new 
soutput[8],output
    get_user_info
(args[6],"JP",soutput,7)
    
output str_to_num(soutput)

    if((
output == 1) || (args[7] < 5)){
        if(
is_user_alive(args[6]) == 1){
            
get_user_origin(args[6],aimvec)
            
dist get_distance(aimvec,origin)
        }
        else {
            
args[7] = 100
        
}
        if(
output == 1)
            
args[7] = 0
    
}
    else {
        new 
players[32], inum
        get_players
(players,inum,"a")
        for(new 
;inum ;++i){
            if(
players[i] != id){
                
setc(soutput,8,0)
                
get_user_info(players[i],"JP",soutput,7)
                
output str_to_num(soutput)

                if(
output){
                    new 
temp[3]
                    
get_user_origin(players[i],temp)
                    
t_aimvec[t_jp][0] = temp[0]
                    
t_aimvec[t_jp][1] = temp[1]
                    
t_aimvec[t_jp][2] = temp[2]
                    
t_index[t_jp] = players[i]
                    
t_jp++
                }
            }
        }
        for(new 
;t_jp ;++i){
            new 
temp[3]
            
temp[0] = t_aimvec[i][0]
            
temp[1] = t_aimvec[i][1]
            
temp[2] = t_aimvec[i][2]
            
dist get_distance(temp,origin)
            if(
dist jp_dist){
                
aimvec[0] = temp[0]
                
aimvec[1] = temp[1]
                
aimvec[2] = temp[2]
                
jp_dist dist
                args
[6] = t_index[i]
                
args[7] = 0
            
}
        }
    }
    if(
dist){
        if(
speed 400)
            
avgFactor 10
        
else if(speed 850)
            
avgFactor 4
        
else
            
avgFactor 2

        
new lengthvelocityvec[3]
        
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])
        
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

        args
[3] = iNewVelocity[0]
        
args[4] = iNewVelocity[1]
        
args[5] = iNewVelocity[2]
        if(
dist 20){
            
vexd_pfntouch(ent,0)
            return
        }
    }
    
args[7] += 1
    
new Float:fl_iNewVelocity[3]
    
fl_iNewVelocity[0] = args[3] +0.0
    fl_iNewVelocity
[1] = args[4] +0.0
    fl_iNewVelocity
[2] = args[5] +0.0

    Entvars_Set_Vector
(entEV_VEC_velocityfl_iNewVelocity)
    
set_task(0.1,"guide_rocket_het",ent,args,16)

    new 
Float:missile_health
    missile_health 
Float:Entvars_Get_Float(entEV_FL_health)
    if(
missile_health 10000.0) {
        
vexd_pfntouch(ent,0)
    }
}
//----------------------------------------------------------------------------------------------
public guide_rocket_anti(args[])
{
    new 
Float:fl_aimvec[3]
    new 
Float:fl_origin[3]
    new 
avgFactor
    
new id args[0]
    new 
ent args[1]
    new 
speed args[2]
    new 
iNewVelocity[3]
    if (!
is_valid_ent(ent)) return

    
Entvars_Get_Vector(entEV_VEC_originfl_origin)
    new 
origin[3]
    
origin[0] = floatround(fl_origin[0])
    
origin[1] = floatround(fl_origin[1])
    
origin[2] = floatround(fl_origin[2])

    if(
FindEntity(args[6], "bazooka_missile_ent") > 0){
        
Entvars_Get_Vector(args[6], EV_VEC_originfl_aimvec)
          new 
aimvec[3]
        
aimvec[0] = floatround(fl_aimvec[0])
        
aimvec[1] = floatround(fl_aimvec[1])
        
aimvec[2] = floatround(fl_aimvec[2])
        if(
speed 400)
            
avgFactor 10
        
else if(speed 850)
            
avgFactor 4
        
else
            
avgFactor 2
        
new lengthvelocityvec[3]
        
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])
        
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
        args
[3] = iNewVelocity[0]
        
args[4] = iNewVelocity[1]
        
args[5] = iNewVelocity[2]
        if(
get_distance(origin,aimvec) < 150){
            
vexd_pfntouch(ent,args[6])
            return
        }
        new 
Float:fl_iNewVelocity[3]
        
fl_iNewVelocity[0] = args[3] +0.0
        fl_iNewVelocity
[1] = args[4] +0.0
        fl_iNewVelocity
[2] = args[5] +0.0
        Entvars_Set_Vector
(entEV_VEC_velocityfl_iNewVelocity)
        
set_task(0.1,"guide_rocket_anti",ent,args,16)
    }
    new 
Float:missile_health Entvars_Get_Float(entEV_FL_health)
    if(
missile_health 10000.0) {
        
vexd_pfntouch(ent,0)
    }
    
client_cmd(id,"spk buttons/blip2")
}
//----------------------------------------------------------------------------------------------
public guide_rocket_rope(args[])
{
    new 
aimvec[3],avgFactor
    
new Float:fl_origin[3]
    new 
t_aimvec[33][3]
    new 
t_index[33]
    new 
t_jp,dist
    
new jp_dist 20000
    
new id args[0]
    new 
ent args[1]
    new 
speed args[2]
    new 
iNewVelocity[3]
    if (!
is_valid_ent(ent)) return
    
Entvars_Get_Vector(entEV_VEC_originfl_origin)
    new 
origin[3]
    
origin[0] = floatround(fl_origin[0])
    
origin[1] = floatround(fl_origin[1])
    
origin[2] = floatround(fl_origin[2])

    new 
soutput[8],output
    get_user_info
(args[6],"ROPE",soutput,7)
    
output str_to_num(soutput)

    if((
output == 1) || (args[7] < 31)){
        if(
is_user_alive(args[6]) == 1){
            
get_user_origin(args[6],aimvec)
            
dist get_distance(aimvec,origin)
        }
        else {
            
args[7] = 100
        
}
        if(
output == 1)
            
args[7] = 0
    
}
    else {
        new 
players[32], inum
        get_players
(players,inum,"a")
        for(new 
;inum ;++i){
            if(
players[i] != id){
                
setc(soutput,8,0)
                
get_user_info(players[i],"ROPE",soutput,7)
                
output str_to_num(soutput)

                if(
output){
                    new 
temp[3]
                    
get_user_origin(players[i],temp)
                    
t_aimvec[t_jp][0] = temp[0]
                    
t_aimvec[t_jp][1] = temp[1]
                    
t_aimvec[t_jp][2] = temp[2]
                    
t_index[t_jp] = players[i]
                    
t_jp++
                }
            }
        }
        for(new 
;t_jp ;++i){
            new 
temp[3]
            
temp[0] = t_aimvec[i][0]
            
temp[1] = t_aimvec[i][1]
            
temp[2] = t_aimvec[i][2]
            
dist get_distance(temp,origin)
            if(
dist jp_dist){
                
aimvec[0] = temp[0]
                
aimvec[1] = temp[1]
                
aimvec[2] = temp[2]
                
jp_dist dist
                args
[6] = t_index[i]
                
args[7] = 0
            
}
        }
    }
    if(
dist){
        if(
speed 400)
            
avgFactor 10
        
else if(speed 850)
            
avgFactor 4
        
else
            
avgFactor 2

        
new lengthvelocityvec[3]
        
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])
        
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

        args
[3] = iNewVelocity[0]
        
args[4] = iNewVelocity[1]
        
args[5] = iNewVelocity[2]
        if(
dist 60){
            
vexd_pfntouch(ent,0)
            return
        }
    }
    
args[7] += 1
    
new Float:fl_iNewVelocity[3]
    
fl_iNewVelocity[0] = args[3] +0.0
    fl_iNewVelocity
[1] = args[4] +0.0
    fl_iNewVelocity
[2] = args[5] +0.0

    Entvars_Set_Vector
(entEV_VEC_velocityfl_iNewVelocity)
    
set_task(0.1,"guide_rocket_rope",ent,args,16)

    new 
Float:missile_health
    missile_health 
Float:Entvars_Get_Float(entEV_FL_health)
    if(
missile_health <10000.0) {
        
vexd_pfntouch(ent,0)
    }
}
//----------------------------------------------------------------------------------------------
public guide_rocket_swirl(args[]){
    new 
ent args[1]
    if (!
is_valid_ent(ent)) return
    
set_task(0.1,"guide_rocket_swirl",ent,args,16)
    new 
Float:missile_health Entvars_Get_Float(entEV_FL_health)
    if(
missile_health <10000.0) {
        
vexd_pfntouch(ent,0)
    }
}
//----------------------------------------------------------------------------------------------
public rocket_fuel_timer(args[]){
    new 
ent args[1]
    new 
id args[0]
    
remove_task(ent)
    if (!
is_valid_ent(ent)) return
    
Entvars_Set_Int(entEV_INT_effects2)
    
Entvars_Set_Int(entEV_INT_rendermode,0)
    
Entvars_Set_Float(entEV_FL_gravity1.0)
    
Entvars_Set_Int(entEV_INT_iuser10)
    
emit_sound(entCHAN_WEAPON"debris/beamstart8.wav"VOL_NORMATTN_NORM0PITCH_NORM )
    
emit_sound(entCHAN_VOICE"ambience/rocket_steam1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    if(
args[11] == 1){
        
set_hudmessage(250,10,10,-1.0,0.4500.01.50.50.1554)
        
show_hudmessage(id,"WARNING: FUEL TANK EMPTY^nCONTROLS DISENGAGED")
    }
    
set_task(0.1,"guide_rocket_comm",ent,args,16,"b")
}
//----------------------------------------------------------------------------------------------
public laser_check() {
    new 
arg[32]
    
read_argv(1,arg,31)
    new 
iarg str_to_num(arg)
    if(
is_valid_ent(iarg)) {
        new 
szClassName[32]
        
Entvars_Get_String(iargEV_SZ_classnameszClassName31)
        if(
equal(szClassName"bazooka_missile_ent")) {
            
vexd_pfntouch(iarg,0)
        }
    }
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public show_missile_inv(id) {
    if(
get_cvar_num("bazooka_buy") == 0){
        new 
Message[350]
        new 
len 349
        
new 0

        
new sum
        
for(new i=1;i<8;i++)
            
sum += missile_inv[id][i]

        
set_hudmessage(25510100.800.6000.026.01.011.155)
        
+= formatMessage[n],len-n,"Common Missile  ( %d )^n",missile_inv[id][1])
        
+= formatMessage[n],len-n,"Laser Guided Missile  ( %d )^n",missile_inv[id][2])
        
+= formatMessage[n],len-n,"Gun Camera Missile  ( %d )^n",missile_inv[id][3])
        
+= formatMessage[n],len-n,"Anti-Missile Shots  ( %d )^n",missile_inv[id][4])
        
+= formatMessage[n],len-n,"Heat-Seeking Missile  ( %d )^n",missile_inv[id][5])
        
+= formatMessage[n],len-n,"Rope-Seeking Missile  ( %d )^n",missile_inv[id][6])

        if(
get_cvar_num("bazooka_ammo7ta")) {
            new 
sdcount sum 7
            n 
+= formatMessage[n],len-n,"Swirling Death Missile  ( %d )",sdcount)
        }
        else
            
+= formatMessage[n],len-n,"Swirling Death Missile  ( %d )",missile_inv[id][7])

        
show_hudmessage(id,Message)
    }
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public show_main_menu(id) {
    new 
menu_body[320]
    new 
0
    
new len 319

    
if(!gHasBazookaPowers[id] || !is_user_alive(id))
        return 
PLUGIN_HANDLED

    n 
+= formatmenu_body[n],len-n,"\yFire Missile Menu^n\w^n")

    if(
get_cvar_num("bazooka_buy") == ){

        
+= formatmenu_body[n],len-n,"1. Common Missile - $%d^n",get_cvar_num("bazooka_cost1"))
        
+= formatmenu_body[n],len-n,"2. Laser Guided Missile - $%d^n",get_cvar_num("bazooka_cost2"))
        
+= formatmenu_body[n],len-n,"3. Gun Camera Missile - $%d^n",get_cvar_num("bazooka_cost3"))
        
+= formatmenu_body[n],len-n,"4. Anti-Missile Shots - $%d^n",get_cvar_num("bazooka_cost4"))
        
+= formatmenu_body[n],len-n,"5. Heat-Seeking Missile - $%d^n",get_cvar_num("bazooka_cost5"))
        
+= formatmenu_body[n],len-n,"6. Rope-Seeking Missile - $%d^n",get_cvar_num("bazooka_cost6"))
        
+= formatmenu_body[n],len-n,"7. Swirling Death Missile - $%d^n",get_cvar_num("bazooka_cost7"))
    }
    else {

        new 
sum
        
for(new i=1;i<8;i++)
            
sum += missile_inv[id][i]

        
+= formatmenu_body[n],len-n,"1. Common Missile ( %d )^n",missile_inv[id][1])
        
+= formatmenu_body[n],len-n,"2. Laser Guided Missile ( %d )^n",missile_inv[id][2])
        
+= formatmenu_body[n],len-n,"3. Gun Camera Missile ( %d )^n",missile_inv[id][3])
        
+= formatmenu_body[n],len-n,"4. Anti-Missile Shots ( %d )^n",missile_inv[id][4])
        
+= formatmenu_body[n],len-n,"5. Heat-Seeking Missile ( %d )^n",missile_inv[id][5])
        
+= formatmenu_body[n],len-n,"6. Rope-Seeking Missile ( %d )^n",missile_inv[id][6])

        if(
get_cvar_num("bazooka_ammo7ta")) {
            new 
sdcount sum 7
            n 
+= formatmenu_body[n],len-n,"7. Swirling Death Missile ( %d )^n",sdcount)
        }
        else
            
+= formatmenu_body[n],len-n,"7. Swirling Death Missile ( %d )^n",missile_inv[id][7])
    }

    
+= formatmenu_body[n],len-n,"0. Exit")

    new 
keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<9)

    
show_menu(id,keys,menu_body)
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public action_main_menu(id,key){
    
using_menu[id] = 1
    key
++

    if(!
gHasBazookaPowers[id] || !is_user_alive(id)) {
        
using_menu[id] = 0
        
return PLUGIN_HANDLED
    
}

    if (
roundfreeze && key != 10) {
        
show_main_menu(id)
        return 
PLUGIN_HANDLED
    
}


    switch(
key){
        case 
1client_cmd(id,"bazooka_missile")
        case 
2client_cmd(id,"bazooka_laserguided_missile")
        case 
3client_cmd(id,"bazooka_guncamera_missile")
        case 
4client_cmd(id,"bazooka_anti_missile")
        case 
5client_cmd(id,"bazooka_heatseeking_missile")
        case 
6client_cmd(id,"bazooka_ropeseeking_missile")
        case 
7client_cmd(id,"bazooka_swirlingdeath_missile")
        case 
10using_menu[id] = 0
        
default: show_main_menu(id)
    }

    if (
key >= && key <= 7) {
        if(
get_cvar_num("bazooka_buy")){
            new 
costcvar[32]
            
format(costcvar,31,"bazooka_cost%d",key)
            if(
get_user_money(id) < get_cvar_num(costcvar))
                  
show_main_menu(id)
        }
        else {
            if(
key == && !get_cvar_num("bazooka_ammo7ta") && missile_inv[id][key] <= 0)
                
show_main_menu(id)
            else if(
missile_inv[id][key] <= 0)
                
show_main_menu(id)
        }
    }

    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public death_event(){
    new 
victim
    victim 
read_data(2)
    
remove_task(victim)
    
is_scan_rocket[victim] = 0
    using_menu
[victim] = 0
}
//----------------------------------------------------------------------------------------------
public round_end(){

    
roundfreeze true

    
for (new i=1<= get_maxplayers(); i++) {
        if(
is_user_connected(i)) {
            if( !
is_user_alive(i) && get_cvar_num("bazooka_buy") ){
                
missile_inv[i][1] = 0
                missile_inv
[i][2] = 0
                missile_inv
[i][3] = 0
                missile_inv
[i][4] = 0
                missile_inv
[i][5] = 0
                missile_inv
[i][6] = 0
                missile_inv
[i][7] = 0
            
}
        }
        if(
has_rocket[i] > 0)
            
remove_missile(i,has_rocket[i])
    }
    return 
PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public round_start(){

    
roundfreeze false

    
if (get_cvar_num("bazooka_spawndelay") && !round_delay) {
        
round_delay 1
        set_task
(15.0,"roundstart_delay")
    }

    for (new 
1<= get_maxplayers(); i++) {
        
radar_batt[i] = get_cvar_num("bazooka_radarbattery")
        if(!
get_cvar_num("bazooka_buy")){
            
missile_inv[i][1] = get_cvar_num("bazooka_ammo1")
            
missile_inv[i][2] = get_cvar_num("bazooka_ammo2")
            
missile_inv[i][3] = get_cvar_num("bazooka_ammo3")
            
missile_inv[i][4] = get_cvar_num("bazooka_ammo4")
            
missile_inv[i][5] = get_cvar_num("bazooka_ammo5")
            
missile_inv[i][6] = get_cvar_num("bazooka_ammo6")
            
missile_inv[i][7] = get_cvar_num("bazooka_ammo7")
        }
    }
    new 
iCurrent
    
while ((iCurrent FindEntity(-1"bazooka_missile_ent")) > 0) {
        new 
id Entvars_Get_Edict(iCurrentEV_ENT_owner)
        
remove_missile(id,iCurrent)
    }
    return 
PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public roundstart_delay(){
    
round_delay 0
}
//----------------------------------------------------------------------------------------------
remove_missile(id,missile){

    new 
Float:fl_origin[3]
    
Entvars_Get_Vector(missileEV_VEC_originfl_origin)

    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(14)
    
write_coord(floatround(fl_origin[0]))
    
write_coord(floatround(fl_origin[1]))
    
write_coord(floatround(fl_origin[2]))
    
write_byte (200)
    
write_byte (40)
    
write_byte (45)
    
message_end()

    
emit_sound(missileCHAN_WEAPON"ambience/particle_suck2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(missileCHAN_VOICE"ambience/particle_suck2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
has_rocket[id] = 0
    is_heat_rocket
[id] = 0
    is_scan_rocket
[id] = 0
    remove_task
(missile)
    
AttachView(id,id)
    
RemoveEntity(missile)
    return 
PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public SD_CircleRockets(Ent){
    new 
NUMBER_OF_ROCKETS get_cvar_num("bazooka_sdcount")
    new 
Float:ROCKET_RADIUS =  get_cvar_float("bazooka_sdradius")
    new 
Float:vOrigin[3]
    new 
Float:vVelocity[3]
    new 
Float:vEntOrig[3]
    new 
Float:RotMatrix[3][3]
    new 
Float:xFloat:yFloat:zFloat:theta
    
new iidNewEnt
    
if (!is_valid_ent(Ent)) return
    
Entvars_Get_Vector(EntEV_VEC_originvOrigin)
    
Entvars_Get_Vector(EntEV_VEC_velocityvVelocity)
    
id Entvars_Get_Edict(EntEV_ENT_owner)

    
RotMatrix[0][0]=vVelocity[0]
    
RotMatrix[0][1]=vVelocity[1]
    
RotMatrix[0][2]=vVelocity[2]
    
RotMatrix[1][0]=-vVelocity[1]
    
RotMatrix[1][1]=vVelocity[0]
    
RotMatrix[1][2]=0.0
    SD_Normalise
(RotMatrix[0])
    
SD_Normalise(RotMatrix[1])

    
RotMatrix[2][0]=((RotMatrix[0][1])*(RotMatrix[1][2]))-((RotMatrix[0][2])*(RotMatrix[1][1]))
    
RotMatrix[2][1]=((RotMatrix[0][2])*(RotMatrix[1][0]))-((RotMatrix[0][0])*(RotMatrix[1][2]))
    
RotMatrix[2][2]=((RotMatrix[0][0])*(RotMatrix[1][1]))-((RotMatrix[0][1])*(RotMatrix[1][0]))

    for (
i=0NUMBER_OF_ROCKETSi++){
        
theta = (float(i)/float(NUMBER_OF_ROCKETS))*2*PI+fAngleBaz
        x 
0.0
        
#if !defined AMX98
        
floatcos(theta)*ROCKET_RADIUS
        z 
floatsin(theta)*ROCKET_RADIUS
        
#else
        
cos(theta)*ROCKET_RADIUS
        z 
sin(theta)*ROCKET_RADIUS
        
#endif
        
vEntOrig[0]=RotMatrix[0][0]*x+RotMatrix[1][0]*y+RotMatrix[2][0]*z
        vEntOrig
[1]=RotMatrix[0][1]*x+RotMatrix[1][1]*y+RotMatrix[2][1]*z
        vEntOrig
[2]=RotMatrix[0][2]*x+RotMatrix[1][2]*y+RotMatrix[2][2]*z
        vEntOrig
[0]+=vOrigin[0]
        
vEntOrig[1]+=vOrigin[1]
        
vEntOrig[2]+=vOrigin[2]
        
NewEnt SD_CreateRocket(vEntOrigvVelocityid)
        
Entvars_Set_Int(NewEntEV_INT_iuser1Ent)
        
Entvars_Set_Int(NewEntEV_INT_iuser2i)
    }
}
//----------------------------------------------------------------------------------------------
public SD_CreateRocket(Float:vOrigin[3], Float:vVelocity[3], id)
{
    new 
Float:vAngles[3]
    
VecToAngles(vVelocityvAngles)
    new 
NewEnt CreateEntity("info_target")
    if(!
NewEnt) return PLUGIN_CONTINUE
    Entvars_Set_String
(NewEntEV_SZ_classname"bazooka_missile_ent")
    
ENT_SetModel(NewEnt"models/rpgrocket.mdl")
    new 
Float:fl_vecminsx[3] = {-1.0, -1.0, -1.0}
    new 
Float:fl_vecmaxsx[3] = {1.01.01.0}
    
Entvars_Set_Vector(NewEntEV_VEC_minsfl_vecminsx)
    
Entvars_Set_Vector(NewEntEV_VEC_maxsfl_vecmaxsx)
    
ENT_SetOrigin(NewEntvOrigin)
    
Entvars_Set_Vector(NewEntEV_VEC_anglesvAngles)
    
Entvars_Set_Int(NewEntEV_INT_solid2)
    
Entvars_Set_Int(NewEntEV_INT_movetype6)
    
Entvars_Set_Edict(NewEntEV_ENT_ownerid)
    
Entvars_Set_Float(NewEntEV_FL_health10000.0)
    
Entvars_Set_Float(NewEntEV_FL_takedamage100.0)
    
Entvars_Set_Float(NewEntEV_FL_dmg_take100.0)
    
Entvars_Set_Vector(NewEntEV_VEC_velocityvVelocity)
    
make_trail(NewEnt,7// 7 = Swirling Missiles
    
Entvars_Set_Float(NewEntEV_FL_gravity0.000001 )

    
emit_sound(NewEntCHAN_WEAPON"weapons/rocketfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(NewEntCHAN_VOICE"weapons/rocket1.wav"VOL_NORMATTN_NORM0PITCH_NORM)

    new 
args[16]
    
args[0] = id
    args
[1] = NewEnt
    args
[2] = get_cvar_num("bazooka_sdspeed")
    
args[3] = floatround(vVelocity[0])
    
args[4] = floatround(vVelocity[1])
    
args[5] = floatround(vVelocity[2])
    
set_task(get_cvar_float("bazooka_sdfuel"),"rocket_fuel_timer",NewEnt,args,16)

    return 
NewEnt
}
//----------------------------------------------------------------------------------------------
public SD_Normalise(Float:Vector[3]){
    new 
Float:NullVector[3] = {0.0,0.0,0.0}
    new 
Float:fLength VecDist(VectorNullVector)
    
Vector[0] /= fLength
    Vector
[1] /= fLength
    Vector
[2] /= fLength
}
//----------------------------------------------------------------------------------------------
public RocketThink() {
    new 
NUMBER_OF_ROCKETS get_cvar_num("bazooka_sdcount")
    new 
ANGULAR_VELOCITY get_cvar_num("bazooka_sdrotate")
    new 
Float:ROCKET_RADIUS =  get_cvar_float("bazooka_sdradius")
    new 
iCurrentiCenterRocketi
    
new Float:vOrigin[3], Float:vVelocity[3]
    new 
Float:RotMatrix[3][3]
    new 
Float:vEntOrig[3], Float:vOldEntOrig[3]
    new 
Float:xFloat:yFloat:zFloat:theta
    
new Float:vAngles[3], Float:fNewVelocity[3]
    new 
iTempEnt
    fAngleBaz 
+= ANGULAR_VELOCITY DT

    
if (fAngleBaz 2*PI)
        
fAngleBaz -= 2*PI

    iCurrent 
= -1

    
while ((iCurrent FindEntity(iCurrent"bazooka_missile_ent")) > 0){
        
iCenterRocket Entvars_Get_Int(iCurrentEV_INT_iuser1)
        if (
iCenterRocket){

            
iTempEnt = -1
            
while ((iTempEnt FindEntity(iTempEnt"bazooka_missile_ent")) > 0){
                if (
iTempEnt == iCenterRocket) break
            }

            if (
iTempEnt 0){
                
Entvars_Get_Vector(iCenterRocketEV_VEC_originvOrigin)
                
Entvars_Get_Vector(iCenterRocketEV_VEC_velocityvVelocity)
                
Entvars_Get_Vector(iCurrentEV_VEC_originvOldEntOrig)
                
Entvars_Get_Int(iCurrentEV_INT_iuser2)
                
RotMatrix[0][0]=vVelocity[0]
                
RotMatrix[0][1]=vVelocity[1]
                
RotMatrix[0][2]=vVelocity[2]
                
RotMatrix[1][0]=-vVelocity[1]
                
RotMatrix[1][1]=vVelocity[0]
                
RotMatrix[1][2]=0.0
                SD_Normalise
(RotMatrix[0])
                
SD_Normalise(RotMatrix[1])
                
RotMatrix[2][0]=((RotMatrix[0][1])*(RotMatrix[1][2]))-((RotMatrix[0][2])*(RotMatrix[1][1]))
                
RotMatrix[2][1]=((RotMatrix[0][2])*(RotMatrix[1][0]))-((RotMatrix[0][0])*(RotMatrix[1][2]))
                
RotMatrix[2][2]=((RotMatrix[0][0])*(RotMatrix[1][1]))-((RotMatrix[0][1])*(RotMatrix[1][0]))
                
theta = (float(i)/float(NUMBER_OF_ROCKETS))*2*PI+fAngleBaz
                x 
0.0
                
#if !defined AMX98
                
floatcos(theta)*ROCKET_RADIUS
                z 
floatsin(theta)*ROCKET_RADIUS
                
#else
                
cos(theta)*ROCKET_RADIUS
                z 
sin(theta)*ROCKET_RADIUS
                
#endif
                
vEntOrig[0]=RotMatrix[0][0]*x+RotMatrix[1][0]*y+RotMatrix[2][0]*z
                vEntOrig
[1]=RotMatrix[0][1]*x+RotMatrix[1][1]*y+RotMatrix[2][1]*z
                vEntOrig
[2]=RotMatrix[0][2]*x+RotMatrix[1][2]*y+RotMatrix[2][2]*z
                vEntOrig
[0]+=vOrigin[0]
                
vEntOrig[1]+=vOrigin[1]
                
vEntOrig[2]+=vOrigin[2]
                
vEntOrig[0]+=vVelocity[0]*DT
                vEntOrig
[1]+=vVelocity[1]*DT
                vEntOrig
[2]+=vVelocity[2]*DT
                CalculateVelocity
(vOldEntOrigvEntOrigfNewVelocity)
                
Entvars_Set_Vector(iCurrentEV_VEC_velocityfNewVelocity)
                
VecToAngles(fNewVelocityvAngles)
                
Entvars_Set_Vector(iCurrentEV_VEC_anglesvAngles)
                new 
Float:missile_health Entvars_Get_Float(iCurrentEV_FL_health)
                if(
missile_health 10000.0)
                    
vexd_pfntouch(iCurrent,0)
            }
            else {
                
Entvars_Set_Int(iCurrentEV_INT_iuser10)
            }
        }
    }
}
//----------------------------------------------------------------------------------------------
public CalculateVelocity(Float:vOrigin[3], Float:vEnd[3], Float:vVelocity[3]){
    
vVelocity[0] = (vEnd[0] - vOrigin[0]) / DT
    vVelocity
[1] = (vEnd[1] - vOrigin[1]) / DT
    vVelocity
[2] = (vEnd[2] - vOrigin[2]) / DT
}
//----------------------------------------------------------------------------------------------
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
*/ 
__________________
rodrigo is offline
rodrigo
Senior Member
Join Date: Jul 2010
Location: Brasil
Old 08-12-2010 , 19:32   Hero: Bazooka -Only common missile-
Reply With Quote #62

Guys, is the first time I edit a hero and succeed, then all aid is welcome!

Thanks to "Eric Lidman & jtp10181" for making the hero!

Bazooka -Only common missile-

Description
Rocket-Laucher - Fire only Common Missile



Bazooka was a tank driver in his early military career, but soon realized that a simple rocket launcher in the hands of a novice could destroy a tank. He transferred and became a specialist at just that - destroying tanks. Rumor has it that he even sleeps with his missile launcher.

Cvars:
Code:
//Bazooka
bazooka_level 8
bazooka_buy 0            //Set to 1 to require missiles to be purchased

//
//The following "COST" settings only apply if buying mode is ON
//

bazooka_cost1 1000        //Common missile cost

//
//The following "AMMO" settings only apply if buying mode is OFF
//

bazooka_ammo1 1        //Free Common missiles

bazooka_speed 1000        //Sets the default speed of most missiles
bazooka_fuel 6.0        //Number of seconds a missile is driven before it falls to the ground out of fuel
bazooka_obeygravity 1    //Makes missile obey server gravity rules
bazooka_damradius 240    //Max distance from the blast that damage will occur at
bazooka_maxdamage 140    //Maximum Blast damage from explosion
bazooka_radarbattery 100        //Sets the amount of time a player can use his anti-missile radar per round.

//This cvar limits the two types of missiles responsible for spawn rape, guncamera and
//swirling death, from being fired until 15 seconds of a round has passed. Set cvar to 0
//to allow those missiles to be fired without being limited by round start
bazooka_spawndelay 0
Attached Files
File Type: sma Get Plugin or Get Source (sh_bazooka.sma - 592 views - 44.7 KB)
__________________

Last edited by rodrigo; 08-12-2010 at 19:38.
rodrigo is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 08-12-2010 , 20:25   Re: Hero: Bazooka -Only common missile-
Reply With Quote #63

You did not make this. Don't post heroes you just have edited. Only new heroes or no heroes.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
rodrigo
Senior Member
Join Date: Jul 2010
Location: Brasil
Old 08-12-2010 , 21:03   Re: Hero: Bazooka -Only common missile-
Reply With Quote #64

I post on Suggestions/Requests ?
But if I edit the sounds and model, add hp, ap, gravity, can I put here?
__________________

Last edited by rodrigo; 08-12-2010 at 21:15.
rodrigo is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 08-13-2010 , 03:59   Re: Hero: Bazooka -Only common missile-
Reply With Quote #65

Quote:
Originally Posted by rodrigo View Post
I post on Suggestions/Requests ?
But if I edit the sounds and model, add hp, ap, gravity, can I put here?
No you cant, the policy is only heroes that are coded in the 1.2.0.14 ways AND the idea must be original, not a rip of an old hero
__________________
The Art of War is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 08-13-2010 , 06:22   Re: Bazooka
Reply With Quote #66

I can see vittu merged this into the original post of bazooka. Way to go!
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
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 12:55.


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