Raised This Month: $ Target: $400
 0% 

Solved Zombie Plugin Hud Problems


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-07-2020 , 13:34   Zombie Plugin Hud Problems
Reply With Quote #1

Hello my friends. I was working on a mod (zombie plague 5.0 based). But there is a problem like this. Whenever I try to add hud from client_PreThink, the hud of the bottom zp 5.0 disappears. This time does not come out if I add it elsewhere. So, my friends, what do we have to do about this? So you have an idea?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <cs_ham_bots_api>
#include <zombieplague>
#include <zp50_core>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>

#define PLUGIN "NST Zombie Class Tank"
#define VERSION "1.1 (2020)"
#define AUTHOR "NST (Based)/Me(fixed and modified)"

new const zclass_name[] = "Berserker"
new const zclass_info[] = "[G] > Berserk"
new const zclass_model[] = "tank_zombi_host"
new const zclass_clawmodel[] = "v_knife_tank_zombi.mdl"
const zclass_health 7000
const zclass_speed 280
const Float:zclass_gravity 0.8
const Float:zclass_knockback 1.5

new idclass
const Float:fastrun_time 10.0
const Float:fastrun_timewait 5.0
const Float:fastrun_speed 340.0
new const sound_fastrun_start[] = "zombie_plague/zombi_pressure.wav"
new const sound_fastrun_heartbeat[][] = {"zombie_plague/zombi_pre_idle_1.wav""zombie_plague/zombi_pre_idle_2.wav"}
const 
fastrun_fov 105
const glow_red 255
const glow_green 3
const glow_blue 0

new g_fastrun[33], g_fastrun_wait[33], g_had[33]

new 
g_msgSetFOV
new g_maxplayers
new g_roundend
new g_current_time[33]

#define g_time_fastrun 10
#define g_time_fastrunwait 5


enum (+= 100)
{
    
TASK_FASTRUN 2000,
    
TASK_FASTRUN_HEARTBEAT,
    
TASK_FASTRUN_WAIT,
    
TASK_BOT_USE_SKILL
}

#define ID_FASTRUN (taskid - TASK_FASTRUN)
#define ID_FASTRUN_HEARTBEAT (taskid - TASK_FASTRUN_HEARTBEAT)
#define ID_FASTRUN_WAIT (taskid - TASK_FASTRUN_WAIT)
#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
//register_event("CurWeapon","show_hud","be", "1=1")

    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("DeathMsg""Death""a")
    
register_event("CurWeapon","EventCurWeapon","be","1=1")
    
register_logevent("logevent_round_end"2"1=Round_End")
    
    
register_clcmd("drop""cmd_fastrun")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
RegisterHamBots(Ham_TakeDamage"fw_TakeDamage")
    
//register_forward(FM_CmdStart , "CmdStart")

    //g_msgSayText = get_user_msgid("SayText")
    
g_msgSetFOV get_user_msgid("SetFOV")
    
g_maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    new 
i
    
for(0sizeof sound_fastrun_heartbeati++ )
    {
        
precache_sound(sound_fastrun_heartbeat[i]);
    }
    
    
precache_sound(sound_fastrun_start)
    
    
idclass zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}

public 
client_putinserver(id)
{
    
g_had[id] = 0
    reset_value_player
(id)
}

public 
client_disconnect(id)
{
    
g_had[id] = 0
    reset_value_player
(id)
}

public 
event_round_start()
{
    
g_roundend 0
    
    
for (new id=1id<=g_maxplayersid++)
    {
        if (!
is_user_connected(id)) continue;
        
g_had[id] = 0
        reset_value_player
(id)
    }
}

public 
logevent_round_end()
{
    
g_roundend 1
}

