Raised This Month: $32 Target: $400
 8% 

The round does not end if death by entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-11-2018 , 00:55   The round does not end if death by entity
Reply With Quote #1

Hello everyone, well I made a zombie plague mode that all are human (no zombies) and the goal is to kill each other. For that I use infinite round (I use the round control module) because if a new player enters the server and chooses the terrorist team the game is restarted. I give them all a bazooka but the problem is that when there is 1 vs 1 and one kills the other with the bazooka the round does not end (I force to end the round when there is only one human with the round control module too), when I kill with normal weapon, the round if it ends. My question is how do I end the round when it is annihilated by an entity in this case the bazooka? .. Thanks in advance

Code of the bazooka:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <zombieplague>
#include <xs>

#define PLUGIN "[ZP] Bazooka + new modes"
#define VERSION "1.6"
#define AUTHOR "Vechta"

// Set " // " before custom models if you want to use standart Rpg models
#define CUSTOM_MODEL

// Set " // " before if you dont want that Admin get free Bazooka
#define ADMIN_BAZOOKA

#if defined ADMIN_BAZOOKA
#define BAZOOKA_ACCESS ADMIN_LEVEL_H
#endif

#define TASK_SEEK_CATCH 9000
#define fm_is_valid_ent(%1) pev_valid(%1)

#if defined CUSTOM_MODEL
static const mrocket[] = "models/zombie_plague/rpgrocket_vechta.mdl";
static const 
mrpg_w[] = "models/zombie_plague/w_rpg_vechta.mdl";
static const 
mrpg_v[] = "models/zombie_plague/v_rpg_vechta.mdl";
static const 
mrpg_p[] = "models/zombie_plague/p_rpg_vechta.mdl";
#else
static const mrocket[] = "models/rpgrocket.mdl";
static const 
mrpg_w[] = "models/w_rpg.mdl";
static const 
mrpg_v[] = "models/v_rpg.mdl";
static const 
mrpg_p[] = "models/p_rpg.mdl";
#endif

static const sfire[] = "weapons/rocketfire1.wav";
static const 
sfly[] = "weapons/nuke_fly.wav";
static const 
shit[] = "weapons/mortarhit.wav";
static const 
spickup[] = "items/gunpickup2.wav";
static const 
reload[] = "items/9mmclip2.wav";

// Time between can witch to next mode (Thanks to Nihilanth)
#define SWITCH_TIME    0.5
 
// Register the item
new g_itemid;

// Cvars
new pcvar_delaypcvar_maxdmgpcvar_radiuspcvar_mappcvar_speed,
    
pcvar_dmgforpackspcvar_awardpcvar_countpcvar_speed_homing,
    
pcvar_speed_camera
    
// Sprites
new rocketsmokewhiteexplosionbazsmoke

// Variables
new dmgcount[33], user_controll[33], mode[33]

// Bools
new bool:g_hasbazooka[33], Float:LastShoot[33]

// Floats
new Float:lastSwitchTime[33]

// Messages
new gmsg_screenshakegmsg_deathgmsg_damagegmsgBarTime

// Others
new Saytxt

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
        
    
// Cvars
    
pcvar_delay register_cvar("zp_bazooka_delay""10")
    
pcvar_maxdmg register_cvar("zp_bazooka_damage""550")
    
pcvar_radius register_cvar("zp_bazooka_radius""250")
    
pcvar_map register_cvar("zp_bazooka_map""0")
    
pcvar_dmgforpacks get_cvar_pointer("zp_human_damage_reward")
    
pcvar_award register_cvar("zp_bazooka_awardpacks""1")
    
pcvar_speed register_cvar("zp_bazooka_speed""800")
    
pcvar_speed_homing register_cvar("zp_bazooka_homing_speed""350")
    
pcvar_speed_camera register_cvar("zp_bazooka_camera_speed""300")
    
pcvar_count register_cvar("zp_bazooka_count""4")
       
    
// Register the Extra Item
    
g_itemid zp_register_extra_item("Bazooka"25ZP_TEAM_HUMAN)
    
    
// Events
    
register_event("CurWeapon","switch_to_knife","be");
    
register_event("HLTV""event_HLTV""a""1=0""2=0")
    
register_event("DeathMsg""player_die""a")
    
    
// Clcmd's
    
register_clcmd("drop""drop_call");
    
