AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud Message Not Showing Properly (https://forums.alliedmods.net/showthread.php?t=57772)

Paulster1022 07-10-2007 23:41

Hud Message Not Showing Properly
 
Hey Guys, im having a problem that i can not figure out. I have 2 hud messages showing. One is a stealth meter and One is a camp meter. The stealth meter seems to work fine. The camp meter dissapears after seconds...and randomly comes back. I thought it would have been the hud channels but no its not. The stealth meter is some how interferring with the camp meter. I have tryed everything and im asking for some help. Maby the stealth meter is overwriting the camp meter or something. I am not sure but i know the stealth meter is interferring with the camp meter some how.

Stealth meter = HUD that is working properly
Code:

register_forward(FM_PlayerPreThink, "Forward_PlayerPreThink")


public Forward_PlayerPreThink(id)
{
    if(!is_user_alive(id))
        return FMRES_IGNORED
       
    set_hudmessage(0, 255, 0, -1.0, 0.79, 0, 6.0, 2.0, 0.0, 0.0, 1)
    if( pev( id, pev_button ) & IN_USE && !( pev( id, pev_oldbuttons ) & IN_USE ) )
        biteFunction(id)
   
 
    new target, body
    if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(g_flashlight[id])
        {
            get_user_aiming(id, target,body)
            if(get_entity_distance(id, target) < 500 && cs_get_user_team(target) == CS_TEAM_T)
                fakedamage ( target, "Flash Light Burn", 1.0, 1024 )
        }
    }
   
    if(cs_get_user_team(id) != CS_TEAM_T)
        return FMRES_IGNORED   
   
    new Float:Velocity[3]
    pev(id,pev_velocity,Velocity)
    new Float:Speed = Velocity[0] + Velocity[1] + Velocity[2],Modifier = Speed != 0.0 ? 1 : -1,Float:RenderAmount = float((g_LastRender[id] = clamp(g_LastRender[id] + Modifier,0,255)))
 
    set_pev(id,pev_renderfx,kRenderFxGlowShell)
    set_pev(id,pev_rendercolor,Float:{0.0,0.0,0.0})
    set_pev(id,pev_rendermode,kRenderTransAlpha)
    set_pev(id,pev_renderamt,RenderAmount)
    if(RenderAmount <= 0)
        ShowSyncHudMsg(id, g_MyMsgSync, "Stealth: Fully Invisible" )
    else
        ShowSyncHudMsg(id, g_MyMsgSync, "Stealth: %i / 255", floatround(RenderAmount) )
   
    return FMRES_IGNORED
 
}

Camp Meter = Hud Dissapears after seconds.
Code:

public meter_display(id)
{
        new displayMeter = get_pcvar_num(g_cvarDisplay);
       
        if (displayMeter > 0 && g_meter[id] >= displayMeter)
        {
                new r, g, b;
               
                if (g_meter[id] > 90)
                        r = 255;
                else if (g_meter[id] > 80)
                {
                        r = 255;
                        g = 100;
                }
                else if (g_meter[id] > 50)
                {
                        r = 255;
                        g = 255;
                }
                else if (g_meter[id] > 20)
                        g = 255;
                else
                        b = 255;
                set_hudmessage(r, g, b, 0.02, 0.90, 0, 1.0, 2.0, 0.1, 0.1, 4);
                ShowSyncHudMsg(id, g_campMeterMsgSync, "%L", id, "CAMP_METER", g_meter[id]);
               
                // if allowed and there's anyone specing this player, go ahead and show them the meter too
                if (g_cvarShowSpec)
                {
                        new playerCnt, players[MAX_PLAYER_CNT], id_spectator;
                        get_players(players, playerCnt, "bch");        // skip alive players, bots, and hltv
                        for (new playerIdx = 0; playerIdx < playerCnt; ++playerIdx)
                        {
                                id_spectator = players[playerIdx];
                               
                                if (pev(id_spectator, pev_iuser2) == id)
                                {
                                        ShowSyncHudMsg(id_spectator, g_campMeterMsgSync, "%L", id, "CAMP_METER", g_meter[id]);
                                }                               
                        }
                }
        }
}

If anyone could help me out that would be great. Thank you.

_Master_ 07-12-2007 12:07

Re: Hud Message Not Showing Properly
 
Please read documentation on Syncronized hud messages. There is info on hud channels as well.


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

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