This site is a testing version, but all data is shared with the live forum.


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

ZP 5.0 Problem HappyHour


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hn.S Xmix
Member
Join Date: May 2021
Old 05-13-2024 , 23:39   ZP 5.0 Problem HappyHour
Reply With Quote #1

Hello!

I have combain DateTime and Zm Score and GameMods and Happyhour in one plugin but the problem when HappyHour End it will switch between "Deactivated" and "Activated" every 1 second



i tried to fix that for like so long, can anyone fix it?

PHP Code:
#include <amxmodx>
#include <engine>
#include <zp50_colorchat>
#include <zombieplague>
#include <zp50_gamemodes>

#define PLUGIN "[ZP] Team win score"
#define VERSION "1.3"
#define AUTHOR "Ryokin"

#define TASK_ANOUNCE 05012015
#define TASK_UPDATE 06012014

new g_hhcvar_hh[3]

new 
g_zombiescoreg_humanscoreg_NoOneWing_hudcolor,g_hudposition g_hudmsg
new boolShowMeThisHud33 ]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_think("msg","ForwardThink")
    
register_event("TextMsg""RestartRound""a""2&#Game_C""2&#Game_w")
    
register_clcmd"say /hud""Say_showhud" )
    
register_clcmd"say /score""Say_showhud" )
    
    
g_NoOneWin register_cvar"zp_score_hud_win""1")
    
g_hudcolor register_cvar"zp_score_hud_color""255 125 0")
    
g_hudposition register_cvar"zp_score_hud_y_x""-1.0 0.02")
    
cvar_hh[0] = register_cvar("zp_score_happy_start""1")    // 01:00 AM
    
cvar_hh[1] = register_cvar("zp_score_happy_end""6")    // 06:00 AM 
    
cvar_hh[2] = register_cvar("zp_score_happy_multi""2")    // Reward x2
    
    
set_task(1.0 "hh_update"TASK_UPDATE_"b")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
g_hudmsg CreateHudSyncObj()
    new 
iEnt create_entity("info_target")
    
entity_set_string(iEntEV_SZ_classname"msg")
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 2.0)
}