register_concmd("zp_bazooka""give_bazooka"ADMIN_BAN"<name/@all> gives a bazooka to the spcified target")
    
    
// Forwards
    
register_forward(FM_PlayerPreThink"client_PreThink");
    
register_forward(FM_Touch"fw_touch");
    
register_forward(FM_CmdStart"fw_CmdStart")
         
    
// Msgid >.<
    
gmsg_screenshake get_user_msgid("ScreenShake");
    
gmsg_death get_user_msgid("DeathMsg");
    
gmsg_damage get_user_msgid("Damage");
    
Saytxt get_user_msgid("SayText")
    
gmsgBarTime get_user_msgid"BarTime" )
    
    
// Check for Admin on ban
    #if defined ADMIN_BAZOOKA
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
#endif
}
 
public 
client_putinserver(id)
{
    
mode[id] = 1
    g_hasbazooka
[id] = false
    LastShoot
[id] = 0.0
}

public 
plugin_cfg()
{
    new 
cfgdirecction[32]
    
get_configsdir(cfgdirecctionsizeof cfgdirecction 1);

    
server_cmd("exec %s/zp_bazooka_modes.cfg"cfgdirecction)
}

public 
event_HLTV()
{
    new 
rpg_temp engfunc(EngFunc_FindEntityByString, -1"classname""rpg_temp");
    
    while( 
rpg_temp 0
    {
        
engfunc(EngFunc_RemoveEntityrpg_temp);
        
rpg_temp engfunc(EngFunc_FindEntityByString, -1"classname""rpg_temp");
    }
        
    if ( 
get_pcvar_num(pcvar_map) ) return;
        
    for( new 
id 1id <= 32id++ )
    {
        
g_hasbazooka[id] = false;
        
        
#if defined ADMIN_BAZOOKA
        
set_task(1.0"AdminBazooka"id)
        
#endif
    
}
}

public 
zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_itemid)
    {
        if ( 
g_hasbazooka[player] )
        {
            
bazooka_message(player"^x04[ZP]^x01 You already have a Bazooka!");
            return 
ZP_PLUGIN_HANDLED            
        
}
        else if (
baz_count() > get_pcvar_num(pcvar_count))
        {
            
bazooka_message(player"^x04[ZP]^x01 Sorry, but maximum Bazooka's reached!");
            return 
ZP_PLUGIN_HANDLED;
        }
        else 
        {
            
g_hasbazooka[player] = true;
            
LastShoot[player] = 0.0;
            
bazooka_message(player"^x04[ZP]^x01 You bought Bazooka! [Attack2: Change modes] [Reload:^x04 %2.1f^x01 seconds]"get_pcvar_float(pcvar_delay))
            
emit_sound(playerCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
give_bazooka(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1)) 
    {
        
console_print(id,"You have no access to that command");
        return;
    }
    if (
read_argc() > 2
    {
        
console_print(id,"Too many arguments supplied.");
        return;
    }
    
    new 
arg1[32];
    
read_argv(1arg1sizeof(arg1) - 1);
    new 
player cmd_target(idarg110);
    
    if ( !
player 
    {
        if ( 
arg1[0] == '@' 
        {
            for ( new 
1<= 32i++ ) 
            {
                if ( 
is_user_connected(i) && !g_hasbazooka[i] && !zp_get_user_zombie(i) ) 
                {
                    
g_hasbazooka[id] = true
                    LastShoot
[id] = 0.0
                    emit_sound
(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                    
bazooka_message(player"^x04[ZP]^x01 You got a Bazooka! [Attack2: Change modes] [Reload:^x04 %2.1f^x01 seconds]"get_pcvar_float(pcvar_delay))
                }
            }
        } 
        else 
        {
            
client_print(idprint_center"[ZP] No Such Player/Team");
            return;
        }
    } 
    else if ( !
g_hasbazooka[player] && !zp_get_user_zombie(player) ) 
    {
        
g_hasbazooka[id] = true
        LastShoot
[id] = 0.0
        emit_sound
(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
bazooka_message(player"^x04[ZP]^x01 You got a Bazooka! [Attack2: Change modes] [Reload:^x04 %2.1f^x01 seconds]"get_pcvar_float(pcvar_delay))
    }
}
 
public 
zp_user_infected_post(idinfector)
{
    if ( 
g_hasbazooka[id] )
    {
        
drop_rpg_temp(id);
    }
}
        
public 
zp_user_humanized_post(idsurvivor)
{
    
#if defined ADMIN_BAZOOKA
    
if (get_user_flags(id) & BAZOOKA_ACCESS)
    {
        
g_hasbazooka[id] = true
        LastShoot
[id] = 0.0
    
}
    
#endif
}
 
public 
plugin_precache()
{
    
precache_model(mrocket);        
 
    
precache_model(mrpg_w);
    
precache_model(mrpg_v);
    
precache_model(mrpg_p);
 
    
precache_sound(sfire);
    
precache_sound(sfly);
    
precache_sound(shit);
    
precache_sound(spickup);
    
precache_sound(reload);
        
    
rocketsmoke precache_model("sprites/smoke.spr");
    
white precache_model("sprites/white.spr");
    
explosion precache_model("sprites/fexplo.spr");
    
bazsmoke  precache_model("sprites/steam1.spr");
}
 
public 
switch_to_knife(id)
{
    if ( !
is_user_alive(id) ) return;
 
    if ( 
g_hasbazooka[id] )
    {
        if (
get_user_weapon(id) == CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel2mrpg_v);
            
set_pev(idpev_weaponmodel2mrpg_p);
        }
    }
}

fire_rocket(id
{
    if (!
CanShoot(id) ) return;

    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
    if (!
pev_valid(ent) || !is_user_alive(id) )
        return;
 
    new 
data[1]
    
data[0] = id
    LastShoot
[id] = get_gametime();
    
set_task(0.0 get_pcvar_num(pcvar_delay), "rpg_reload"id);
    
engclient_cmd(id"weapon_knife");
 
    new 
Float:StartOrigin[3], Float:Angle[3];
    
pev(idpev_originStartOrigin);
    
pev(idpev_anglesAngle);
    
    
set_pev(entpev_classname"rpgrocket");
    
engfunc(EngFunc_SetModelentmrocket);
    
set_pev(entpev_mins, {-1.0, -1.0, -1.0});
    
set_pev(entpev_maxs, {1.01.01.0});
    
engfunc(EngFunc_SetOriginentStartOrigin);
    
set_pev(entpev_anglesAngle);

 
    
set_pev(entpev_solid2);
    
set_pev(entpev_movetype5);
    
set_pev(entpev_ownerid);
 
    new 
Float:fAim[3],Float:fAngles[3],Float:fOrigin[3]
    
velocity_by_aim(id,64,fAim)
    
vector_to_angle(fAim,fAngles)
    
pev(id,pev_origin,fOrigin)
        
    
fOrigin[0] += fAim[0]
    
fOrigin[1] += fAim[1]
    
fOrigin[2] += fAim[2]
 
    new 
Float:nVelocity[3];
    if (
mode[id] == 1)
        
velocity_by_aim(idget_pcvar_num(pcvar_speed), nVelocity);
    else if (
mode[id] == 2)
        
velocity_by_aim(idget_pcvar_num(pcvar_speed_homing), nVelocity);
    else if (
mode[id] == 3)
        
velocity_by_aim(idget_pcvar_num(pcvar_speed_camera), nVelocity);
        
    
set_pev(entpev_velocitynVelocity);
    
entity_set_int(entEV_INT_effectsentity_get_int(entEV_INT_effects) | EF_BRIGHTLIGHT)

 
    
emit_sound(entCHAN_WEAPONsfireVOL_NORMATTN_NORM0PITCH_NORM);
    
emit_sound(entCHAN_VOICEsflyVOL_NORMATTN_NORM0PITCH_NORM);
        
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(22);
    
write_short(ent);
    
write_short(rocketsmoke);
    
write_byte(50);
    
write_byte(3);
    
write_byte(255);
    
write_byte(255);
    
write_byte(255);
    
write_byte(255);
    
message_end();

    if (
mode[id] == 2
        
set_task(0.5"rpg_seek_follow"ent TASK_SEEK_CATCH__"b");
    else if (
mode[id] == 3
    {
        if (
is_user_alive(id))
        {
            
entity_set_int(entEV_INT_rendermode1)
            
attach_view(ident)
            
user_controll[id] = ent
        
}
    } 
    
launch_push(id130)
    
Progress_status(idget_pcvar_num(pcvar_delay))
}
 
public 
rpg_reload(id)
{
    if (!
g_hasbazooka[id]) return;
    
    if ( 
get_user_weapon(id) == CSW_KNIFE switch_to_knife(id);
    {
        
// CanShoot[id] = true
        
client_print(idprint_center"Bazooka reloaded!")
        
emit_sound(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    }
}
 
public 
fw_touch(enttouched)
{
    if ( !
pev_valid(ent) ) return FMRES_IGNORED;
    
    static 
entclass[32];
    
pev(entpev_classnameentclass31);
    
    if ( 
equali(entclass"rpg_temp") )
    {
        static 
touchclass[32];
        
pev(touchedpev_classnametouchclass31);
        if ( !
equali(touchclass"player") ) return FMRES_IGNORED;
                
        if( !
is_user_alive(touched) || zp_get_user_zombie(touched) ) return FMRES_IGNORED;
                        
        
emit_sound(touchedCHAN_VOICEspickup1.0ATTN_NORM0PITCH_NORM);
        
g_hasbazooka[touched] = true;
        
        
engfunc(EngFunc_RemoveEntityent);
        
        return 
FMRES_HANDLED;
    }
    else if ( 
equali(entclass"rpgrocket") )
    {
        new 
Float:EndOrigin[3];
        
pev(entpev_originEndOrigin);
        new 
NonFloatEndOrigin[3];
        
NonFloatEndOrigin[0] = floatround(EndOrigin[0]);
        
NonFloatEndOrigin[1] = floatround(EndOrigin[1]);
        
NonFloatEndOrigin[2] = floatround(EndOrigin[2]);
    
        
emit_sound(entCHAN_WEAPONshitVOL_NORMATTN_NORM0PITCH_NORM);
        
emit_sound(entCHAN_VOICEshitVOL_NORMATTN_NORM0PITCH_NORM);
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(17);
        
write_coord(NonFloatEndOrigin[0]);
        
write_coord(NonFloatEndOrigin[1]);
        
write_coord(NonFloatEndOrigin[2] + 128);
        
write_short(explosion);
        
write_byte(60);
        
write_byte(255);
        
message_end();
    
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(5);
        
write_coord(NonFloatEndOrigin[0]);
        
write_coord(NonFloatEndOrigin[1]);
        
write_coord(NonFloatEndOrigin[2] + 256);
        
write_short(bazsmoke);
        
write_byte(125);
        
write_byte(5);
        
message_end();
        
        new 
maxdamage get_pcvar_num(pcvar_maxdmg);
        new 
damageradius get_pcvar_num(pcvar_radius);
        
        new 
PlayerPos[3], distancedamage;
        for (new 
1<= 32i++) 
        {
            if ( 
is_user_alive(i)) 
            {       
                new 
id pev(entpev_owner)
                
                if  ((
zp_get_user_zombie(id)) || ((zp_get_user_nemesis(id))))
                if ((
zp_get_user_zombie(i)) || (zp_get_user_nemesis(i))) continue;
                                                
                if  ((!
zp_get_user_zombie(id)) && (!zp_get_user_nemesis(id))) 
                if ((!
zp_get_user_zombie(i)) && (!zp_get_user_nemesis(i))) continue;
                                                
                
get_user_origin(iPlayerPos);
                
                
distance get_distance(PlayerPosNonFloatEndOrigin);
                
                if (
distance <= damageradius)
                { 
                    
message_begin(MSG_ONEgmsg_screenshake, {0,0,0}, i);
                    
write_short(1<<14);
                    
write_short(1<<14);
                    
write_short(1<<14);
                    
message_end();
                    
                    
damage maxdamage floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius))));
                    new 
attacker pev(entpev_owner);
                
                    
baz_damage(iattackerdamage"bazooka");
                }
            }
        }
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(21);
        
write_coord(NonFloatEndOrigin[0]);
        
write_coord(NonFloatEndOrigin[1]);
        
write_coord(NonFloatEndOrigin[2]);
        
write_coord(NonFloatEndOrigin[0]);
        
write_coord(NonFloatEndOrigin[1]);
        
write_coord(NonFloatEndOrigin[2] + 320);
        
write_short(white);
        
write_byte(0);
        
write_byte(0);
        
write_byte(16);
        
write_byte(128);
        
write_byte(0);
        
write_byte(255);
        
write_byte(255);
        
write_byte(192);
        
write_byte(128);
        
write_byte(0);
        
message_end();
        
        
attach_view(entity_get_edict(entEV_ENT_owner), entity_get_edict(entEV_ENT_owner))
        
user_controll[entity_get_edict(entEV_ENT_owner)] = 0
        remove_entity
(ent)
                
        return 
FMRES_HANDLED;
    }
    return 
FMRES_IGNORED;
}
 
public 
drop_call(id)
{
    if ( 
g_hasbazooka[id] && get_user_weapon(id) == CSW_KNIFE )
    {
        
drop_rpg_temp(id);
        return 
PLUGIN_HANDLED
    }
    return 
PLUGIN_CONTINUE;
}
 
drop_rpg_temp(id
{
    new 
Float:fAim[3] , Float:fOrigin[3];
    
velocity_by_aim(id 64 fAim);
    
pev(id pev_origin fOrigin);
 
    
fOrigin[0] += fAim[0];
    
fOrigin[1] += fAim[1];
 
    new 
rpg engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
 
    
set_pev(rpgpev_classname"rpg_temp");
    
engfunc(EngFunc_SetModelrpgmrpg_w);
 
    
set_pev(rpgpev_mins, { -16.0, -16.0, -16.0 } );
    
set_pev(rpgpev_maxs, { 16.016.016.0 } );
 
    
set_pev(rpg pev_solid 1);
    
set_pev(rpg pev_movetype 6);
 
    
engfunc(EngFunc_SetOriginrpgfOrigin);
 
    
g_hasbazooka[id] = false;
}
 
baz_damage(idattackerdamageweaponDescription[])
{
    if ( 
pev(idpev_takedamage) == DAMAGE_NO ) return;
    if ( 
damage <= ) return;
 
    new 
userHealth get_user_health(id);
    
    if (
userHealth damage <= 
    {
        
dmgcount[attacker] += userHealth damage;
        
set_msg_block(gmsg_deathBLOCK_SET);
        
ExecuteHamB(Ham_Killedidattacker2);
        
set_msg_block(gmsg_deathBLOCK_NOT);
        
                
        
message_begin(MSG_BROADCASTgmsg_death);
        
write_byte(attacker);
        
write_byte(id);
        
write_byte(0);
        
write_string(weaponDescription);
        
message_end();
                
        
set_pev(attackerpev_fragsfloat(get_user_frags(attacker) + 1));
                        
        new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10];
        
        
get_user_name(attackerkname31);
        
get_user_team(attackerkteam9);
        
get_user_authid(attackerkauthid31);
         
        
get_user_name(idvname31);
        
get_user_team(idvteam9);
        
get_user_authid(idvauthid31);
                        
        
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""
        
knameget_user_userid(attacker), kauthidkteam
        
vnameget_user_userid(id), vauthidvteamweaponDescription);
    }
    else 
    {
        
dmgcount[attacker] += damage;
        new 
origin[3];
        
get_user_origin(idorigin);
                
        
message_begin(MSG_ONE,gmsg_damage,{0,0,0},id);
        
write_byte(21);
        
write_byte(20);
        
write_long(DMG_BLAST);
        
write_coord(origin[0]);
        
write_coord(origin[1]);
        
write_coord(origin[2]);
        
message_end();
                
        
set_pev(idpev_healthpev(idpev_health) - float(damage));
    }
    if ( !
get_pcvar_num(pcvar_award) ) return;
        
    new 
breaker get_pcvar_num(pcvar_dmgforpacks);
    
    if ( 
dmgcount[attacker] > breaker )
    {
        new 
temp dmgcount[attacker] / breaker
        
if ( temp breaker dmgcount[attacker] ) return; //should never be possible
        
dmgcount[attacker] -= temp breaker;
        
zp_set_user_ammo_packsattackerzp_get_user_ammo_packs(attacker) + temp );
    }
}
 
public 
rpg_seek_follow(ent
{
    
ent -= TASK_SEEK_CATCH
        
    
new Floatshortest_distance 500.0;
    new 
NearestPlayer 0;
 
    if (
pev_valid(ent)) 
    {
        static 
entclass[32];
        
pev(entpev_classnameentclass31); 

        if ( 
equali(entclass"rpgrocket") )
        {
            new 
id_owner pev(entpev_owner)
            new 
iClient[32], livePlayersiNum;
            
get_players(iClientlivePlayers"a"); 
     
            for(
iNum 0iNum livePlayersiNum++) 
            { 
                if ( 
is_user_alive(iClient[iNum]) && pev_valid(ent) ) 
                {
                    if ( 
id_owner != iClient[iNum] && zp_get_user_zombie(iClient[iNum]) )
                    {
                        new 
Float:PlayerOrigin[3], Float:RocketOrigin[3]
                        
pev(entpev_originRocketOrigin)
                        
pev(iClient[iNum], pev_originPlayerOrigin)
                    
                        new 
Floatdistance get_distance_f(PlayerOriginRocketOrigin)
                        
                        if ( 
distance <= shortest_distance )
                        {
                            
shortest_distance distance;
                            
NearestPlayer iClient[iNum];
                        }
                    }
                }
            }
            if (
NearestPlayer 0
            {
                
entity_set_follow(entNearestPlayer250.0)
            }
        }
    }
}
 
stock entity_set_follow(entitytargetFloat:speed
{
    if(!
fm_is_valid_ent(entity) || !fm_is_valid_ent(target)) 
        return 
0

    
new Float:entity_origin[3], Float:target_origin[3]
    
pev(entitypev_originentity_origin)
    
pev(targetpev_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)
 
    
set_pev(entitypev_velocityvelocity)

    return 
1
}

public 
fw_CmdStart(idUC_HandleSeed)
{
    if(!
is_user_alive(id) || !g_hasbazooka[id]) return 
                
    static 
ButtonOldButton
    OldButton 
get_user_oldbutton(id)
                
    
Button get_uc(UC_HandleUC_Buttons)
        
    if (
Button IN_ATTACK)
    {
        if (!
CanShoot(id) || (OldButton IN_ATTACK2)) return;
        
        if ( 
get_user_weapon(id) == CSW_KNIFE 
            
fire_rocket(id); 
    }
    else if (
Button IN_ATTACK2 && get_user_weapon(id) == CSW_KNIFE
    {
        if ( 
get_gametime ( ) - lastSwitchTime id ] < SWITCH_TIME || (OldButton IN_ATTACK2)) return
        
        if (
is_user_alive(id))
        {
            switch(
mode[id]) 
            {
                case 
1:
                {
                    
mode[id] = 2
                    emit_sound
(idCHAN_ITEM"common/wpn_select.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                    
client_print(idprint_center"Homing fire mode")
                }
                case 
2:
                {
                    
mode[id] = 3
                    emit_sound
(idCHAN_ITEM"common/wpn_select.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                    
client_print(idprint_center"Camera fire mode")
                }
                case 
3:
                {
                    
mode[id] = 1
                    emit_sound
(idCHAN_ITEM"common/wpn_select.wav"VOL_NORMATTN_NORM0PITCH_NORM)
                    
client_print(idprint_center"Normal fire mode")
                }        
            }    
            
lastSwitchTime id ] = get_gametime ( )
        }
    }
    else if (
user_controll[id]) 
    {
        new 
RocketEnt user_controll[id]
            
        if (
is_valid_ent(RocketEnt)) 
        {
            new 
Float:Velocity[3]
            
VelocityByAim(id500Velocity)
            
entity_set_vector(RocketEntEV_VEC_velocityVelocity)
                
            new 
Float:NewAngle[3]
            
entity_get_vector(idEV_VEC_v_angleNewAngle)
            
entity_set_vector(RocketEntEV_VEC_anglesNewAngle)
        }
        else 
        {
            
attach_view(idid)
        }
    }
}

public 
client_connect(id)
    
g_hasbazooka[id] = false

    
#if defined ADMIN_BAZOOKA
public fw_PlayerSpawn(id)
    
set_task(1.0"AdminBazooka"id)
#endif

#if defined ADMIN_BAZOOKA
public AdminBazooka(id)
{
    if (
g_hasbazooka[id] || zp_get_user_nemesis(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return;
    
    if (
is_user_alive(id) && (get_user_flags(id) & BAZOOKA_ACCESS))
    {
        
g_hasbazooka[id] = true
        LastShoot
[id] = 0.0
        emit_sound
(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
bazooka_message(id"^x04[ZP]^x01 You got a Bazooka! [Attack2: Change modes] [Reload:^x04 %2.1f^x01 seconds]"get_pcvar_float(pcvar_delay))
    }
}
#endif

stock launch_push(idvelamount)
{
    static 
Float:flNewVelocity[3], Float:flCurrentVelocity[3]
    
    
velocity_by_aim(id, -velamountflNewVelocity)
    
    
get_user_velocity(idflCurrentVelocity)
    
xs_vec_add(flNewVelocityflCurrentVelocityflNewVelocity)
    
    
set_user_velocity(idflNewVelocity)
}

baz_count()
{
    new 
icount 0;
    
    for(
133i++)
    {
        if(
g_hasbazooka[i])
            
count++;
    }
    return 
count;
}

stock bazooka_message(const id, const input[], any:...)
{
    new 
count 1players[32]
    
    static 
msg[191]
    
vformat(msg,190,input,3)
    
    
replace_all(msg,190,"/g","^4")
    
replace_all(msg,190,"/y","^1")
    
replace_all(msg,190,"/ctr","^3")
    
    if (
idplayers[0] = id; else get_players(players,count,"ch")
    
    for (new 
0counti++)
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLESaytxt_players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
}

public 
Progress_status( const id, const duration )
{
    
message_beginMSG_ONEgmsgBarTime_id )
    
write_shortduration )
    
message_end()
}

public 
player_die() {

    new 
id read_data(2)
    
    if ( 
g_hasbazooka[id] )
        
drop_rpg_temp(id);

    return 
PLUGIN_CONTINUE
}

public 
CanShoot(id)
{
    return 
get_gametime() - LastShoot[id] >= get_pcvar_float(pcvar_delay)

In this way I force to end the round when the last human remains:

PHP Code:
public fw_PlayerKilled(victimattackershouldgib)
{                
    new 
name[32], players[32], ctalive
         get_players
(playersctalive"ae""CT")
    
         if(
ctalive == 1
        {     
           
// Disabled the infinity round
           
RemoveBlockControl(RC_CheckWinConditionsg_pCheckWinHook)
           
           
// Force round to end
           
RoundEndForceControl(WINSTATUS_CT)
           
           
// Disabled friendly fire
           
set_pcvar_num(g_cvar_firefriend0)    
         } 

wicho is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 10-11-2018 , 05:04   Re: The round does not end if death by entity
Reply With Quote #2

Zombie plague mod without zombies
__________________
edon1337 is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 10-11-2018 , 06:58   Re: The round does not end if death by entity
Reply With Quote #3

is it HUMAN plague ?
without Zombie
__________________
SED LYF !!!
SHIELD755 is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-11-2018 , 11:14   Re: The round does not end if death by entity
Reply With Quote #4

Yes, it's just a gamemode not the base of the zombie, does anyone know?
wicho is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-11-2018 , 13:17   Re: The round does not end if death by entity
Reply With Quote #5

Im not Cs fan but i think
PHP Code:
ExecuteHam(Ham_TakeDamage, ... 
will help u in this case.
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-11-2018 , 15:47   Re: The round does not end if death by entity
Reply With Quote #6

This happen if killed by another player?
__________________








CrazY. is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-11-2018 , 19:20   Re: The round does not end if death by entity
Reply With Quote #7

Yes, when it is 1 vs 1 and one kills the other with the bazooka the round does not end, but if it kills with a normal weapon if it ends.
wicho is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-12-2018 , 04:05   Re: The round does not end if death by entity
Reply With Quote #8

try replace :
Code:
baz_damage(i, attacker, damage, "bazooka");
=>
Code:
ExecuteHamB( Ham_TakeDamage, i, "bazooka" , attacker, damage, DMG_BLAST | 8);
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-15-2018 , 12:17   Re: The round does not end if death by entity
Reply With Quote #9

I can not test now, but could this work?

PHP Code:
public plugin_init() 
{
    
RegisterHam(Ham_Killed"info_target""fw_PlayerKilled_bazooka")
}

public 
fw_PlayerKilled_bazooka(victimattackershouldgib)
{                
    new 
name[32], players[32], ctalivesz_classname[32]
         
get_players(playersctalive"ae""CT")
     
    
entity_get_string(attackerEV_SZ_classnamesz_classnamecharsmax(sz_classname))
    
         if(
equal(sz_classname"rpgrocket") && is_valid_ent(attacker) && ctalive == 1
    {     
           
// Disabled the infinity round
           
RemoveBlockControl(RC_CheckWinConditionsg_pCheckWinHook)
           
           
// Force round to end
           
RoundEndForceControl(WINSTATUS_CT)
           
           
// Disabled friendly fire
           
set_pcvar_num(g_cvar_firefriend0)                    
         } 

wicho is offline
Reply


Thread Tools
Display Modes

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 01:56.


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