AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ZP Kill bomb for humans (https://forums.alliedmods.net/showthread.php?t=332903)

Ssand 06-07-2021 12:35

ZP Kill bomb for humans
 
Hello everyone, i found this plugin (kill bomb for humans) and when I wanted to test how it works, I found it's just a light bomb, it's not a kill bomb.
can anyone fix it to me please or any help
thanks.

MOD ZP 4.4

PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <zombieplague>

#define PLUGIN "ZP Extra KillBomb NewWay"
#define VERSION "1.0.0"
#define AUTHOR "yokomo"

const Float:NADE_EXPLOSION_RADIUS 240.0
const PEV_NADE_TYPE pev_flTimeStepSound
const NADE_TYPE_KILLBOMB 6669

const COLOR_R 237
const COLOR_G 60
const COLOR_B 202

const BUY_LIMIT 10

new const ITEM_NAME[] = "Kill Bomb"
new const ITEM_COST 55

new const MODEL_P[] = "models/zombie_plague/p_kill_bomb_humans.mdl"
new const MODEL_V[] = "models/zombie_plague/v_kill_bomb_humans.mdl"
new const MODEL_W[] = "models/zombie_plague/w_kill_bomb_humans.mdl"

new const SPRITES_TRAIL[] = "sprites/laserbeam.spr"
new const SPRITES_EXPLODE[] = "sprites/blue.spr"

new const SOUND_BUY[] = "zombie_plague/killbomb_buy.wav"
new const SOUND_EXPLODE[] = "zombie_plague/killbomb_exp.wav"

new g_itemid_killbombg_killbomb_spr_trailg_killbomb_spr_expg_maxplayersg_roundendg_killbombbuycount
new g_haskillbomb[33], g_killedbykillbomb[33]
new 
cvar_bonushpcvar_nemfree

public plugin_precache()
{
    
precache_model(MODEL_P)
    
precache_model(MODEL_V)
    
precache_model(MODEL_W)
    
    
g_killbomb_spr_trail precache_model(SPRITES_TRAIL)
    
g_killbomb_spr_exp precache_model(SPRITES_EXPLODE)
    
    
precache_sound(SOUND_BUY)
    
precache_sound(SOUND_EXPLODE)
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""EventHLTV""a""1=0""2=0")
    
register_event("DeathMsg""EventDeathMsg""a")
    
register_event("CurWeapon""EventCurWeapon""be""1=1")
    
register_logevent("logevent_round_end"2"1=Round_End")
    
register_message(get_user_msgid("DeathMsg"), "MessageDeathMsg")
    
    
register_forward(FM_SetModel"fw_SetModel")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")
    
    
cvar_bonushp register_cvar("zp_killbomb_hp","10000")
    
cvar_nemfree register_cvar("zp_killbomb_nem","1")
    
    
g_maxplayers get_maxplayers()
    
g_itemid_killbomb zp_register_extra_item(ITEM_NAMEITEM_COSTZP_TEAM_HUMAN)
}

public 
client_putinserver(idg_haskillbomb[id] = 0

public client_disconnect(idg_haskillbomb[id] = 0

public EventHLTV()
{
    
g_killbombbuycount 0
    
    
for(new id 1id <= g_maxplayersid++)
    {
        if(
is_user_connected(id)) g_haskillbomb[id] = 0
    
}    
}

public 
EventDeathMsg()
{
    new 
id read_data(2)
    if(
is_user_connected(id)) g_haskillbomb[id] = 0
}

public 
EventCurWeapon(id)
{
    if(
g_haskillbomb[id])
    {
        if(
get_user_weapon(id) == CSW_SMOKEGRENADE)
        {
            
set_pev(idpev_viewmodel2MODEL_V)
            
set_pev(idpev_weaponmodel2MODEL_P)
        }
    }
}

public 
MessageDeathMsg(msg_idmsg_destid)
{
    static 
attackervictim
    attacker 
get_msg_arg_int(1)
    
victim get_msg_arg_int(2)
    
    if(!
is_user_connected(attacker) || attacker == victim) return PLUGIN_CONTINUE
    
    
if(g_killedbykillbomb[victim]) set_msg_arg_string(4"grenade")
    
    return 
PLUGIN_CONTINUE
}

public 
logevent_round_end() g_roundend 1

public zp_round_started() g_roundend 0

public zp_extra_item_selected(iditem)
{
    if(
item == g_itemid_killbomb)
    {
        if(
g_roundend)
        {
            
client_print(idprint_chat"[ZP] Item not available at this time.")
            return 
ZP_PLUGIN_HANDLED
        
}
        if(
g_killbombbuycount >= BUY_LIMIT)
        {
            
client_print(idprint_chat"[ZP] Maximum usage has been reach (max: %i)."BUY_LIMIT)
            return 
ZP_PLUGIN_HANDLED
        
}
        if(
user_has_weapon(idCSW_SMOKEGRENADE))
        {
            
client_print(idprint_chat"[ZP] Current grenade slot is full (SmokeGrenade).")
            return 
ZP_PLUGIN_HANDLED
        
}
        if(
g_haskillbomb[id])
        {
            
client_print(idprint_chat"[ZP] You already have a %s."ITEM_NAME)
            return 
ZP_PLUGIN_HANDLED
        
}
        
        
g_killbombbuycount += 1
        g_haskillbomb
[id] = 1
        give_item
(id"weapon_smokegrenade")
        
client_print(idprint_chat"[ZP] You have bought a %s."ITEM_NAME)
        
emit_sound(idCHAN_VOICESOUND_BUY1.0ATTN_NORM0PITCH_NORM)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
zp_user_infected_post(id)
{
    if(
zp_get_user_nemesis(id) && get_pcvar_num(cvar_nemfree))
    {
        
g_haskillbomb[id] = 1
        give_item
(id"weapon_smokegrenade")
        
client_print(idprint_center"*** You got a %s, enjoy killing humans ***"ITEM_NAME)
    }
}

public 
zp_user_humanized_post(idg_haskillbomb[id] = 0

public fw_SetModel(entity, const model[])
{
    if(!
pev_valid(entity)) return FMRES_IGNORED
    
    
static Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    if(
dmgtime == 0.0) return FMRES_IGNORED
    
    
static ownerowner pev(entitypev_owner)
    if(
g_haskillbomb[owner] && equal(model[7], "w_sm"4))
    {
        
set_rendering(entitykRenderFxGlowShellCOLOR_RCOLOR_GCOLOR_BkRenderNormal0)
            
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMFOLLOW)
        
write_short(entity)
        
write_short(g_killbomb_spr_trail)
        
write_byte(10)
        
write_byte(3)
        
write_byte(COLOR_R)
        
write_byte(COLOR_G)
        
write_byte(COLOR_B)
        
write_byte(192)
        
message_end()
        
        
set_pev(entityPEV_NADE_TYPENADE_TYPE_KILLBOMB)
        
engfunc(EngFunc_SetModelentityMODEL_W)
        
g_haskillbomb[owner] = 0
        
        
return FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED
}

public 
fw_ThinkGrenade(entity)
{
    if(!
pev_valid(entity)) return HAM_IGNORED
    
    
static Float:dmgtimeFloat:current_time
    pev
(entitypev_dmgtimedmgtime)
    
current_time get_gametime()
    
    if(
dmgtime current_time) return HAM_IGNORED
    
    
if(pev(entityPEV_NADE_TYPE) == NADE_TYPE_KILLBOMB)
    {
        
KillBombExplode(entity)
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED
}

KillBombExplode(ent)
{
    if (
g_roundend) return
    
    static 
Float:originF[3]
    
pev(entpev_originoriginF)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
write_coord(floatround(originF[0]))
    
write_coord(floatround(originF[1]))
    
write_coord(floatround(originF[2]))
    
write_short(g_killbomb_spr_exp)
    
write_byte(40)
    
write_byte(30)
    
write_byte(14)
    
message_end()
    
    
emit_sound(entCHAN_WEAPONSOUND_EXPLODE1.0ATTN_NORM0PITCH_NORM)
    
    static 
attacker
    attacker 
pev(entpev_owner)
    if (!
is_user_connected(attacker))
    {
        
engfunc(EngFunc_RemoveEntityent)
        return
    }
    
    static 
victim
    victim 
= -1
    
    
while((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFNADE_EXPLOSION_RADIUS)) != 0)
    {
        if(!
is_user_alive(victim) || !zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))
            continue
        
        
g_killedbykillbomb[victim] = 1
        ExecuteHamB
(Ham_Killedvictimattacker0)
        
g_killedbykillbomb[victim] = 0
        
        
static healthhealth get_user_health(attacker)
        
set_user_health(attackerhealth+get_pcvar_num(cvar_bonushp))
    }
    
    
engfunc(EngFunc_RemoveEntityent)



CrazY. 06-07-2021 19:13

Re: ZP Kill bomb for humans
 
That's probably happening because zombie mod is also replacing the smoke grenade. Try to enable the kill bomb plugin before the zombie one.

Ssand 06-08-2021 05:30

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by CrazY. (Post 2749204)
That's probably happening because zombie mod is also replacing the smoke grenade. Try to enable the kill bomb plugin before the zombie one.

What do u mean about enable the kill bomb plugin ?
can u explain more please.

Ssand 06-08-2021 05:44

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by CrazY. (Post 2749204)
That's probably happening because zombie mod is also replacing the smoke grenade. Try to enable the kill bomb plugin before the zombie one.

it's a little weird because it worked once and when it killed zombies i got 10k health and that is bug
idk what how to fix it.

Celena Luna 06-08-2021 06:16

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by Ssand (Post 2749243)
it's a little weird because it worked once and when it killed zombies i got 10k health and that is bug
idk what how to fix it.

It is not a bug. That is how it work
What the plugin does is the nade will kill 1 random Zombie in range and give the killer 10000 HP (HP Cvar: zp_killbomb_hp)

If you still have the default Flare Nade plugin of ZP running, disable it
Both use Smoke Grenade so it got overlap.

PHP Code:

    while((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFNADE_EXPLOSION_RADIUS)) != 0)
    {
        if(!
is_user_alive(victim) || !zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))
            continue
        
        
g_killedbykillbomb[victim] = 1
        ExecuteHamB
(Ham_Killedvictimattacker0)
        
g_killedbykillbomb[victim] = 0
        
        
static healthhealth get_user_health(attacker)
        
set_user_health(attackerhealth+get_pcvar_num(cvar_bonushp))
    } 


Ssand 06-08-2021 10:26

Re: ZP Kill bomb for humans
 
Yes guys is true, thanks Crazy and Celena, but how do I make them both work?
and without give hp when kill zombies.

Ssand 06-08-2021 10:44

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by Celena Luna (Post 2749244)
It is not a bug. That is how it work
What the plugin does is the nade will kill 1 random Zombie in range and give the killer 10000 HP (HP Cvar: zp_killbomb_hp)

If you still have the default Flare Nade plugin of ZP running, disable it
Both use Smoke Grenade so it got overlap.

PHP Code:

    while((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFNADE_EXPLOSION_RADIUS)) != 0)
    {
        if(!
is_user_alive(victim) || !zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))
            continue
        
        
g_killedbykillbomb[victim] = 1
        ExecuteHamB
(Ham_Killedvictimattacker0)
        
g_killedbykillbomb[victim] = 0
        
        
static healthhealth get_user_health(attacker)
        
set_user_health(attackerhealth+get_pcvar_num(cvar_bonushp))
    } 


i got a problem, it works in two rounds or one and then it comes back as a light, but it doesn't turn on even though Flare Nade is disabled.

Ssand 06-09-2021 04:06

Re: ZP Kill bomb for humans
 
how can I make them both work?
Kill bomb and Flare Nade because i dont want disable Flare Nade.

Celena Luna 06-14-2021 00:53

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by Ssand (Post 2749307)
how can I make them both work?
Kill bomb and Flare Nade because i dont want disable Flare Nade.

You have to sacrificed Flame, Frost or Flare for this Kill bomb to work

Ssand 06-14-2021 04:22

Re: ZP Kill bomb for humans
 
Quote:

Originally Posted by Celena Luna (Post 2749678)
You have to sacrificed Flame, Frost or Flare for this Kill bomb to work

but there is no other way for everything to work or if there is another kill bomb plugin works fine without sacrificed.


All times are GMT -4. The time now is 21:51.

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