Ayuda con set_task
#1
Hola, quiero ponerle un set_task al siguiente code, funciona pero no se como ponerle la condición de explotar el misil una vez que llego a 0 o si antes de que el task llegue a 0 y el jugador ya haya reventado el misil, remover el hud y terminar el conteo.

Parte del set_task
Código PHP:
    else if (Rocket_Mode[id] == 3) {
        
        
entity_set_int(RocketEntEV_INT_rendermode1)
        
attach_view(idRocketEnt)
        
        
User_Control[id] = RocketEnt
        
        Bazooka_Ammo3
[id]--
        
        if(!
task_exists()) 
        {
        
g_iContador 11
        set_task 
(1.0"explotar"___"a"g_iContador 
        }

    }
    
    return 
PLUGIN_HANDLED
    
}

public 
explotar()
{   
    
g_iContador-- 
    
    if(
g_iContador >= 0)
    {
    
set_hudmessage255,255,255, -1.00.3006.012.0 
    
show_hudmessage(0"El misil va a explotar en %d"g_iContador)
    }


Code completo
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>

#define BA_NORMAL         (1<<0) // "a"
#define BA_HEAT             (1<<1) // "b"
#define BA_USER             (1<<2) // "c"
#define BA_NONE             (1<<3) // "d"

#define SEQ_IDLE         0
#define SEQ_FIDGET         1
#define SEQ_RELOAD         2
#define SEQ_FIRE         3
#define SEQ_HOLSTER1         4
#define SEQ_DRAW1         5
#define SEQ_HOLSTER2         6
#define SEQ_DRAW2         7
#define SEQ_IDLE2        8
#define SEQ_FIDGET2        9

new mod_name[33]
new 
g_buyzone[33]
new 
Rocket_Mode[33]
new 
User_Control[33]
new 
Bazooka_Ammo1[33]
new 
Bazooka_Ammo2[33]
new 
Bazooka_Ammo3[33]
new 
Team_Kill_Count[33]
new 
Old_Rocket_Mode[33]

new 
bool:RoundEnd
new bool:is_cstrike

new bool:Has_Bazooka[33]
new 
bool:Allow_Shooting[33]
new 
bool:Bazooka_Active[33]
new 
bool:g_restart_attempt[33]

new 
cvar_bazooka_cost
new cvar_bazooka_ammo1
new cvar_bazooka_ammo2
new cvar_bazooka_ammo3
new cvar_bazooka_buyable
new cvar_bazooka_dropping
new cvar_bazooka_restrict
new cvar_bazooka_velocity
new cvar_bazooka_trailtime
new cvar_bazooka_gib_death
new cvar_bazooka_tkpunish1
new cvar_bazooka_tkpunish2
new cvar_bazooka_max_damage
new cvar_bazooka_trailcolor
new cvar_bazooka_obeyffcvar
new cvar_bazooka_obeybuyzone
new cvar_bazooka_damage_radius
new cvar_bazooka_animation

new iFlags
new RocketSmoke
new mdl_gib_head
new mdl_gib_lung
new mdl_gib_meat
new mdl_gib_flesh
new mdl_gib_spine
new spr_blood_drop
new spr_blood_spray
new mdl_gib_legbone
new g_sModelIndexSmoke
new g_sModelIndexFireball
new gmsgDeathMsggmsgScoreInfo

new bool:E_KeyPress_Delay[33]

static 
PLUGIN_NAME[]    =    "Bazooka_2_Slot3"
static PLUGIN_AUTHOR[]     =    "Can't Shoot"
static PLUGIN_VERSION[]    =    "2.2.1"

public plugin_init () {

    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)

    
/* Register pcvar cvars */
    
cvar_bazooka_cost register_cvar("bazooka_cost","2500",FCVAR_SERVER)
    
cvar_bazooka_ammo1 register_cvar("bazooka_ammo1","3",FCVAR_UNLOGGED)
    
cvar_bazooka_ammo2 register_cvar("bazooka_ammo2","1",FCVAR_UNLOGGED)
    
cvar_bazooka_ammo3 register_cvar("bazooka_ammo3","1",FCVAR_UNLOGGED)
    
cvar_bazooka_buyable register_cvar("bazooka_buyable","1",FCVAR_SERVER)
    
cvar_bazooka_dropping register_cvar("bazooka_dropping","1",FCVAR_SERVER)
    
cvar_bazooka_restrict register_cvar("bazooka_restrict","d",FCVAR_SERVER)
    
cvar_bazooka_velocity register_cvar("bazooka_velocity","1200",FCVAR_UNLOGGED)
    
cvar_bazooka_animation register_cvar("bazooka_animation","1",FCVAR_UNLOGGED)
    
cvar_bazooka_trailtime register_cvar("bazooka_trailtime","10",FCVAR_UNLOGGED)
    
cvar_bazooka_gib_death register_cvar("bazooka_gib_death","1",FCVAR_SERVER)
    
cvar_bazooka_tkpunish1 register_cvar("bazooka_tkpunish1","1",FCVAR_SERVER)
    
cvar_bazooka_tkpunish2 register_cvar("bazooka_tkpunish2","3",FCVAR_SERVER)
    
cvar_bazooka_max_damage register_cvar("bazooka_max_damage","150",FCVAR_UNLOGGED)
    
cvar_bazooka_trailcolor register_cvar("bazooka_trailcolor","1",FCVAR_UNLOGGED)
    
cvar_bazooka_obeyffcvar register_cvar("bazooka_obeyffcvar","1",FCVAR_SERVER)
    
cvar_bazooka_obeybuyzone register_cvar("bazooka_obeybuyzone","1",FCVAR_SERVER)
    
cvar_bazooka_damage_radius register_cvar("bazooka_damage_radius","250",FCVAR_UNLOGGED)

    
register_concmd("bazooka","cmd_Drop_Bazooka",ADMIN_BAN)
    
register_concmd("buybazooka","cmd_BuyBazooka",ADMIN_USER,"- Buys a bazooka")

    
register_clcmd("say /buybazooka","cmd_BuyBazooka",ADMIN_USER,"- Buys a bazooka")
    
register_clcmd("say_team /buybazooka","cmd_BuyBazooka",ADMIN_USER,"- Buys a bazooka")
    
register_clcmd("bazooka_give","cmd_GiveBazooka",ADMIN_BAN,"<@all/ct/t>/userid - Gives free bazooka")
    
register_clcmd("fullupdate","cmd_FullUpDate"
    
    
register_event("CurWeapon","Event_CurWeapon","be","1=1")
    
register_event("DeathMsg","Event_DeathMsg","a")
    
register_event("HLTV","Event_NewRound",    "a","1=0","2=0")
    
register_event("ResetHUD","Event_HudReset","be")
    
register_event("TextMsg","Event_WeaponDrop","be","2=#Weapon_Cannot_Be_Dropped")
    
register_event("TextMsg","Event_RestartAttempt","a","2=#Game_will_restart_in")
    
register_event("StatusIcon","Event_BuyZone","b","2=buyzone")
    
    
register_logevent("LogEvent_RoundStart",2,"1=Round_Start")
    
register_logevent("LogEvent_RoundEnd",2,"1=Round_End")
    
    
register_forward(FM_CmdStart,"fw_CmdStart")
    
register_forward(FM_EmitSound,"fw_EmitSound")

    
gmsgDeathMsg get_user_msgid("DeathMsg")
    
gmsgScoreInfo get_user_msgid("ScoreInfo")

    
get_modname(mod_name,31)
    
is_cstrike equal(mod_name,"cstrike") ? true false

}

public 
plugin_precache ()  {
    
    
precache_model("models/w_rpg.mdl")
    
precache_model("models/v_rpg.mdl")
    
precache_model("models/p_rpg.mdl")
    
precache_model("models/rpgrocket.mdl")
    
    
precache_model("models/v_knife.mdl")
    
precache_model("models/p_knife.mdl")
    
precache_model("models/shield/v_shield_knife.mdl")
    
precache_model("models/shield/p_shield_knife.mdl")
    
    
precache_sound("items/gunpickup4.wav")
    
    
precache_sound("weapons/nuke_fly.wav")
    
precache_sound("weapons/dryfire1.wav")
    
precache_sound("weapons/mortarhit.wav")
    
precache_sound("weapons/rocketfire1.wav")
    
    
precache_sound("ambience/particle_suck2.wav")
    
    
spr_blood_drop precache_model("sprites/blood.spr")
    
spr_blood_spray precache_model("sprites/bloodspray.spr")
    
    
mdl_gib_lung precache_model("models/GIB_Lung.mdl")
    
mdl_gib_meat precache_model("models/GIB_B_Gib.mdl")
    
mdl_gib_head precache_model("models/GIB_Skull.mdl")
    
mdl_gib_flesh precache_model("models/Fleshgibs.mdl")
    
mdl_gib_spine precache_model("models/GIB_B_Bone.mdl")
    
mdl_gib_legbone precache_model("models/GIB_Legbone.mdl")
    
    
g_sModelIndexSmoke  precache_model("sprites/steam1.spr")
    
g_sModelIndexFireball precache_model("sprites/zerogxplode.spr")
    
    
RocketSmoke precache_model("sprites/smoke.spr")
    
}

stock bool:has_shield(id) {
    
    new 
modelName[32]
    
entity_get_string(idEV_SZ_viewmodelmodelName31)

    if(
containi(modelName"v_shield_") != -1) return true
        
    
return false
    
}

public 
Event_BuyZone(id) {
    
    
g_buyzone[id] = read_data(1)
    
}

public 
get_restrict_flags () {
    
    new 
sFlags[24]
    
get_pcvar_string(cvar_bazooka_restrict,sFlags,24)
    
iFlags read_flags(sFlags)
    
}

public 
client_connect (id) {
    
    
Rocket_Mode[id] = 1
    Has_Bazooka
[id] = false
    Allow_Shooting
[id] = false
    Bazooka_Active
[id] = false
    E_KeyPress_Delay
[id] = false
    
}

public  
client_disconnect (id) {
    
    
Rocket_Mode[id] = 1
    Has_Bazooka
[id] = false
    Allow_Shooting
[id] = false
    Bazooka_Active
[id] = false
    E_KeyPress_Delay
[id] = false
    
}

// Freeze Time.
public Event_NewRound () {
    
    new 
iCurrent find_ent_by_class(-1"rpgrocket")
    while ((
iCurrent find_ent_by_class(-1"rpgrocket")) != 0) {
        
        new 
id entity_get_edict(iCurrentEV_ENT_owner)
        
remove_missile(id,iCurrent)
        
    }
    
}

// Player Spawn
public Event_PlayerSpawn  (id) {
    
    
// Reset Bazooka's Ammo
    
Bazooka_Ammo1[id] = get_pcvar_num(cvar_bazooka_ammo1)
    
Bazooka_Ammo2[id] = get_pcvar_num(cvar_bazooka_ammo2)
    
Bazooka_Ammo3[id] = get_pcvar_num(cvar_bazooka_ammo3)

    
// Gibs - Unhide Players
    
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)
    
    
// Removed any rockets in world.
    
new Rocket find_ent_by_class(-1"rpgrocket")
    while (
Rocket 0) {

        
remove_entity(Rocket)
        
Rocket find_ent_by_class(Rocket"rpgrocket")
        
    }
    
    
// Removed any rpglancher in world.
    
new RPG find_ent_by_class(-1"rpglancher")
    while (
RPG 0) {
        
        
remove_entity(RPG)
        
        
RPG find_ent_by_class(RPG"rpglancher")
        
    }
    
    new 
v_oldmodel[64], p_oldmodel[64]
        
    
entity_get_string(idEV_SZ_viewmodelv_oldmodel63)
    
entity_get_string(idEV_SZ_weaponmodelp_oldmodel63)
            
    if (
equal(v_oldmodel"models/v_rpg.mdl") || equal(p_oldmodel"models/p_rpg.mdl")) {
            
        if (!
Has_Bazooka[id]) {
                    
            new 
weaponidclipammo
            weaponid 
get_user_weapon(idclipammo)
            
            new 
weaponname[64]
            
get_weaponname(weaponidweaponname63)
                    
            new 
v_model[64], p_model[64]
            
format(v_model63"%s"weaponname)
            
format(p_model63"%s"weaponname)
                    
            
replace(v_model63"weapon_""v_")
            
format(v_model63"models/%s.mdl"v_model)
            
entity_set_string(idEV_SZ_viewmodelv_model)
            
            
replace(p_model63"weapon_""p_")
            
format(p_model63"models/%s.mdl"p_model)
            
entity_set_string(idEV_SZ_weaponmodelp_model)
                
        }
    }

    return 
PLUGIN_CONTINUE
    
}