public 
zp_round_ended(team)
{
    switch(
team)
    {
        case 
WIN_ZOMBIESg_zombiescore ++ 
        case 
WIN_HUMANSg_humanscore ++ 
        case 
WIN_NO_ONE
            if (
get_pcvar_num(g_NoOneWin))
                
g_humanscore ++
    }
}
public 
event_round_start() 
{
    new 
hmstart_hh max(get_pcvar_num(cvar_hh[0]), 0), end_hh max(get_pcvar_num(cvar_hh[1]), 0)
    
    if(
start_hh 24start_hh 0;
    if(
end_hh 24end_hh 0;
    if(
end_hh == start_hh)
    {
        
set_fail_state("[Happy Hour] The time it starts and the time it stops")
        return;
    }
    
time(hm)    
}

public 
hh_update() 
{
    new 
hmstart_hh max(get_pcvar_num(cvar_hh[0]), 0), end_hh max(get_pcvar_num(cvar_hh[1]), 0)
    
    if(
start_hh 24start_hh 0;
    if(
end_hh 24end_hh 0;
    if(
end_hh == start_hh)
    {
        
set_fail_state("[Happy Hour] The time it starts and the time it stops")
        return;
    }
    
    
time(hm)
    
    if(
g_hh
    {
        if(
start_hh end_hh && (<start_hh || >= end_hh)) stop_happy()
        else if(
end_hh <= start_hhstop_happy()
    }    
    else
    {
        if(
start_hh end_hh && start_hh <= end_hhstart_happy()
        else if(
start_hh <= || end_hhstart_happy()
    }
}

start_happy()
{
    if(!
g_hh)
    {    
        
g_hh true
        set_cvar_num
("zp_ammop_damage"get_cvar_num("zp_ammop_damage") * get_pcvar_num(cvar_hh[2]))
        
set_cvar_num("zp_ammop_human_infected"get_cvar_num("zp_ammop_human_infected") * get_pcvar_num(cvar_hh[2]))
        
set_cvar_num("zp_ammop_zombie_killed"get_cvar_num("zp_ammop_zombie_killed") * get_pcvar_num(cvar_hh[2]))
    }
}

stop_happy()
{
    
    if(
g_hh
    {
        
g_hh false
        set_cvar_num
("zp_ammop_damage"get_cvar_num("zp_ammop_damage") / get_pcvar_num(cvar_hh[2]))
        
set_cvar_num("zp_ammop_human_infected"get_cvar_num("zp_ammop_human_infected") / get_pcvar_num(cvar_hh[2]))
        
set_cvar_num("zp_ammop_zombie_killed"get_cvar_num("zp_ammop_zombie_killed") / get_pcvar_num(cvar_hh[2]))
    }
}
public 
client_putinserver(id)
{
    if (!
is_user_bot(id))
    {
        
// Set the custom HUD display task
        
set_task(1.0"show_hud"id__"b")
        }
    }
/*public ForwardThink(id,iEnt)
{
        Say_showhud(id,iEnt)
}*/
public Say_showhud(id,iEnt
{
    if( 
ShowMeThisHud[id] )
    {
    
ShowMeThisHud[id] = false
    show_hud
()
    
set_task(1.0"show_hud"id__"b")
            }
        else
        {
    
remove_task(id)
    
ShowMeThisHud[id] = true
    
}
}
public 
show_hud()
{
    new 
players[32], num
    
new ModeName[33]
    
get_players(playersnum"ah")
    
    new 
szDate[32], szTime[32]
    
get_time("%d/%m/%Y"szDatecharsmax(szDate))
    
get_time("%H:%M:%S"szTimecharsmax(szTime))
    
    for(new 
inumi++)
    if(
zp_gamemodes_get_current() == ZP_NO_GAME_MODE) return;

    
//static hud_red,hud_green,hud_blue, Float:hud_x, Float:hud_y

    
    
if(zp_gamemodes_get_current() == ZP_NO_GAME_MODE) return;
    
zp_gamemodes_get_name(zp_gamemodes_get_current(), ModeName32)
    
//-----
    
static hud_red,hud_green,hud_blueFloat:hud_xFloat:hud_y

    hudmsgcolor
(hud_red,hud_green,hud_blue)
    
hudmsgpos(hud_x,hud_y)
    
set_hudmessage(hud_redhud_greenhud_bluehud_xhud_y__1.0__4)
    
ShowSyncHudMsg(0g_hudmsg"[HappyHour: %s]^n[%d ZOMBIES] - [%s] - [HUMANS %d]^n[%s%d] -- [%s%d]^n %s - %s"g_hh "Activated" "Not Activated"fn_get_zombies(),ModeName,fn_get_humans(),g_zombiescore >= 10 "" "0",g_zombiescore,g_humanscore >= 10 "" "0"g_humanscore,szDateszTime)
}

public 
RestartRound()
{
    
g_zombiescore 0
    g_humanscore 
0
}

public 
hudmsgcolor(&hud_red,&hud_green,&hud_blue)
{
    new 
color[16], red[4], green[4], blue[4]
    
get_pcvar_string(g_hudcolorcolor15)
    
parse(colorred3green3blue3)
        
    
hud_red str_to_num(red)
    
hud_green str_to_num(green)
    
hud_blue str_to_num(blue)
}

public 
hudmsgpos(&Float:hud_x,&Float:hud_y)
{
    new 
Position[19], PositionX[6], PositionY[6]
    
get_pcvar_string(g_hudpositionPosition18)
    
parse(PositionPositionX6PositionY6)
    
    
hud_x str_to_float(PositionX)
    
hud_y str_to_float(PositionY)
}
fn_get_humans()
{
    static 
iAliveid
    iAlive 
0
    
    
for (id 1id <= 32id++)
    {
        if (
is_user_alive(id) && !zp_get_user_zombie(id))
            
iAlive++
    }
    
    return 
iAlive;
}

fn_get_zombies()
{
    static 
iAliveid
    iAlive 
0
    
    
for (id 1id <= 32id++)
    {
        if (
is_user_alive(id) && zp_get_user_zombie(id))
            
iAlive++
    }
    
    return 
iAlive;

Hn.S Xmix is offline
Hn.S Xmix
Member
Join Date: May 2021
Old 05-16-2024 , 23:35   Re: ZP 5.0 Problem HappyHour
Reply With Quote #2

Solved
Hn.S Xmix is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:44.


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