public 
Death()
{
    new 
victim read_data(2
    
reset_value_player(victim)
}

public 
EventCurWeapon(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE;
    
    if(
g_fastrun[id]) set_user_maxspeed(idfastrun_speed);
    
    return 
PLUGIN_CONTINUE;
}

public 
zp_user_infected_post(id)
{
    
reset_value_player(id)
    
    if(
zp_get_user_nemesis(id)) return;
    
    if(
zp_get_user_zombie_class(id) == idclass)
    {
        if(
is_user_bot(id))
        {
            
g_current_time[id] = 100
            g_had
[id] = 1
            set_task
(random_float(15.0,20.0), "bot_use_skill"id+TASK_BOT_USE_SKILL)
            return
        }
        
        
//zp_colored_print(id, "^x04[ZP]^x01 Your skill is^x04 Sprint^x01. Cooldown^x04 %.1f ^x01seconds.", fastrun_timewait)
    
}
}

public 
zp_user_humanized_post(id)
{
    if(
g_fastrun[id]) EffectFastrun(id);
    
    
reset_value_player(id)
}

public 
zp_user_unfrozen(id)
{
    if(
g_fastrun[id]) set_user_rendering(idkRenderFxGlowShellglow_redglow_greenglow_bluekRenderNormal0)
}

public 
cmd_fastrun(id)
{
    if (
g_roundend && !g_had[id]) return PLUGIN_CONTINUE
    
    
if (!is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_nemesis(id)) return PLUGIN_CONTINUE

    
//new health = get_user_health(id) - fastrun_dmg
    
if (zp_get_user_zombie_class(id) == idclass && !g_fastrun[id] && !g_fastrun_wait[id])
    {
        
g_current_time[id] = 0
        g_fastrun
[id] = 1
        
        set_user_maxspeed
(idfastrun_speed)
        
set_user_rendering(idkRenderFxGlowShellglow_redglow_greenglow_bluekRenderNormal0)
        
EffectFastrun(idfastrun_fov)
        
PlayEmitSound(idsound_fastrun_start)
        
        
set_task(fastrun_time"RemoveFastRun"id+TASK_FASTRUN)
        
set_task(2.0"FastRunHeartBeat"id+TASK_FASTRUN_HEARTBEAT__"b")

        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
bot_use_skill(taskid)
{
    new 
id ID_BOT_USE_SKILL
    
    
if (!is_user_alive(id)) return;

    
cmd_fastrun(id)
    
    
set_task(random_float(5.0,15.0), "bot_use_skill"id+TASK_BOT_USE_SKILL)
}

public 
RemoveFastRun(taskid)
{
    new 
id ID_FASTRUN

    g_fastrun
[id] = 0
    g_fastrun_wait
[id] = 1
    set_user_maxspeed
(idfloat(zclass_speed))
    
set_user_rendering(id)
    
EffectFastrun(id)
    
    
set_task(fastrun_timewait"RemoveWaitFastRun"id+TASK_FASTRUN_WAIT)
}

public 
RemoveWaitFastRun(taskid)
{
    new 
id ID_FASTRUN_WAIT
    
    g_fastrun_wait
[id] = 0
    
    
//zp_colored_print(id, "^x04[ZP]^x01 Your skill^x04 Sprint^x01 is ready.")
}

public 
FastRunHeartBeat(taskid)
{
    new 
id ID_FASTRUN_HEARTBEAT
    
    
if (g_fastrun[id]) PlayEmitSound(idsound_fastrun_heartbeat[random_num(0sizeof sound_fastrun_heartbeat 1)]);
    else 
remove_task(taskid)
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id) || !g_had[id] && !zp_get_user_zombie(id))
        return

    
    if(
g_fastrun_wait[id])
    {
        
set_dhudmessage(2501600, -1.00.2502.010.00.11.5)
        
//set_dhudmessage(200, 200, 0, -1.0, 0.25, 0, 0.0, 0.0, 0.0, 0.0)
        //set_hudmessage(200, 200, 0, -1.0 , 0.25, 0, 0.1, 0.1,0.1)
        
show_dhudmessage(id"[G] -> Berserk (Waiting for %i seconds...)"g_time_fastrunwait)
    }
    else if(
g_fastrun[id]) {
        
set_dhudmessage(25000, -1.00.2502.010.00.11.5)
        
//set_dhudmessage(200, 0, 0, -1.0, 0.25, 0, 0.0, 0.0, 0.0, 0.0)
        //set_hudmessage(200, 0, 0, -1.0, 0.25, 0, 0.1, 0.1, 0.1)
        
show_dhudmessage(id"[G] -> Berserk (Active)")
    }
    else {
        
set_dhudmessage(01600, -1.00.2502.010.00.11.5)
        
//set_dhudmessage(0, 200, 0, -1.0, 0.25, 0, 0.0, 0.0, 0.0, 0.0)
        //set_hudmessage(0, 200, 0, -1.0, 0.25, 0, 0.1, 0.1, 0.1)
        
show_dhudmessage(id"[G] -> Berserk (Ready)")
    }
}

/*public CmdStart(id, UC_Handle, seed)
{
    if(!is_user_alive(id))
        return
    if(!zp_get_user_zombie(id) || !g_had[id])
        return
    
    static Float:CurrentTime, Float:g_hud_delay[33]
    CurrentTime = get_gametime()
    
    if(CurrentTime - 1.0 > g_hud_delay[id])
    {
        show_hud(id)
        if(pev(id, pev_solid) == SOLID_NOT)
            set_pev(id, pev_solid, SOLID_BBOX)
        
        g_hud_delay[id] = CurrentTime
    }
}*/

PlayEmitSound(id, const sound[])
{
    
emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
}

EffectFastrun(idnum 90)
{
    
message_begin(MSG_ONEg_msgSetFOV, {0,0,0}, id)
    
write_byte(num)
    
message_end()
}

reset_value_player(id)
{
    
g_current_time[id] = 0
    g_had
[id] = 0
    g_fastrun
[id] = 0
    g_fastrun_wait
[id] = 0
    set_user_rendering
(idkRenderFxGlowShell000kRenderNormal0)
    
remove_task(id+TASK_FASTRUN)
    
remove_task(id+TASK_FASTRUN_HEARTBEAT)
    
remove_task(id+TASK_FASTRUN_WAIT)
    
remove_task(id+TASK_BOT_USE_SKILL)
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_alive(attacker))
        return 
HAM_IGNORED;
    
    
// Human attacking zombie...
    
if (!zp_core_is_zombie(attacker) && zp_core_is_zombie(victim) && g_had[victim])
    {
        
// Ignore for Nemesis
        
if (LibraryExists(LIBRARY_NEMESISLibType_Library) && zp_class_nemesis_get(attacker))
            return 
HAM_IGNORED;
        
        
// Armor multiplier for the final damage
        
SetHamParamFloat(4g_fastrun[victim] ? damage 2.27 damage 1.45)
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;

This Video. (For friends who don't understand.)
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]

Last edited by ZombieTheMan01; 07-15-2020 at 10:11. Reason: I wrote PostThink instead of PreThink.
ZombieTheMan01 is offline
 



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 16:54.


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