// New Round - Freeze Time End.
public LogEvent_RoundStart () {
    
    
RoundEnd false

    
new players[32], num
    get_players
(playersnum"a")
    
    for (new 
inum; ++i)
        if (
Has_Bazooka[players[i]])
            
Allow_Shooting[players[i]] = true
    
    
return PLUGIN_CONTINUE

}

// Round End 
public LogEvent_RoundEnd () {
    
    
RoundEnd true
    
    
new players[32], num
    get_players
(playersnum"a")
    
    for (new 
inum; ++i)
        if (
Has_Bazooka[players[i]])
            
Allow_Shooting[players[i]] = false
        
    
return PLUGIN_CONTINUE

}

public 
cmd_FullUpDate () {
    
    return 
PLUGIN_HANDLED
    
}

public 
Event_RestartAttempt () {
    
    new 
players[32], num
    get_players
(playersnum"a")
    
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
    
}

public 
Event_HudReset (id) {
    
    if (
g_restart_attempt[id]) {
        
        
g_restart_attempt[id] = false
    
        
return
    
    }

    
Event_PlayerSpawn (id)
    
}

public 
rpg_idle (data[]) {
    
    if (
get_pcvar_num(cvar_bazooka_animation) == 1) {
        
        if ((
Bazooka_Ammo1[data[0]] > 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE)
            
        if ((
Bazooka_Ammo2[data[0]] > 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE)
            
        if ((
Bazooka_Ammo3[data[0]] > 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE)

        if ((
Bazooka_Ammo1[data[0]] <= 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)
            
        if ((
Bazooka_Ammo2[data[0]] <= 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)
            
        if ((
Bazooka_Ammo3[data[0]] <= 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)

    }
        
}

public 
rpg_reload_start (data[]) {
    
    if (
get_pcvar_num(cvar_bazooka_animation) == 1) {
        
        if ((
Bazooka_Ammo1[data[0]] > 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_RELOAD)
            
        if ((
Bazooka_Ammo2[data[0]] > 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_RELOAD)
            
        if ((
Bazooka_Ammo3[data[0]] > 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_RELOAD)

        if ((
Bazooka_Ammo1[data[0]] <= 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)

        if ((
Bazooka_Ammo2[data[0]] <= 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)
            
        if ((
Bazooka_Ammo3[data[0]] <= 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_IDLE2)

    }
    
}

public 
rpg_fidget (data[]) {
    
    if (!
RoundEndAllow_Shooting[data[0]] = true 
    
    
if (get_pcvar_num(cvar_bazooka_animation) == 1) {
        
        if ((
Bazooka_Ammo1[data[0]] > 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET)
        
        if ((
Bazooka_Ammo2[data[0]] > 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET)

        if ((
Bazooka_Ammo3[data[0]] > 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET)
            
        if ((
Bazooka_Ammo1[data[0]] <= 0) && (Rocket_Mode[data[0]] == 1))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET2)

        if ((
Bazooka_Ammo2[data[0]] <= 0) && (Rocket_Mode[data[0]] == 2))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET2)
            
        if ((
Bazooka_Ammo3[data[0]] <= 0) && (Rocket_Mode[data[0]] == 3))
            
entity_set_int(data[0], EV_INT_weaponanimSEQ_FIDGET2)

        
set_task(6.0"rpg_idle"data[0]+2023data[0], 1)
    
    }
    
}

public 
fw_EmitSound (idchannelsample[]) {
    
    if(!
is_user_alive(id) || !is_user_connected(id)) 
        return 
FMRES_IGNORED
    
    
if(Bazooka_Active[id]) {
        
        if(
containi(sample"weapons/knife") != -1)
            return 
FMRES_SUPERCEDE
        
    
}
        
    return 
FMRES_IGNORED
    
}

public 
fire_rocket (id) {
    
    new 
data[1]
    
    
data[0] = id
    
    
//Start reload animation.
    
set_task(1.0"rpg_reload_start"id+2021data1)
    
    
//Ends reload animation and enables fireing.
    
set_task(3.1"rpg_fidget"id+2022data1)
    
    new 
Float:StartOrigin[3], Float:Angle[3]
    
    new 
PlayerOrigin[3]
    
    
get_user_origin(idPlayerOrigin1)
    
    
StartOrigin[0] = float(PlayerOrigin[0])
    
StartOrigin[1] = float(PlayerOrigin[1])
    
StartOrigin[2] = float(PlayerOrigin[2])
    
    
entity_get_vector(idEV_VEC_v_angleAngle)
    
    
Angle[0] = Angle[0] * -1.0
    
    
new RocketEnt create_entity("info_target")
    
    
entity_set_string(RocketEntEV_SZ_classname"rpgrocket")
    
entity_set_model(RocketEnt"models/rpgrocket.mdl")
    
entity_set_origin(RocketEntStartOrigin)
    
entity_set_vector(RocketEntEV_VEC_anglesAngle)
    
    new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
    new 
Float:MaxBox[3] = {1.01.01.0}
    
    
entity_set_vector(RocketEntEV_VEC_minsMinBox)
    
entity_set_vector(RocketEntEV_VEC_maxsMaxBox)
    
    
entity_set_int(RocketEntEV_INT_solid2)
    
entity_set_int(RocketEntEV_INT_movetype5)
    
entity_set_edict(RocketEntEV_ENT_ownerid)
    
    new 
Float:Velocity[3]
    new 
myvelocity get_pcvar_num(cvar_bazooka_velocity)
    
    
VelocityByAim(idmyvelocityVelocity)
    
entity_set_vector(RocketEntEV_VEC_velocityVelocity)
    
    new 
CsTeams:iTeam cs_get_user_team(id)
    new 
TrailTime get_pcvar_num(cvar_bazooka_trailtime )
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW)
    
write_short(RocketEnt)
    
write_short(RocketSmoke)
    
write_byte(TrailTime)
    
write_byte(5)
    
    if (
get_pcvar_num(cvar_bazooka_trailcolor) == 0) {
        
        
// Color = White
        
write_byte(254)
        
write_byte(254)
        
write_byte(254)
        
write_byte(255)
        
    }
    
    else if (
get_pcvar_num(cvar_bazooka_trailcolor) == 1) {
        
        switch(
iTeam) {
            
            
// if team T Color = Red
            
case CS_TEAM_T: {
                
                
write_byte(255)
                
write_byte(0)
                
write_byte(0)
                
write_byte(255)
                
            }
            
            
// if team CT Color = Blue
            
case CS_TEAM_CT: {
                
                
write_byte(0)
                
write_byte(0)
                
write_byte(255)
                
write_byte(255)
                
            }
        }
    }
    
    else {
        
        
// random colors
        
write_byte(random_num(0,255))
        
write_byte(random_num(0,255))
        
write_byte(random_num(0,255))
        
write_byte(255)
        
    }
    
    
message_end()
    
    
emit_sound(RocketEntCHAN_WEAPON"weapons/rocketfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(RocketEntCHAN_VOICE"weapons/nuke_fly.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
    if (
Rocket_Mode[id] == 1Bazooka_Ammo1[id]--
    
    if (
Rocket_Mode[id] == 2) {
        
        new 
info[1]
        
info[0] = RocketEnt
        set_task
(0.5"find_and_follow"0info1)
        
        
Bazooka_Ammo2[id]--
        
    }
    
    else if (
Rocket_Mode[id] == 3) {
        
        
entity_set_int(RocketEntEV_INT_rendermode1)
        
attach_view(idRocketEnt)
        
        
User_Control[id] = RocketEnt
        
        Bazooka_Ammo3
[id]--
        
        if(!
task_exists()) 
        {
        
g_iContador 11
        set_task 
(1.0"explotar"___"a"g_iContador 
        }

    }
    
    return 
PLUGIN_HANDLED
    
}

public 
explotar()
{   
    
g_iContador-- 
    
    if(
g_iContador >= 0)
    {
    
set_hudmessage255,255,255, -1.00.3006.012.0 
    
show_hudmessage(0"El misil va a explotar en %d"g_iContador)
    }


public 
find_and_follow (info[]) {
    
    new 
RocketEnt info[0]
    new 
Float:shortestDist 10000.0
    
new nearestPlayer 0
    
    
if (is_valid_ent(RocketEnt)) {
        
        new 
players[32], count
        
        get_players
(playerscount)
        
        for (new 
0counti++) {
            
            if (
is_user_alive(players[i]) 
            && (
entity_get_edict(RocketEntEV_ENT_owner) != players[i]) 
            && (
get_user_team(players[i]) != get_user_team(entity_get_edict(RocketEntEV_ENT_owner)))) {
                
                new 
Float:PlayerOrigin[3], Float:RocketOrigin[3]
                
                
entity_get_vector(players[i], EV_VEC_originPlayerOrigin)
                
entity_get_vector(RocketEntEV_VEC_originRocketOrigin)
                
                new 
Float:Distance vector_distance(PlayerOriginRocketOrigin)
                
                if (
Distance <= shortestDist) {
                    
                    
shortestDist Distance
                    nearestPlayer 
players[i]
                    
                }
                
            }
            
        }
        
    }
    
    if (
nearestPlayer 0) {
        
        new 
data[2]
        
        
data[0] = RocketEnt
        data
[1] = nearestPlayer
        
        set_task
(0.1"follow_and_catch"RocketEntdata2"b")
        
    }
    
    else {
        
        
pfn_touch(RocketEnt0)
        
    }
}

public 
follow_and_catch (data[]) {
    
    new 
RocketEnt data[0]
    new 
target data[1]
    new 
myvelocity get_pcvar_num(cvar_bazooka_velocity)
    
    if (
is_user_alive(target) && is_valid_ent(RocketEnt)) {
        
        
entity_set_follow(RocketEnttarget, (myvelocity 0.0))
        
        new 
Float:Velocity[3]
        new 
Float:NewAngle[3]
        
        
entity_get_vector(RocketEntEV_VEC_velocityVelocity)
        
vector_to_angle(VelocityNewAngle)
        
entity_set_vector(RocketEntEV_VEC_anglesNewAngle)
        
    }
    
    else {
        
        if (
task_exists(RocketEnt))
            
remove_task(RocketEnt)
        
        new 
info[1]
        
        
info[0] = RocketEnt
        
        set_task
(0.1"find_and_follow"0data1)
        
    }
    
}

public 
entity_set_follow (entitytargetFloat:speed) {
    
    if (!
is_valid_ent(entity) || !is_valid_ent(target)) return
    
    new 
Float:entity_origin[3], Float:target_origin[3]
    
entity_get_vector(entityEV_VEC_originentity_origin)
    
entity_get_vector(targetEV_VEC_origintarget_origin)
    
    new 
Float:diff[3]
    
diff[0] = target_origin[0] - entity_origin[0]
    
diff[1] = target_origin[1] - entity_origin[1]
    
diff[2] = target_origin[2] - entity_origin[2]
    
    new 
Float:length floatsqroot(floatpower(diff[0], 2.0) + floatpower(diff[1], 2.0) + floatpower(diff[2], 2.0))
    
    new 
Float:Velocity[3]
    
Velocity[0] = diff[0] * (speed length)
    
Velocity[1] = diff[1] * (speed length)
    
Velocity[2] = diff[2] * (speed length)
    
    
entity_set_vector(entityEV_VEC_velocityVelocity)
    
    return
    
}

public 
remove_missile (id,missile) {
    
    new 
Float:fl_origin[3]
    
    
entity_get_vector(missileEV_VEC_originfl_origin)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_IMPLOSION)
    
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)
    
    
User_Control[id] = 0
    
    attach_view
(id,id)
    
remove_entity(missile)
    
    return 
PLUGIN_CONTINUE
    
}

public 
pfn_touch (touchertouched) {
    
    new 
ClassName1[32]
    new 
ClassName2[32]

    if(!
is_valid_ent(toucher))
        return 
PLUGIN_CONTINUE

    
if (is_valid_ent(toucher))
        
entity_get_string(toucherEV_SZ_classnameClassName131)
    
    if (
is_valid_ent(touched))
        
entity_get_string(touchedEV_SZ_classnameClassName231)
    
    if (
equal(ClassName1"rpgrocket")) {

        new 
vExplodeAt[3]
        new 
Float:fl_vExplodeAt[3]
        
entity_get_vector(toucherEV_VEC_originfl_vExplodeAt)

        
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
        
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
        
vExplodeAt[2] = floatround(fl_vExplodeAt[2])

        
emit_sound(toucherCHAN_WEAPON"weapons/mortarhit.wav"1.00.50PITCH_NORM)
         
emit_sound(toucherCHAN_VOICE"weapons/mortarhit.wav"1.00.50PITCH_NORM)

        for (new 
Explosion 1Explosion 8Explosion++) {
            
            
// Random Explosion 8 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SPRITE)
            
write_coord(vExplodeAt[0] + random_num(-60,60))
            
write_coord(vExplodeAt[1] + random_num(-60,60))
            
write_coord(vExplodeAt[2] +128)
            
write_short(g_sModelIndexFireball)
            
write_byte(random_num(30,65))
            
write_byte(255)
            
message_end()
            
        }

        for (new 
Smoke 1Smoke 3Smoke++) {
            
            
// Random Smoke 3 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SMOKE)
            
write_coord(vExplodeAt[0])
            
write_coord(vExplodeAt[1])
            
write_coord(vExplodeAt[2] + 256)
            
write_short(g_sModelIndexSmoke)
            
write_byte(random_num(80,150))
            
write_byte(random_num(5,10))
            
message_end()
        }
        
        
// Create the burn decal
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GUNSHOTDECAL)
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(0)            
        
        if (
is_cstrikewrite_byte(random_num(46,48))  // decal
        
if (!is_cstrikewrite_byte(random_num(58,60)) // decal

        
message_end()

        new 
Max_Damage get_pcvar_num(cvar_bazooka_max_damage)
        new 
Damage_Radius get_pcvar_num(cvar_bazooka_damage_radius )
        
        new 
PlayerPos[3], DistanceDamage
        
        
for (new 132i++) {
            
            if (
is_user_alive(i) == 1) {
                
                new 
team_kill 0
                get_user_origin
(iPlayerPos)

                
Distance get_distance(PlayerPosvExplodeAt)
                
                if (
Distance <= Damage_Radius) {  // Screenshake Radius
                    
                    
message_begin(MSG_ONEget_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
message_end()
                    
                    new 
attacker entity_get_edict(toucherEV_ENT_owner)

                    
Damage Max_Damage floatround(floatmul(float(Max_Damage), floatdiv(float(Distance), float(Damage_Radius))))
                    
                    if (!
get_user_godmode(i)) {

                        if(
cvar_exists("mp_friendlyfire")) {

                            if( 
get_cvar_num("mp_friendlyfire") && get_pcvar_num(cvar_bazooka_obeyffcvar)) {

                                if(
get_user_team(i) == get_user_team(attacker))
                                    
team_kill 1

                                do_victim
(i,attacker,Damage,team_kill)

                            }

                            else {

                                if(
get_user_team(i) != get_user_team(attacker))
                                    
do_victim(i,attacker,Damage,team_kill)
                            
                            }
                            
                        }

                        else {
                            
                            
do_victim(i,attacker,Damage,team_kill)
                        
                        }
                        

                    }

                    else {
                        
                        
do_victim(i,attacker,Damage,team_kill)
                    
                    }
                    
                }
                
            }
            
        }
        
        new 
owner entity_get_edict(toucherEV_ENT_owner)
              
attach_view(ownerowner)
              
User_Control[owner] = 0
        remove_entity
(toucher)
        
        
//*******************************************************************
        // force_use all func_breakable entites within 1/4 of Damage radius *
        //*******************************************************************
        
static Entity_List[21]
        
        new 
entites_in_radius
        entites_in_radius 
find_sphere_class(0"func_breakable",Damage_Radius 0.20,Entity_List,20,fl_vExplodeAt)
        
        for(new 
i=0;entites_in_radiusi++) {
            
            
force_use(Entity_List[i],Entity_List[i])
            
remove_task(Entity_List[i])
            
        }
        
    }
    
    if (
equal(ClassName1"rpglancher")) {

        if(
Has_Bazooka[touched])
            return 
PLUGIN_CONTINUE
    
        
if(has_shield(touched))
            return 
PLUGIN_CONTINUE
        
        
new Picker[32]

        if (
is_valid_ent(touched))
            
entity_get_string(touchedEV_SZ_classnamePicker31)

        if (
equal(Picker"player")) {

            
give_item(touched"weapon_knife")
            
            
Allow_Shooting[touched] = true
            Has_Bazooka
[touched] = true
            
            Bazooka_Ammo1
[touched] = entity_get_int(toucherEV_INT_iuser1)
            
Bazooka_Ammo2[touched] = entity_get_int(toucherEV_INT_iuser2)
            
Bazooka_Ammo3[touched] = entity_get_int(toucherEV_INT_iuser3)
            
            
client_print(touchedprint_chat"[Bazooka] You have picked up a bazooka!")
            
emit_sound(touchedCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
            
            
remove_entity(toucher)

            new 
temp[2], weaponID get_user_weapon(touchedtemp[0], temp[1])
            
            if(
weaponID == CSW_KNIFE) {

                
Bazooka_Active[touched] = true
                Event_CurWeapon
(touched)    

                if (
Bazooka_Ammo1[touched] > 0entity_set_int(touchedEV_INT_weaponanimSEQ_RELOAD)
                if (
Bazooka_Ammo1[touched] <= 0entity_set_int(touchedEV_INT_weaponanimSEQ_IDLE2)

            }
            
        }
        
        
    }
    
    return 
PLUGIN_CONTINUE

}

public 
do_victim (victim,attacker,Damage,team_kill) {

    new 
namek[32],namev[32],authida[35],authidv[35],teama[32],teamv[32]

    
get_user_name(victim,namev,31)
    
get_user_name(attacker,namek,31)
    
get_user_authid(victim,authidv,34)
    
get_user_authid(attacker,authida,34)
    
get_user_team(victim,teamv,31)
    
get_user_team(attacker,teama,31)

    if(
Damage >= get_user_health(victim)) {

        if(
get_cvar_num("mp_logdetail") == 3) {
            
            
log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"missile^" (hit ^"chest^") (Damage ^"%d^") (health ^"0^")",
            
namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv,Damage)
        
        }

        
client_print(attacker,print_chat,"[AMXX] You killed %s with that missile",namev)
        
client_print(victim,print_chat,"[AMXX] You were killed by %s's missile",namek)

        if(
team_kill == 0) {
            
            
set_user_frags(attacker,get_user_frags(attacker) + )
        
        }
        
        else {
            
            
Team_Kill_Count[attacker] += 1
            client_print
(attacker,print_center,"You killed a teammate")
            
set_user_frags(attacker,get_user_frags(attacker) - )
        
        }

        
set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
        
set_msg_block(gmsgScoreInfo,BLOCK_ONCE)

        
user_kill(victim,1)

        
replace_dm(attacker,victim,0)

        
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"missile^"",
        
namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv)

        if (
Damage 100 && get_pcvar_num(cvar_bazooka_gib_death) == 1) {
                                    
            new 
iOrigin[3]
            
get_user_origin(victim,iOrigin)
            
set_user_rendering(victim,kRenderFxNone,0,0,0,kRenderTransAlpha,0)
            
fx_gib_explode(iOrigin,3)
            
fx_blood_large(iOrigin,5)
            
fx_blood_small(iOrigin,15)
            
iOrigin[2] = iOrigin[2] - 20
            set_user_origin
(victim,iOrigin)

        }
        
    }

    else {
        
        
set_user_health(victim,get_user_health(victim) - Damage )

        if(
get_cvar_num("mp_logdetail") == 3) {
            
            
log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"missile^" (hit ^"chest^") (Damage ^"%d^") (health ^"%d^")",
            
namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv,Damage,get_user_health(victim))
        
        }

        
client_print(attacker,print_chat,"[AMXX] You hurt %s with that missile",namev)
        
client_print(victim,print_chat,"[AMXX] You were hurt by %s's missile",namek)

    }

    if (
team_kill) {

        new 
players[32],pNum
        
        get_players
(players,pNum,"e",teama)

        for(new 
i=0;i<pNum;i++) {
        
            
client_print(players[i],print_chat,"%s attacked a teammate",namek)

            new 
punish1 get_pcvar_num(cvar_bazooka_tkpunish1)
            new 
punish2 get_pcvar_num(cvar_bazooka_tkpunish2)

            if (!(
get_user_flags(attacker)&ADMIN_IMMUNITY)) {
                
                if (
punish1 2) {

                    
user_kill(attacker,0)
                    
set_hudmessage(255,50,50, -1.00.4500.0210.01.011.14)
                    
show_hudmessage(attacker,"YOU WERE KILLED FOR ATTACKING TEAMMATES.^nSEE THAT IT HAPPENS NO MORE!")
                
                }

                if((
punish1) && (Team_Kill_Count[attacker] >= punish2 )) {

                    if(
punish1 == || punish1 == 3) {
                        
                        
client_cmd(attacker,"echo You were kicked for team killing;disconnect")
                    }
                    
                    else if(
punish1 == || punish1 == 4) {

                        
client_cmd(attacker,"echo You were banned for team killing")

                        if (
equal("4294967295",authida)) {

                            new 
ipa[32]
                            
get_user_ip(attacker,ipa,31,1)
                            
server_cmd("addip 180.0 %s;writeip",ipa)
                        
                        }

                        else {
                            
                            
server_cmd("banid 180.0 %s kick;writeid",authida)
                        
                        }
                        
                    }
                    
                }
                
            }
            
        }
        
    }
    
}

public 
replace_dm (id,tid,tbody) {

    
//Update killers scorboard with new info
    
message_begin(MSG_ALL,gmsgScoreInfo)
    
write_byte(id)
    
write_short(get_user_frags(id))
    
write_short(get_user_deaths(id))
    
write_short(0)
    
write_short(get_user_team(id))
    
message_end()

    
//Update victims scoreboard with correct info
    
message_begin(MSG_ALL,gmsgScoreInfo)
    
write_byte(tid)
    
write_short(get_user_frags(tid))
    
write_short(get_user_deaths(tid))
    
write_short(0)
    
write_short(get_user_team(tid))
    
message_end()

    
//Headshot Kill
    
if (tbody == 1) {

        
message_beginMSG_ALLgmsgDeathMsg,{0,0,0},0)
        
write_byte(id)
        
write_byte(tid)
        
write_string(" missile")
        
message_end()
        
    }

    
//Normal Kill
    
else {
        
        
message_beginMSG_ALLgmsgDeathMsg,{0,0,0},0)
        
write_byte(id)
        
write_byte(tid)
        
write_byte(0)
        
write_string("missile")
        
message_end()
        
    }

    return 
PLUGIN_CONTINUE
    
}

public 
cmd_Drop_Bazooka (idlevelcid) {
    
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED
    
    drop_lancher
(id,0)
    
    return 
PLUGIN_HANDLED
    
}

public 
drop_rpglancher (id) {

    
drop_lancher(id,1)
    
    
Bazooka_Ammo1[id] = 0
    Bazooka_Ammo2
[id] = 0
    Bazooka_Ammo3
[id] = 0
    Has_Bazooka
[id] = false
    Bazooka_Active
[id] = false
    
    Event_CurWeapon
(id)
    
    return 
PLUGIN_HANDLED
    
}

public 
drop_lancher (idsel) {

    new 
Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3], Float:Angles[3]

    if (
sel == 0VelocityByAim(id64TraceDirection)
    if (
sel == 1VelocityByAim(id200TraceDirection)
    
    
entity_get_vector(idEV_VEC_originPlayerOrigin)

    if (
sel == 1entity_get_vector(idEV_VEC_anglesAngles)

    
End[0] = TraceDirection[0] + PlayerOrigin[0]
    
End[1] = TraceDirection[1] + PlayerOrigin[1]
    
End[2] = TraceDirection[2] + PlayerOrigin[2]
    
    
trace_line(idPlayerOriginEnd, Return)

    Return[
2] = PlayerOrigin[2]
    
    new 
RPG create_entity("info_target")
    
    
entity_set_string(RPGEV_SZ_classname"rpglancher")
    
entity_set_model(RPG"models/w_rpg.mdl")
    
entity_set_origin(RPG, Return)
    
    if (
sel == 1) {
        
        
Angles[0] = 0.0
        Angles
[2] = 0.0
        
    
}
    
    if ( 
sel == 0entity_set_vector(RPGEV_VEC_anglesAngles)
    
    new 
Float:MinBox[3] = {-16.0, -16.00.0}
    new 
Float:MaxBox[3] = {16.016.016.0}

    
entity_set_vector(RPGEV_VEC_minsMinBox)
    
entity_set_vector(RPGEV_VEC_maxsMaxBox)
    
    
entity_set_int(RPGEV_INT_solid1)
    
entity_set_int(RPGEV_INT_movetype6)

    if (
sel == 0entity_set_int(RPGEV_INT_iuser1get_pcvar_num(cvar_bazooka_ammo1))
    if (
sel == 0entity_set_int(RPGEV_INT_iuser2get_pcvar_num(cvar_bazooka_ammo2))
    if (
sel == 0entity_set_int(RPGEV_INT_iuser3get_pcvar_num(cvar_bazooka_ammo3))
    
    if (
sel == 1entity_set_int(RPGEV_INT_iuser1Bazooka_Ammo1[id])
    if (
sel == 1entity_set_int(RPGEV_INT_iuser2Bazooka_Ammo2[id])
    if (
sel == 1entity_set_int(RPGEV_INT_iuser3Bazooka_Ammo3[id])

    return 
PLUGIN_HANDLED
    
}

public 
delay (data2[]) {
    
    
E_KeyPress_Delay[data2[0]] = false
    
}

public 
fw_CmdStart (iduc_handleseed) {
        
    if(!
is_user_connected(id)) return FMRES_IGNORED
    
if(!is_user_alive(id)) return FMRES_IGNORED
    
if(!Has_Bazooka[id]) return FMRES_IGNORED
    
    
if(has_shield(id)) {
        
        
drop_rpglancher(id)
        return 
FMRES_IGNORED
        
    
}

    if (
Bazooka_Active[id]) ammo_hud(id1)
    if (!
Bazooka_Active[id]) ammo_hud(id0)
    
    new 
weaponidclipammo
    weaponid 
get_user_weapon(idclipammo)
    
    if (
weaponid == CSW_KNIFE) {
        
        new 
buttons get_uc(uc_handleUC_Buttons)
        new 
inuse get_user_button(id) & IN_USE
        
new attack get_user_button(id) & IN_ATTACK
        
new attack2 get_user_button(id) & IN_ATTACK2
        
new oldinuse get_user_oldbutton(id) & IN_USE
        
new oldattack get_user_oldbutton(id) & IN_ATTACK
        
new oldattack2 get_user_oldbutton(id) & IN_ATTACK2
        
        
if((inuse) && (oldinuse) && (!E_KeyPress_Delay[id]))
            return 
FMRES_IGNORED

        
if(buttons IN_USE)
            
buttons &= ~IN_USE
        
        
if((buttons IN_ATTACK) && Bazooka_Active[id])
            
buttons &= ~IN_ATTACK

        
if((buttons IN_ATTACK2) && Bazooka_Active[id])
            
buttons &= ~IN_ATTACK2

        set_uc
(uc_handleUC_Buttonsbuttons)
        
        if((
inuse) && !(oldinuse)) {
            
            new 
data2[1]
    
            
data2[0] = id
            
            E_KeyPress_Delay
[id] = true
            
            set_task
(0.2,"delay"id+2023data21)
                        
            if (
Bazooka_Active[id])
                
Bazooka_Active[id] = false
            
            
else 
                
Bazooka_Active[id] = true
            
            Event_CurWeapon
(id)
            
        }
        
        else if (
attack && !oldattack && Bazooka_Active[id]) {
            
            if (
Rocket_Mode[id] == && Bazooka_Ammo1[id] <= 0) {
                            
                
emit_sound(idCHAN_WEAPON"weapons/dryfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                
                return 
FMRES_SUPERCEDE
                
            
}
            
            if (
Rocket_Mode[id] == && Bazooka_Ammo2[id] <= 0) {
                            
                
emit_sound(idCHAN_WEAPON"weapons/dryfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                
                return 
FMRES_SUPERCEDE
                
            
}
            
            if (
Rocket_Mode[id] == && Bazooka_Ammo3[id] <= 0) {
                            
                
emit_sound(idCHAN_WEAPON"weapons/dryfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                
                return 
FMRES_SUPERCEDE
                
            
}

            if (
Allow_Shooting[id] && (User_Control[id] == 0)) {
                
                
remove_task (id+2023
                
                
Allow_Shooting[id] = false
                
                entity_set_int
(idEV_INT_weaponanimSEQ_FIRE)

                
fire_rocket(id)
                
            }
            
        }
        
        else if (
attack2 && !oldattack2 && Bazooka_Active[id]) {
            
            
get_restrict_flags()
            
            
Old_Rocket_Mode[id] = Rocket_Mode[id]
            
            if ((
Rocket_Mode[id] == 1) && (iFlags&BA_HEAT) != BA_HEATRocket_Mode[id] = 2
            
            
else if ((Rocket_Mode[id] == 1) && (iFlags&BA_USER) != BA_USERRocket_Mode[id] = 3
            
else if ((Rocket_Mode[id] == 2) && (iFlags&BA_USER) != BA_USERRocket_Mode[id] = 3
            
else if ((Rocket_Mode[id] == 2) && (iFlags&BA_NORMAL) != BA_NORMALRocket_Mode[id] = 1
            
else if ((Rocket_Mode[id] == 3) && (iFlags&BA_NORMAL) != BA_NORMALRocket_Mode[id] = 1
            
else if ((Rocket_Mode[id] == 3) && (iFlags&BA_HEAT) != BA_HEATRocket_Mode[id] = 2
            
            
if(Old_Rocket_Mode[id] == Rocket_Mode[id]) {
            
                
client_print(idprint_center"The other modes are restricted")
                return 
FMRES_SUPERCEDE
            
            
}
            
            if (
Rocket_Mode[id] == 1client_print(idprint_center"Switched to Normal Mode.")
            if (
Rocket_Mode[id] == 2client_print(idprint_center"Switched to Heat-Seeking Mode.")
            if (
Rocket_Mode[id] == 3client_print(idprint_center"Switched to User-Guided Mode.")
            
            
//emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
            
            
Event_CurWeapon(id)
        
        }
        
    }
    
    if (
User_Control[id] > 0) {
        
        new 
RocketEnt User_Control[id]
        
        if (
is_valid_ent(RocketEnt)) {
            
            new 
Float:Velocity[3]
            new 
Float:NewAngle[3]
            
            
VelocityByAim(id500Velocity)
            
            
entity_set_vector(RocketEntEV_VEC_velocityVelocity)
            
            
entity_get_vector(idEV_VEC_v_angleNewAngle)
            
entity_set_vector(RocketEntEV_VEC_anglesNewAngle)
            
        }
        
        else {
            
            
attach_view(idid)
            
        }
        
    }
    
    return 
FMRES_HANDLED
    
}

public 
cmd_BuyBazooka (id) {
    
    if (
get_pcvar_num(cvar_bazooka_buyable) == 0)
        return 
PLUGIN_CONTINUE

    
new iMoney cs_get_user_money(id)
    new 
iCost get_pcvar_num(cvar_bazooka_cost)
    
    if(!
is_user_alive(id)) 
        
client_print(idprint_center"You cant buy when your dead!")
        
    else if(
Has_Bazooka[id])
        
client_print(idprint_center"You already own that weapon.")
        
    else if(
has_shield(id))
        
client_print(idprint_center"You cant buy bazooka when you have shield.")

    else if(
iMoney iCost)
        
client_print(idprint_center"Insufficient funds! ($%d)"iCost)
        
    else if(
get_pcvar_num(cvar_bazooka_obeybuyzone) == && !g_buyzone[id])
        
client_print(idprint_center"You need to be in the buyzone")

    else {
    
        
give_item(id"weapon_knife")
        
        
Has_Bazooka[id] = true
        Allow_Shooting
[id] = true
        
        Bazooka_Ammo1
[id] = get_pcvar_num(cvar_bazooka_ammo1)
        
Bazooka_Ammo2[id] = get_pcvar_num(cvar_bazooka_ammo2)
        
Bazooka_Ammo3[id] = get_pcvar_num(cvar_bazooka_ammo3)

        
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(cvar_bazooka_cost))
        
client_print(idprint_chat"[Bazooka] You have successfully bought a bazooka!")
        
client_print(idprint_chat"[Bazooka] What are you going to do now!?")
        
        new 
temp[2], weaponID get_user_weapon(idtemp[0], temp[1])
            
        if(
weaponID == CSW_KNIFE) {
                
            
Bazooka_Active[id] = true
            Event_CurWeapon
(id)    
            
entity_set_int(idEV_INT_weaponanimSEQ_FIDGET)
                
        }
        
        else {
            
            
Bazooka_Active[id] = true
            client_cmd
(id"weapon_knife")
            
        }
        
        
emit_sound(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
    }

    return 
PLUGIN_HANDLED

}

public 
cmd_GiveBazooka (idlevelcid) {
    
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
new Arg1[64], target
    read_argv
(1Arg163)
    
    new 
adminName[32]
    
get_user_name(idadminName31)
    
    new 
targetTeam
    
new Players[32], iNum
    
    
if(Arg1[0] == '@') {
        
        if(
equali(Arg1[1], "all")) {
            
            
targetTeam 0
            get_players
(PlayersiNum"a")
            
        } 
        
        else if(
equali(Arg1[1], "t")) {
            
            
targetTeam 1
            get_players
(PlayersiNum"ae" "terrorist")
            
        } 
        
        else if(
equali(Arg1[1], "ct")) {
            
            
targetTeam 2
            get_players
(PlayersiNum"ae" "ct")
            
        }
        
        for(new 
0iNum; ++i) {
            
            
target Players[i]
            
            
give_item(target"weapon_knife")
            
            
Has_Bazooka[target] = true
            Allow_Shooting
[target] = true
            
            Bazooka_Ammo1
[target] = get_pcvar_num(cvar_bazooka_ammo1)
            
Bazooka_Ammo2[target] = get_pcvar_num(cvar_bazooka_ammo2)
            
Bazooka_Ammo3[target] = get_pcvar_num(cvar_bazooka_ammo3)
            
            new 
temp[2], weaponID get_user_weapon(targettemp[0], temp[1])
            
            if(
weaponID == CSW_KNIFE) {
                
                
Bazooka_Active[target] = true
                Event_CurWeapon
(target)    
                
entity_set_int(targetEV_INT_weaponanimSEQ_FIDGET)
                
            }
            
            else {
            
                
Bazooka_Active[target] = true
                client_cmd
(target"weapon_knife")
            
            }
            
            
emit_sound(targetCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
            
            
client_print(targetprint_chat"You have been given a bazooka")
            
        }
        
        switch(
targetTeam) {
            
            case 
0client_print(0print_chat"Admin: %s has given everyone a bazooka"adminName)
            case 
1client_print(0print_chat"Admin: %s has given all terrorist a bazooka"adminName)
            case 
2client_print(0print_chat"Admin: %s has given all ct's a bazooka"adminName)
        
        }
        
    }
    
    else {
        
        
target cmd_target(idArg10)
        
        if(!
is_user_connected(target) || !is_user_alive(target))
            return 
PLUGIN_HANDLED
        
        
new targetName[32]
        
get_user_name(targettargetName31)
        
        
give_item(target"weapon_knife")
        
        
Has_Bazooka[target] = true
        Allow_Shooting
[target] = true
            
        Bazooka_Ammo1
[target] = get_pcvar_num(cvar_bazooka_ammo1)
        
Bazooka_Ammo2[target] = get_pcvar_num(cvar_bazooka_ammo2)
        
Bazooka_Ammo3[target] = get_pcvar_num(cvar_bazooka_ammo3)
            
        new 
temp[2], weaponID get_user_weapon(targettemp[0], temp[1])
            
        if(
weaponID == CSW_KNIFE) {
                
            
Bazooka_Active[target] = true
            Event_CurWeapon
(target)    
            
entity_set_int(targetEV_INT_weaponanimSEQ_FIDGET)
                
        }
            
        else {
            
            
Bazooka_Active[target] = true
            client_cmd
(target"weapon_knife")
            
        }
            
        
emit_sound(targetCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
        
client_print(targetprint_chat"You have been given a bazooka.")
        
client_print(targetprint_chat"Admin: %s has given you a bazooka"adminName)
    
    }
    
    return 
PLUGIN_HANDLED
    
}

public 
Event_CurWeapon (id) {
    
    if(!
is_user_alive(id)) 
        return 
PLUGIN_CONTINUE
    
    
new weaponidclipammo
    
    weaponid 
get_user_weapon(idclipammo)
    
    if ((
weaponid == CSW_KNIFE) && (Bazooka_Active[id])) {
        
        
entity_set_string(idEV_SZ_viewmodel"models/v_rpg.mdl")
        
entity_set_string(idEV_SZ_weaponmodel"models/p_rpg.mdl")
        
entity_set_int(idEV_INT_weaponanimSEQ_FIDGET)
        
emit_sound(idCHAN_ITEM"common/wpn_select.wav"VOL_NORMATTN_NORM0PITCH_NORM)    

        return 
PLUGIN_HANDLED
        
    
}
        
    if ((
weaponid == CSW_KNIFE) && (!Bazooka_Active[id])) {
        
        if(
has_shield(id)) {
            
            
entity_set_string(idEV_SZ_viewmodel"models/shield/v_shield_knife.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/shield/p_shield_knife.mdl")

        }
        
        else {
            
            
entity_set_string(idEV_SZ_viewmodel"models/v_knife.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/p_knife.mdl")

        }
        
        
emit_sound(idCHAN_ITEM"weapons/knife_deploy1.wav"VOL_NORMATTN_NORM0PITCH_NORM)    
        
entity_set_int(idEV_INT_weaponanimSEQ_FIRE)
        
        
ammo_hud(id0)
        
        return 
PLUGIN_HANDLED
    
    
}
    
    if(
Has_Bazooka[id] && Bazooka_Active[id])
        
Bazooka_Active[id] = false
        
    
return PLUGIN_CONTINUE
    
}

public 
ammo_hud (idshow) {
    
    new 
AmmoHud[65], Mode_Text[20], Ammo
    
    
if (Rocket_Mode[id] == 1) {
        
        
Ammo Bazooka_Ammo1[id]
        
Mode_Text "Normal"
        
    
}
    
    if (
Rocket_Mode[id] == 2) {
        
        
Ammo Bazooka_Ammo2[id]
        
Mode_Text "Heat-Seeking"
        
    
}
    
    if (
Rocket_Mode[id] == 3) {
        
        
Ammo Bazooka_Ammo3[id]
        
Mode_Text "User-Guided"
        
    
}

    
format(AmmoHud64"Rockets: %i | Mode: %s"AmmoMode_Text)
    
    if (
show) {
        
        
message_begin(MSG_ONEget_user_msgid("StatusText"), {0,0,0}, id)
        
write_byte(0)
        
write_string(AmmoHud)
        
message_end()
        
    }
    
    else {
        
        
message_begin(MSG_ONEget_user_msgid("StatusText"), {0,0,0}, id)
        
write_byte(0)
        
write_string("")
        
message_end()
        
    }
    
}

public 
Event_DeathMsg () {
    
    new 
id read_data(2)
    
    if(!
is_user_connected(id) || !Has_Bazooka[id])
        return 
PLUGIN_CONTINUE

    drop_rpglancher
(id)
    
    return 
PLUGIN_CONTINUE

}

public 
Event_WeaponDrop (id) {
    
    if(!
is_user_alive(id) || !Has_Bazooka[id] || !Bazooka_Active[id])
        return 
PLUGIN_CONTINUE

    
new weaponidclipammo
    weaponid 
get_user_weapon(idclipammo)
    
    if (
weaponid == CSW_KNIFE) {
            
        if (
get_pcvar_num(cvar_bazooka_dropping) == 1) {
            
            
client_print(idprint_center"")
            
drop_rpglancher(id)
            
        }
            
        else {
            
            
client_print(idprint_center"This weapon cannot be dropped")

        }
        
    }
    
    return 
PLUGIN_HANDLED

}

/************************************************************
* GIB FUNCTIONS (made by mike_cao)
************************************************************/

static fx_blood_small (origin[3],num) {
    
    
// Small splash
    
for (new blood_small 0blood_smallnumblood_small++) {
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
write_coord(origin[0]+random_num(-100,100))
        
write_coord(origin[1]+random_num(-100,100))
        
write_coord(origin[2]-36)
        
        if (
is_cstrikewrite_byte(random_num(190,197)) // Blood decals
        
if (!is_cstrikewrite_byte(random_num(202,209)) // Blood decals

        
message_end()
        
    }
    
}

static 
fx_blood_large (origin[3],num) {
    
    
// Large splash
    
for (new blood_large 0blood_large numblood_large++) {
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
write_coord(origin[0] + random_num(-50,50))
        
write_coord(origin[1] + random_num(-50,50))
        
write_coord(origin[2]-36)

        if (
is_cstrikewrite_byte(random_num(204,205)) // Blood decals
        
if (!is_cstrikewrite_byte(random_num(216,217)) // Blood decals
        
        
message_end()
        
    }
    
}

static 
fx_gib_explode (origin[3],num) {
    
    new 
flesh[3], xyz
    flesh
[0] = mdl_gib_flesh
    flesh
[1] = mdl_gib_meat
    flesh
[2] = mdl_gib_legbone
    
    
// Gib explosion
    // Head
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_MODEL)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
write_coord(random_num(-100,100))
    
write_coord(random_num(-100,100))
    
write_coord(random_num(100,200))
    
write_angle(random_num(0,360))
    
write_short(mdl_gib_head)
    
write_byte(0)
    
write_byte(500)
    
message_end()
    
    
// Spine
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_MODEL)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2])
    
write_coord(random_num(-100,100))
    
write_coord(random_num(-100,100))
    
write_coord(random_num(100,200))
    
write_angle(random_num(0,360))
    
write_short(mdl_gib_spine)
    
write_byte(0)
    
write_byte(500)
    
message_end()
    
    
// Lung
    
for(new Lung 0Lung random_num(1,2); Lung++) {
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(TE_MODEL)
        
write_coord(origin[0])
        
write_coord(origin[1])
        
write_coord(origin[2])
        
write_coord(random_num(-100,100))
        
write_coord(random_num(-100,100))
        
write_coord(random_num(100,200))
        
write_angle(random_num(0,360))
        
write_short(mdl_gib_lung)
        
write_byte(0)
        
write_byte(500)
        
message_end()
        
    }
    
    
// Parts, 5 times
    
for(new Parts 0Parts 5Parts++) {
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(TE_MODEL)
        
write_coord(origin[0])
        
write_coord(origin[1])
        
write_coord(origin[2])
        
write_coord(random_num(-100,100))
        
write_coord(random_num(-100,100))
        
write_coord(random_num(100,200))
        
write_angle(random_num(0,360))
        
write_short(flesh[random_num(0,2)])
        
write_byte(0)
        
write_byte(500)
        
message_end()
        
    }
    
    
// Blood
    
for(new Blood 0Blood numBlood++) {
        
        
random_num(-100,100)
        
random_num(-100,100)
        
random_num(0,100)
        
        for(new 
05j++) {
            
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
            
write_byte(TE_BLOODSPRITE)
            
write_coord(origin[0]+(x*j))
            
write_coord(origin[1]+(y*j))
            
write_coord(origin[2]+(z*j))
            
write_short(spr_blood_spray)
            
write_short(spr_blood_drop)
            
write_byte(248)
            
write_byte(15)
            
message_end()
            
        }
        
    }
    

Responder
#2
A ver por donde empiezo xd

Código PHP:
const TASK_HUD 9999 

Setea el task asi
Código PHP:
set_task (1.0"explotar"id TASK_HUD__"a"g_iContador 

Tu funcion de explotar
Código PHP:
public explotar(id)
{   
    
g_iContador-- 
    
    if(
g_iContador >= 0)
    {
        
set_hudmessage255,255,255, -1.00.3006.012.0 
        
show_hudmessage(0"El misil va a explotar en %d"g_iContador)
    }
    else
    {
        
explotar_misil(id TASK_HUD)
    }



Con esto removes el hud
Código PHP:
public pfn_touch (touchertouched)
{
    new 
ClassName1[32]
    new 
ClassName2[32]

    if(!
is_valid_ent(toucher))
        return 
PLUGIN_CONTINUE

    
if (is_valid_ent(toucher))
        
entity_get_string(toucherEV_SZ_classnameClassName131)
    
    new 
owner entity_get_edict(toucherEV_ENT_owner)

    if(
task_exists(owner TASK_HUD))
    
remove_task(owner TASK_HUD)

    .... 

Y finalmente para hacerlo explotar cuando termine el tiempo
Código PHP:
stock explotar_misil(id)
{
    new 
ent
    
while((ent find_ent_by_class(ent"rpgrocket")) != 0)
    {
        if(
entity_get_edict(entEV_ENT_owner) == id)
    {
        new 
vExplodeAt[3]
        new 
Float:fl_vExplodeAt[3]
        
entity_get_vector(entEV_VEC_originfl_vExplodeAt)

        
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
        
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
        
vExplodeAt[2] = floatround(fl_vExplodeAt[2])

        
emit_sound(entCHAN_WEAPON"weapons/mortarhit.wav"1.00.50PITCH_NORM)
        
emit_sound(entCHAN_VOICE"weapons/mortarhit.wav"1.00.50PITCH_NORM)

        for (new 
Explosion 1Explosion 8Explosion++)
        {
            
// Random Explosion 8 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SPRITE)
            
write_coord(vExplodeAt[0] + random_num(-60,60))
            
write_coord(vExplodeAt[1] + random_num(-60,60))
            
write_coord(vExplodeAt[2] +128)
            
write_short(g_sModelIndexFireball)
            
write_byte(random_num(30,65))
            
write_byte(255)
            
message_end()
        }

        for (new 
Smoke 1Smoke 3Smoke++)
        {
            
// Random Smoke 3 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SMOKE)
            
write_coord(vExplodeAt[0])
            
write_coord(vExplodeAt[1])
            
write_coord(vExplodeAt[2] + 256)
            
write_short(g_sModelIndexSmoke)
            
write_byte(random_num(80,150))
            
write_byte(random_num(5,10))
            
message_end()
        }

        
// Create the burn decal
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GUNSHOTDECAL)
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(0)            

        if (
is_cstrikewrite_byte(random_num(46,48))  // decal
        
if (!is_cstrikewrite_byte(random_num(58,60)) // decal

        
message_end()

        new 
Max_Damage get_pcvar_num(cvar_bazooka_max_damage)
        new 
Damage_Radius get_pcvar_num(cvar_bazooka_damage_radius )

        new 
PlayerPos[3], DistanceDamage

        
for (new 132i++)
        {
            if (
is_user_alive(i) == 1)
            {
                new 
team_kill 0
                get_user_origin
(iPlayerPos)

                
Distance get_distance(PlayerPosvExplodeAt)

                if (
Distance <= Damage_Radius)
                {  
// Screenshake Radius
                    
message_begin(MSG_ONEget_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
message_end()

                    
Damage Max_Damage floatround(floatmul(float(Max_Damage), floatdiv(float(Distance), float(Damage_Radius))))

                    if (!
get_user_godmode(i))
                    {
                        if(
cvar_exists("mp_friendlyfire"))
                        {
                            if( 
get_cvar_num("mp_friendlyfire") && get_pcvar_num(cvar_bazooka_obeyffcvar))
                            {
                                if(
get_user_team(i) == get_user_team(id))
                                    
team_kill 1

                                do_victim
(i,id,Damage,team_kill)
                            }
                            else
                            {
                                if(
get_user_team(i) != get_user_team(id))
                                    
do_victim(i,id,Damage,team_kill)
                            }
                        }
                        else
                        {
                            
do_victim(i,id,Damage,team_kill)
                        }
                    }
                    else
                    {
                        
do_victim(i,id,Damage,team_kill)
                    }
                }
            }
        }

        break
    }
    }

    
attach_view(id,id)
    
User_Control[id] = 0
    remove_entity
(ent)


Queda en vos revisar errores de tipeo
Whatdone
Responder
#3
(25/01/2016, 01:09 AM)NikKOo31 escribió: A ver por donde empiezo xd

Código PHP:
const TASK_HUD 9999 

Setea el task asi
Código PHP:
set_task (1.0"explotar"id TASK_HUD__"a"g_iContador 

Tu funcion de explotar
Código PHP:
public explotar(id)
{   
    
g_iContador-- 
    
    if(
g_iContador >= 0)
    {
        
set_hudmessage255,255,255, -1.00.3006.012.0 
        
show_hudmessage(0"El misil va a explotar en %d"g_iContador)
    }
    else
    {
        
explotar_misil(id TASK_HUD)
    }



Con esto removes el hud
Código PHP:
public pfn_touch (touchertouched)
{
    new 
ClassName1[32]
    new 
ClassName2[32]

    if(!
is_valid_ent(toucher))
        return 
PLUGIN_CONTINUE

    
if (is_valid_ent(toucher))
        
entity_get_string(toucherEV_SZ_classnameClassName131)
    
    new 
owner entity_get_edict(toucherEV_ENT_owner)

    if(
task_exists(owner TASK_HUD))
    
remove_task(owner TASK_HUD)

    .... 

Y finalmente para hacerlo explotar cuando termine el tiempo
Código PHP:
stock explotar_misil(id)
{
    new 
ent
    
while((ent find_ent_by_class(ent"rpgrocket")) != 0)
    {
        if(
entity_get_edict(entEV_ENT_owner) == id)
    {
        new 
vExplodeAt[3]
        new 
Float:fl_vExplodeAt[3]
        
entity_get_vector(entEV_VEC_originfl_vExplodeAt)

        
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
        
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
        
vExplodeAt[2] = floatround(fl_vExplodeAt[2])

        
emit_sound(entCHAN_WEAPON"weapons/mortarhit.wav"1.00.50PITCH_NORM)
        
emit_sound(entCHAN_VOICE"weapons/mortarhit.wav"1.00.50PITCH_NORM)

        for (new 
Explosion 1Explosion 8Explosion++)
        {
            
// Random Explosion 8 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SPRITE)
            
write_coord(vExplodeAt[0] + random_num(-60,60))
            
write_coord(vExplodeAt[1] + random_num(-60,60))
            
write_coord(vExplodeAt[2] +128)
            
write_short(g_sModelIndexFireball)
            
write_byte(random_num(30,65))
            
write_byte(255)
            
message_end()
        }

        for (new 
Smoke 1Smoke 3Smoke++)
        {
            
// Random Smoke 3 Times
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_SMOKE)
            
write_coord(vExplodeAt[0])
            
write_coord(vExplodeAt[1])
            
write_coord(vExplodeAt[2] + 256)
            
write_short(g_sModelIndexSmoke)
            
write_byte(random_num(80,150))
            
write_byte(random_num(5,10))
            
message_end()
        }

        
// Create the burn decal
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GUNSHOTDECAL)
        
write_coord(vExplodeAt[0])
        
write_coord(vExplodeAt[1])
        
write_coord(vExplodeAt[2])
        
write_short(0)            

        if (
is_cstrikewrite_byte(random_num(46,48))  // decal
        
if (!is_cstrikewrite_byte(random_num(58,60)) // decal

        
message_end()

        new 
Max_Damage get_pcvar_num(cvar_bazooka_max_damage)
        new 
Damage_Radius get_pcvar_num(cvar_bazooka_damage_radius )

        new 
PlayerPos[3], DistanceDamage

        
for (new 132i++)
        {
            if (
is_user_alive(i) == 1)
            {
                new 
team_kill 0
                get_user_origin
(iPlayerPos)

                
Distance get_distance(PlayerPosvExplodeAt)

                if (
Distance <= Damage_Radius)
                {  
// Screenshake Radius
                    
message_begin(MSG_ONEget_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
write_short(1<<14)
                    
message_end()

                    
Damage Max_Damage floatround(floatmul(float(Max_Damage), floatdiv(float(Distance), float(Damage_Radius))))

                    if (!
get_user_godmode(i))
                    {
                        if(
cvar_exists("mp_friendlyfire"))
                        {
                            if( 
get_cvar_num("mp_friendlyfire") && get_pcvar_num(cvar_bazooka_obeyffcvar))
                            {
                                if(
get_user_team(i) == get_user_team(id))
                                    
team_kill 1

                                do_victim
(i,id,Damage,team_kill)
                            }
                            else
                            {
                                if(
get_user_team(i) != get_user_team(id))
                                    
do_victim(i,id,Damage,team_kill)
                            }
                        }
                        else
                        {
                            
do_victim(i,id,Damage,team_kill)
                        }
                    }
                    else
                    {
                        
do_victim(i,id,Damage,team_kill)
                    }
                }
            }
        }

        break
    }
    }

    
attach_view(id,id)
    
User_Control[id] = 0
    remove_entity
(ent)


Queda en vos revisar errores de tipeo

Muchas gracias, al parecer funciona bien, pero tengo 2 problemas: el showhudmessage al estar en 0, es para todos los jugadores pero al poner id (reemplazando el 0) no me funciona para cada jugador, ¿cómo se puede arreglar eso? Y el otro problema es que si dos jugadores con diferencia de unos segundos tiran el misil, se "bugea" y no explota mientras que el usuario que tiró primero puede seguir moviendolo aunque haya llegado a 0 o explotan al mismo tiempo cuando el primero que tiro el misil llego a 0 segundos.
Responder
#4
Código PHP:
new g_VerHud// creas la variable

g_VerHud CreateHudSyncObj() //en plugin_init

public explotar(taskid)
{
    
g_iContador--
    
    new 
id taskid TASK_HUD;
    
    if(
g_iContador >= 0)
    {
        
set_hudmessage255,255,255, -1.00.3006.012.0 )
        
show_hudmessage(idg_VerHud"El misil va a explotar en %d"g_iContador)
    }
    else
    {
        
explotar_misil(id TASK_HUD)
    }


prueba
Responder
#5
ni tendria que ser todo indexado? pacman

NO DOY AYUDA VIA MENSAJE PRIVADO

* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook

[Imagen: w8565u-4.png]
Responder
#6
El problema del hud creo que lo arregle con:

Código PHP:
show_hudmessage(id TASK_HUD"El misil va a explotar en %d"g_iContador

¿Está bien así?

(25/01/2016, 07:59 PM)kikizon2 escribió: ni tendria que ser todo indexado? pacman

No entiendo

El otro problema sigo sin poder solucionarlo, 2 jugadores al mismo tiempo que controlen el misil se bugean y baja a 2 segundos
Responder
#7
(25/01/2016, 10:01 PM)Skaviados escribió: El problema del hud creo que lo arregle con:

Código PHP:
show_hudmessage(id TASK_HUD"El misil va a explotar en %d"g_iContador

¿Está bien así?

Si, señor.

(25/01/2016, 10:01 PM)Skaviados escribió: El otro problema sigo sin poder solucionarlo, 2 jugadores al mismo tiempo que controlen el misil se bugean y baja a 2 segundos

Indexa g_iContador. Vas a necesitar un contador para cada usuario
Whatdone
Responder
#8
(26/01/2016, 01:17 AM)NikKOo31 escribió:
(25/01/2016, 10:01 PM)Skaviados escribió: El problema del hud creo que lo arregle con:

Código PHP:
show_hudmessage(id TASK_HUD"El misil va a explotar en %d"g_iContador

¿Está bien así?

Si, señor.

(25/01/2016, 10:01 PM)Skaviados escribió: El otro problema sigo sin poder solucionarlo, 2 jugadores al mismo tiempo que controlen el misil se bugean y baja a 2 segundos

Indexa g_iContador. Vas a necesitar un contador para cada usuario

Ok y ¿cómo lo pongo?

new g_iContador[33]? y en la parte de public explotar cómo quedaría?
Responder
#9
(26/01/2016, 01:01 PM)Skaviados escribió: Ok y ¿cómo lo pongo?

new g_iContador[33]? y en la parte de public explotar cómo quedaría?

Código PHP:
if(!task_exists(TASK_HUD id)) 
        {
           
g_iContador[id] = 11
           set_task 
(1.0"explotar"TASK_HUD id__"a"g_iContador[id]+
        } 

Y explotar asi :B

Código PHP:
public explotar(id)
{   
    
id -= TASK_HUD
    g_iContador
[id]-- 
    
    if(
g_iContador[id] >= 0)
    {
        
set_hudmessage255,255,255, -1.00.3006.012.0 
        
show_hudmessage(id"El misil va a explotar en %d"g_iContador[id])
    }
    else
    {
        
explotar_misil(id)
        
remove_task(id TASK_HUD)
    }

Whatdone
Responder
#10
(26/01/2016, 03:21 PM)NikKOo31 escribió:
(26/01/2016, 01:01 PM)Skaviados escribió: Ok y ¿cómo lo pongo?

new g_iContador[33]? y en la parte de public explotar cómo quedaría?

Código PHP:
if(!task_exists(TASK_HUD id)) 
        {
           
g_iContador[id] = 11
           set_task 
(1.0"explotar"TASK_HUD id__"a"g_iContador[id]+
        } 

Y explotar asi :B

Código PHP:
public explotar(id)
{   
    
id -= TASK_HUD
    g_iContador
[id]-- 
    
    if(
g_iContador[id] >= 0)
    {
        
set_hudmessage255,255,255, -1.00.3006.012.0 
        
show_hudmessage(id"El misil va a explotar en %d"g_iContador[id])
    }
    else
    {
        
explotar_misil(id)
        
remove_task(id TASK_HUD)
    }


Muchas gracias de nuevo, creo que sobre este plugin no me queda otro problema pero si con otra parte de code. Es un hudmessage con colores random predefinidos, pero solamente me tira un error al compilar, al momento de usar la función random:

Error: Argument type mismatch (argument 1)
En esta linea: new col = random(COLORS);

Código PHP:
enum _:COLOR_STRUCT
{
    
ROJO,
    
VERDE,
    
AZUL,
    
NOMBRE[32]
};

new const 
COLORS[][COLOR_STRUCT] =
{    
// Rojo, Verde, Azul, Nombre
    
17050100"Fucsia" },
    { 
2552550"Amarillo" },
    { 
25515050"Naranja" },
    { 
18025510"Verde Limon" },
    { 
255255255"Blanco" },
    { 
1004040"Marron" },
    { 
10050200"Morado" },
    { 
2355050"Rojo Claro" },
    { 
2070220"Azul Claro" }
};

new 
col random(COLORS);
set_hudmessage(COLORS[col][ROJO], COLORS[col][VERDE], COLORS[col][AZUL], -1.0, -1.0);
show_hudmessage(id"Este mensaje es de color %s"COLORS[col][NOMBRE]); 

Eso lo saque de un comentario de Mario AR para poner un hud con colores random pero no me funciona, ¿qué puede ser?
Responder
#11
Reemplaza la linea que mencionaste por esta, supongo que ahi tendria que compilar Whatever

Código PHP:
new col random(sizeof COLORS); 
Heber[S]ourcE
Veteran Member
in
Desvirtue
Tatakae
Responder
#12
(27/01/2016, 06:12 AM)Heber[$]ource escribió: Reemplaza la linea que mencionaste por esta, supongo que ahi tendria que compilar Whatever

Código PHP:
new col random(sizeof COLORS); 

Muchas gracias, al parecer esa era la solución. Pueden cerrar el tema si quieren, cualquier cosa abro uno nuevo.
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)