Raised This Month: $ Target: $400
 0% 

Spectator Hud help - prokreedz


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
DarkGL
Senior Member
Join Date: Aug 2010
Location: Warsaw, Poland
Old 06-22-2011 , 12:05   Re: Spectator Hud help - prokreedz
Reply With Quote #2

always without checking cvar
Code:
public timer_task()
{
    for(new i=1;i<=MaxPlayers;i++)
    {
            if (is_user_alive(i))
            {
                if( is_user_connected(i) && timer_started[i])
                {
                    new Float:kreedztime = get_gametime() - (IsPaused[i] ? get_gametime() - g_pausetime[i] : timer_time[i])

                    if( ShowTime[i] == 1 )
                    {
                        new colors[12], r[4], g[4], b[4];
                        new imin = floatround(kreedztime / 60.0,floatround_floor)
                        new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
                        get_pcvar_string(kz_hud_color, colors, 11)
                        parse(colors, r, 3, g, 3, b, 4)
                        
                        set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, -1)    
                        show_hudmessage(i, "Time: %02d:%02d  | CPs: %d | TPs: %d ",imin, isec,checknumbers[i], gochecknumbers[i]) 
                    }
                    else
                    if( ShowTime[i] == 2 )
                    {
                        kz_showtime_roundtime(i, floatround(kreedztime))
                    }
                }
                
                if( get_pcvar_num(kz_godmode) == 1 )
                    set_user_godmode(i, 1)
                else
                    set_user_godmode(i, 0)
            }
            else //Here is the Spec HUD
            {
                new specmode = pev(i, pev_iuser1)
                if(specmode == 2 || specmode == 4)
                {
                    new target = pev(i, pev_iuser2)
                    if(target != i)
                        if(is_user_alive(target) && timer_started[target])
                        {
                            new name[32], colors[12], r[4], g[4], b[4];
                            get_user_name (target, name, 31)

                            new Float:kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
                            new imin = floatround(kreedztime / 60.0,floatround_floor)
                            new isec = floatround(kreedztime - imin * 60.0,floatround_floor)

                            get_pcvar_string(kz_hud_color, colors, 11)
                            parse(colors, r, 3, g, 3, b, 4)

                            set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, -1)
                            show_hudmessage(i, "Time: %02d:%02d  | CPs: %d | TPs: %d %s ",imin, isec, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")     
                        }
                }
            }
    }
}

or when cvar is diffrent from 0
Code:
public timer_task()
{
    for(new i=1;i<=MaxPlayers;i++)
    {
        if ( get_pcvar_num(kz_show_timer)) // Only do the code if the Cvar is 1..
        {
            if (is_user_alive(i))
            {
                if( is_user_connected(i) && timer_started[i])
                {
                    new Float:kreedztime = get_gametime() - (IsPaused[i] ? get_gametime() - g_pausetime[i] : timer_time[i])

                    if( ShowTime[i] == 1 )
                    {
                        new colors[12], r[4], g[4], b[4];
                        new imin = floatround(kreedztime / 60.0,floatround_floor)
                        new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
                        get_pcvar_string(kz_hud_color, colors, 11)
                        parse(colors, r, 3, g, 3, b, 4)
                        
                        set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, -1)    
                        show_hudmessage(i, "Time: %02d:%02d  | CPs: %d | TPs: %d ",imin, isec,checknumbers[i], gochecknumbers[i]) 
                    }
                    else
                    if( ShowTime[i] == 2 )
                    {
                        kz_showtime_roundtime(i, floatround(kreedztime))
                    }
                }
                
                if( get_pcvar_num(kz_godmode) == 1 )
                    set_user_godmode(i, 1)
                else
                    set_user_godmode(i, 0)
            }
            else //Here is the Spec HUD
            {
                new specmode = pev(i, pev_iuser1)
                if(specmode == 2 || specmode == 4)
                {
                    new target = pev(i, pev_iuser2)
                    if(target != i)
                        if(is_user_alive(target) && timer_started[target])
                        {
                            new name[32], colors[12], r[4], g[4], b[4];
                            get_user_name (target, name, 31)

                            new Float:kreedztime = get_gametime() - (IsPaused[target] ? get_gametime() - g_pausetime[target] : timer_time[target])
                            new imin = floatround(kreedztime / 60.0,floatround_floor)
                            new isec = floatround(kreedztime - imin * 60.0,floatround_floor)

                            get_pcvar_string(kz_hud_color, colors, 11)
                            parse(colors, r, 3, g, 3, b, 4)

                            set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, -1)
                            show_hudmessage(i, "Time: %02d:%02d  | CPs: %d | TPs: %d %s ",imin, isec, checknumbers[target], gochecknumbers[target], IsPaused[target] ? "| *Paused*" : "")     
                        }
                }
            }
        }
    }
}
DarkGL 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 23:34.


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