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

D7 HUD Info


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-21-2024 , 09:48   D7 HUD Info
Reply With Quote #1

D i 5 7 i n c T's HUD Info




Simple multiple HUD info plugin that can display any information in any style you want, with the ability to also display dynamic multilingual info such as real time server FPS, time left, player & round count, current server time, etc.

Runs on any GoldSource(Half-Life 1) engine game.

Short videos:







CVar list(they are self explanatory):
PHP Code:
// Interval between HUD refreshes
D7HUDInfoInterval 1.0

// HUD 1 type. 1 is normal HUD and 2 is DHUD.
D7HUDInfoType1 2

// HUD 2 type
D7HUDInfoType2 1

// HUD colors:
// HUD1 alive players R G B, HUD1 dead players R G B
// HUD2 alive players R G B, HUD2 dead players R G B
// If any HUD2 color is not set, it will use the color from HUD1
// -1 will generate a random amount for the given color
// Having all R, G and B set to -1 will generate saturated and visible colors
// A value smaller than -1 will random the amount between 0 and the negated value minus one
// Example: -129 will random an amount between 0 and 128
D7HUDInfoColor "-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1"

// HUD colors:
// HUD1 alive players X Y, HUD1 dead players X Y
// HUD2 alive players X Y, HUD2 dead players X Y
// If any HUD2 position is not set, it will use the position from HUD1
D7HUDInfoPos "-1.0 0.0 -1.0 0.13 -1.0 0.035 -1.0 0.165"

// HUD texts to display. Variables:
// $name$ - Server name
// $fps$ - Server FPS
// $pnum$ - Current connected player count
// $pmax$ - Max players. Will try to use sv_visiblemaxplayers CVar value if it is not set to -1.
// $Lmap$ - Current map multilingual
// $map$ - Current map name
// $Ltimel$ - Time left multilingual
// $timel$ - Time left
// $Lround$ - Round number multilingual
// $round$ - Round number
// $roundmax$ - Max rounds(mp_maxrounds)
// $Lmapn$ - Next map multilingual
// $mapn$ - Next map name(amx_nextmap)
// $timeh$ - Current server time hour
// $timem$ - Current server time minute
// $times$ - Current server time second
//
// Use ^n for new line
// Leave blank to disable the corresponding HUD
D7HUDInfoText "$name$ | FPS: $fps$ | $pnum$/$pmax$"
D7HUDInfoText2 "$Lmap$: $map$ | $Ltimel$: $timel$ | $Lround$: $round$/$roundmax$ | $Lmapn$: $mapn$ | $timeh$:$timem$:$times$" 



miscstats.txt
nextmap.txt
timeleft.txt





This plug-in requires the following:
- BitSum stocks include file (bitsums.inc). Attached along below.
- DHUD messages include file (dhudmessage.inc)(only if compiling with AMXX 1.8.2 or older). Attached along below.

Get source and compile locally.




dorin2oo7 - For his images I used to style up my post.
NiHiLaNTh, schmurgel1983, KliPPy, meTaLiCroSS, Hedgehog Fog - For being true friends and always helping and teaching me new stuff.




Code:
T = needs testing
X = done
- = cancelled

[T] make randoming from 0 possible
[T] decide whether to go to the new line for player count through the extra info cvar
[T] support hud refresh rate 0.1 and calculate hud hold time properly
[T] customizable new line after host name or not
[T] change host name into an int cvar instead of string for optimization
v0.0.6
[T] rewrite
v1.0.0
[T] client_disconnected for AMXX_VERSION_NUM >= 182
[T] fix runtime error 5 memory access
[T] fix interval cvar change not showing hud anymore
[T] fix round count not changing until freezetime is over
[T] random color number base on 64 instead of 51 ?
[X] check if client fps detection works properly
[T] g_iIDTaskHUD to avoid any interference
v1.0.6
[T] use alive hud colors and positions if dead not present
[T] have final color before setting hud
[T] fix wrong color being used for hud 2 alive
v1.0.9
[ ] better way of checking if the dhudmessage is already defined through a native or not
[ ] cvars for hud properties
[ ] optimize
[ ] cfg file
[ ] fixed channel for set_hudmessage ?


Code(for easy readability):
PHP Code:
#include <amxmodx>
#include <engine>

#include <bitsums>
#if AMXX_VERSION_NUM <= 182//!defined set_dhudmessage
#include <dhudmessage>
#endif



enum (+= 33)
{
    
g_iIDTaskHUD 32
}

new 
g_iIDPCVarIntervalg_iIDPCVarType1g_iIDPCVarType2g_iIDPCVarColorg_iIDPCVarPosg_iIDPCVarTextg_iIDPCVarText2g_iFPSSVg_iFPSCl[33], g_iBsBot,
g_iIDPCVarHostNameg_iIDPCVarMaxPlayersVisg_iIDPCVarMaxRoundsg_iIDPCVarNextMapg_iRoundg_iMaxPlayersg_szMap[32];


public 
plugin_init()
{
    
register_plugin("D7 HUD Info""1.0.9""D i 5 7 i n c T")
    
    
register_dictionary("miscstats.txt")
    
register_dictionary("nextmap.txt")
    
register_dictionary("timeleft.txt")
    
    
//register_logevent("fwEvLogRoundStart", 2, "1=Round_Start")
    
register_event("HLTV""fwEventHltvRoundStart""a""1=0""2=0")
    
register_event("TextMsg""fwEvTextCommenceRestart""a""2=#Game_Commencing""2=#Game_will_restart_in");
    
    
g_iIDPCVarInterval register_cvar("D7HUDInfoInterval""1.0");
    
g_iIDPCVarType1 register_cvar("D7HUDInfoType1""2");
    
g_iIDPCVarType2 register_cvar("D7HUDInfoType2""1");
    
g_iIDPCVarColor register_cvar("D7HUDInfoColor""-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1");
    
g_iIDPCVarPos register_cvar("D7HUDInfoPos""-1.0 0.0 -1.0 0.13 -1.0 0.035 -1.0 0.165");
    
g_iIDPCVarText register_cvar("D7HUDInfoText""$name$ | FPS: $fps$ | $pnum$/$pmax$");
    
g_iIDPCVarText2 register_cvar("D7HUDInfoText2""$Lmap$: $map$ | $Ltimel$: $timel$ | $Lround$: $round$/$roundmax$ | $Lmapn$: $mapn$ | $timeh$:$timem$:$times$");
    
    
g_iIDPCVarHostName get_cvar_pointer("hostname");
    
g_iIDPCVarMaxPlayersVis get_cvar_pointer("sv_visiblemaxplayers");
    
g_iIDPCVarMaxRounds get_cvar_pointer("mp_maxrounds");
    
g_iIDPCVarNextMap get_cvar_pointer("amx_nextmap");
    
    
g_iMaxPlayers get_maxplayers();
    
    
get_mapname(g_szMapcharsmax(g_szMap))
    
    
set_task(3.0"fwTaskHUD"g_iIDTaskHUD""31)
}

public 
fwEventHltvRoundStart()
    
g_iRound++;

public 
fwEvTextCommenceRestart()
    
g_iRound 0;

public 
server_frame()
    
g_iFPSSV++;

public 
client_authorized(iID)
{
    if (
is_user_bot(iID))
        
bitsum_add(g_iBsBotiID)
    else
        
g_iFPSCl[iID] = 0;
}

#if AMXX_VERSION_NUM <= 182
public client_disconnect(iID)
#else
public client_disconnected(iID)
#endif
    
bitsum_del(g_iBsBotiID)

public 
client_PreThink(iID)
{
    if (!
bitsum_get(g_iBsBotiID))
        
g_iFPSCl[iID]++;
}

public 
fwTaskHUD(szTemp[32], iIDTask)
{
    new 
Float:fTemp get_pcvar_float(g_iIDPCVarInterval);
    
    if (!
szTemp[0] || fTemp != str_to_float(szTemp))
    {
        
remove_task(g_iIDTaskHUD)
        
        
float_to_str(fTempszTempcharsmax(szTemp))
        
        
set_task(fTemp"fwTaskHUD"g_iIDTaskHUDszTempcharsmax(szTemp), "b")
        
        
g_iFPSSV 0;
        
g_iFPSCl "";
        
        return;
    }
    
    new 
iNumiIDsPlayersDead[32], iNum2i;
    
    
// alive
    
get_players(szTempiNum"ach")
    
get_players(iIDsPlayersDeadiNum2"bch"// dead
    
    
for (iNum 1>= 0i--)
    {
        if (
g_iFPSCl[szTemp[i]] >= 40)
        {
            
g_iFPSCl[szTemp[i]] = 0;
            
            continue;
        }
        
        
g_iFPSCl[szTemp[i]] = 0;
        
        
iNum--;
    }
    
    for (
iNum2 1>= 0i--)
    {
        if (
g_iFPSCl[iIDsPlayersDead[i]] >= 40)
        {
            
g_iFPSCl[iIDsPlayersDead[i]] = 0;
            
            continue;
        }
        
        
g_iFPSCl[iIDsPlayersDead[i]] = 0;
        
        
iNum2--;
    }
    
    if (!
iNum && !iNum2)
        return;
    
    new 
szTemp2[6][10], szTemp3[64], iRiGiBiR2iG2iB2Float:fPosYFloat:fPosZFloat:fPosY2Float:fPosZ2iCVarTypeszCVarText[175], szMessage[sizeof szCVarText];
    
    
get_pcvar_string(g_iIDPCVarTextszCVarTextcharsmax(szCVarText))
    
    if (!
szCVarText[0])
        goto 
GoToHUD2;
    
    
get_pcvar_string(g_iIDPCVarColorszMessagecharsmax(szMessage))
    
parse(szMessageszTemp2[0], charsmax(szTemp2[]), szTemp2[1], charsmax(szTemp2[]), szTemp2[2], charsmax(szTemp2[]), szTemp2[3], charsmax(szTemp2[]), szTemp2[4], charsmax(szTemp2[]), szTemp2[5], charsmax(szTemp2[]))
    
    
iR str_to_num(szTemp2[0]);
    
iG str_to_num(szTemp2[1]);
    
iB str_to_num(szTemp2[2]);
    
    if (
iR == -&& iG == -&& iB == -1)
    {
        
random_num(02)
        
        if (
== 0)
        {
            
iR 255;
            
            if (!
random_num(01))
            {
                
iG 0;
                
iB 64 random_num(14);
            }
            else
            {
                
iG 64 random_num(14);
                
iB 0;
            }
        }
        else if (
== 1)
        {
            
iG 255;
            
            if (!
random_num(01))
            {
                
iR 0;
                
iB 64 random_num(14);
            }
            else
            {
                
iR 64 random_num(14);
                
iB 0;
            }
        }
        else if (
== 2)
        {
            
iB 255;
            
            if (!
random_num(01))
            {
                
iR 0;
                
iG 64 random_num(14);
            }
            else
            {
                
iR 64 random_num(14);
                
iG 0;
            }
        }
        
        if (
iR 255)
            
iR 255
        
        
if (iG 255)
            
iG 255
        
        
if (iB 255)
            
iB 255
    
}
    else
    {
        if (
iR 0)
            
iR random_num(-iR 1255)
        
        if (
iG 0)
            
iG random_num(-iG 1255)
        
        if (
iB 0)
            
iB random_num(-iB 1255)
    }
    
    if (
szTemp2[3][0])
        
iR2 str_to_num(szTemp2[3]);
    else
        
iR2 iR;
    
    if (
szTemp2[4][0])
        
iG2 str_to_num(szTemp2[4]);
    else
        
iG2 iG;
    
    if (
szTemp2[5][0])
        
iB2 str_to_num(szTemp2[5]);
    else
        
iB2 iB;
    
    if (
iR2 == -&& iG2 == -&& iB2 == -1)
    {
        
random_num(02)
        
        if (
== 0)
        {
            
iR2 255;
            
            if (!
random_num(01))
            {
                
iG2 0;
                
iB2 64 random_num(14);
            }
            else
            {
                
iG2 64 random_num(14);
                
iB2 0;
            }
        }
        else if (
== 1)
        {
            
iG2 255;
            
            if (!
random_num(01))
            {
                
iR2 0;
                
iB2 64 random_num(14);
            }
            else
            {
                
iR2 64 random_num(14);
                
iB2 0;
            }
        }
        else if (
== 2)
        {
            
iB2 255;
            
            if (!
random_num(01))
            {
                
iR2 0;
                
iG2 64 random_num(14);
            }
            else
            {
                
iR2 64 random_num(14);
                
iG2 0;
            }
        }
        
        if (
iR2 255)
            
iR2 255
        
        
if (iG2 255)
            
iG2 255
        
        
if (iB2 255)
            
iB2 255
    
}
    else
    {
        if (
iR2 0)
            
iR2 random_num(-iR2 1255)
        
        if (
iG2 0)
            
iG2 random_num(-iG2 1255)
        
        if (
iB2 0)
            
iB2 random_num(-iB2 1255)
    }
    
    
//client_print(0, print_chat, "[HUD1] Color alive: %d %d %d. Color dead: %d %d %d.", iR, iG, iB, iR2, iG2, iB2)
    
    
get_pcvar_string(g_iIDPCVarPosszMessagecharsmax(szMessage))
    
parse(szMessageszTemp2[0], charsmax(szTemp2[]), szTemp2[1], charsmax(szTemp2[]), szTemp2[2], charsmax(szTemp2[]), szTemp2[3], charsmax(szTemp2[]))
    
    
fPosY str_to_float(szTemp2[0]);
    
fPosZ str_to_float(szTemp2[1]);
    
    if (
szTemp2[2][0])
        
fPosY2 str_to_float(szTemp2[2]);
    else
        
fPosY2 fPosY;
    
    if (
szTemp2[3][0])
        
fPosZ2 str_to_float(szTemp2[3]);
    else
        
fPosZ2 fPosZ;
    
    
replace_all(szCVarTextcharsmax(szCVarText), "^^n""^n")
    
    
get_pcvar_string(g_iIDPCVarHostNameszTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$name$"szTemp3)
    
    
get_pcvar_string(g_iIDPCVarNextMapszTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$mapn$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%d"get_playersnum(1))
    
replace_all(szCVarTextcharsmax(szCVarText), "$pnum$"szTemp3)
    
    
get_pcvar_num(g_iIDPCVarMaxPlayersVis);
    
formatex(szTemp3charsmax(szTemp3), "%d"> -g_iMaxPlayers)
    
replace_all(szCVarTextcharsmax(szCVarText), "$pmax$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%04d"floatround(g_iFPSSV fTemp))
    
replace_all(szCVarTextcharsmax(szCVarText), "$fps$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%02d"g_iRound)
    
replace_all(szCVarTextcharsmax(szCVarText), "$round$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%02d"get_pcvar_num(g_iIDPCVarMaxRounds))
    
replace_all(szCVarTextcharsmax(szCVarText), "$roundmax$"szTemp3)
    
    
get_timeleft();
    
formatex(szTemp3charsmax(szTemp3), "%02d:%02d"6060)
    
replace_all(szCVarTextcharsmax(szCVarText), "$timel$"szTemp3)
    
    
get_time("%H"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$timeh$"szTemp3)
    
    
get_time("%M"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$timem$"szTemp3)
    
    
get_time("%S"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$times$"szTemp3)
    
    
replace_all(szCVarTextcharsmax(szCVarText), "$map$"g_szMap)
    
    
iCVarType get_pcvar_num(g_iIDPCVarType1);
    
    if (
iCVarType != 1)
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_dhudmessage(iRiGiBfPosYfPosZ00.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    else
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_hudmessage(iRiGiBfPosYfPosZ00.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    
    
iNum;
    
    for (
-= 1>= 0i--)
    {
        
szMessage szCVarText;
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "PLAYED_MAP")
        
replace_all(szMessagecharsmax(szMessage), "$Lmap$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "TIME_LEFT")
        
replace_all(szMessagecharsmax(szMessage), "$Ltimel$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "NEXT_MAP")
        
replace(szTemp3charsmax(szTemp3), ":""")
        
replace_all(szMessagecharsmax(szMessage), "$Lmapn$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "PREPARE_FIGHT"999)
        
        
//client_print(szTemp[i], print_chat, szTemp3)
        
        
szTemp2[0][0] = contain(szTemp3"^n");
        
        if (
szTemp2[0][0] != -1)
        {
            
szTemp2[0][1] = contain(szTemp3"999");
            
replace(szTemp3charsmax(szTemp3), "999""")
            
            if (
szTemp2[0][1] > szTemp2[0][0])
                
format(szTemp3charsmax(szTemp3), "%s"szTemp3[szTemp2[0][0] + 1])
            else
                
szTemp3[szTemp2[0][0]] = EOS;
            
            
trim(szTemp3)
            
//add(szTemp3, charsmax(szTemp3), ":")
            
replace_all(szMessagecharsmax(szMessage), "$Lround$"szTemp3)
            
//client_print(szTemp[i], print_chat, "^"%s^"", szTemp3)
        
}
        else
            
replace_all(szMessagecharsmax(szMessage), "$Lround$""Round")
        
        if (
iCVarType != 1)
            
show_dhudmessage(szTemp[i], szMessage)
        else
            
show_hudmessage(szTemp[i], szMessage)
    }
    
    if (
iCVarType != 1)
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_dhudmessage(iR2iG2iB2fPosY2fPosZ200.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    else
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_hudmessage(iR2iG2iB2fPosY2fPosZ200.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    
    
iNum2;
    
    for (
-= 1>= 0i--)
    {
        
szMessage szCVarText;
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "PLAYED_MAP")
        
replace_all(szMessagecharsmax(szMessage), "$Lmap$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "TIME_LEFT")
        
replace_all(szMessagecharsmax(szMessage), "$Ltimel$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "NEXT_MAP")
        
replace(szTemp3charsmax(szTemp3), ":""")
        
replace_all(szMessagecharsmax(szMessage), "$Lmapn$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "PREPARE_FIGHT"999)
        
        
//client_print(iIDsPlayersDead[i], print_chat, szTemp3)
        
        
szTemp2[0][0] = contain(szTemp3"^n");
        
        if (
szTemp2[0][0] != -1)
        {
            
szTemp2[0][1] = contain(szTemp3"999");
            
replace(szTemp3charsmax(szTemp3), "999""")
            
            if (
szTemp2[0][1] > szTemp2[0][0])
                
format(szTemp3charsmax(szTemp3), "%s"szTemp3[szTemp2[0][0] + 1])
            else
                
szTemp3[szTemp2[0][0]] = EOS;
            
            
trim(szTemp3)
            
//add(szTemp3, charsmax(szTemp3), ":")
            
replace_all(szMessagecharsmax(szMessage), "$Lround$"szTemp3)
            
//client_print(szTemp[i], print_chat, "^"%s^"", szTemp3)
        
}
        else
            
replace_all(szMessagecharsmax(szMessage), "$Lround$""Round")
        
        if (
iCVarType != 1)
            
show_dhudmessage(iIDsPlayersDead[i], szMessage)
        else
            
show_hudmessage(iIDsPlayersDead[i], szMessage)
    }
    
    
GoToHUD2:
    
    
get_pcvar_string(g_iIDPCVarText2szCVarTextcharsmax(szCVarText))
    
    if (!
szCVarText[0])
        goto 
GoToFPSReset;
    
    
get_pcvar_string(g_iIDPCVarColorszMessagecharsmax(szMessage))
    
    new 
iCount;
    
    for (
iCount 0iCount 6iCount++)
    {
        if ((
contain(szMessage" ")) == -1)
            break;
        
        
+= 1;
        
format(szMessagecharsmax(szMessage), szMessage[i])
    }
/*    
    client_print(0, print_chat, "")
    client_print(0, print_chat, szMessage)
    client_print(0, print_chat, "Color iCount: %d", iCount)*/
    
    
if (iCount == 6)
    {
        
parse(szMessageszTemp2[0], charsmax(szTemp2[]), szTemp2[1], charsmax(szTemp2[]), szTemp2[2], charsmax(szTemp2[]), szTemp2[3], charsmax(szTemp2[]), szTemp2[4], charsmax(szTemp2[]), szTemp2[5], charsmax(szTemp2[]))
        
        if (
szTemp2[0][0])
            
iR str_to_num(szTemp2[0]);
        
        if (
szTemp2[1][0])
            
iG str_to_num(szTemp2[1]);
        
        if (
szTemp2[2][0])
            
iB str_to_num(szTemp2[2]);
        
        if (
iR == -&& iG == -&& iB == -1)
        {
            
random_num(02)
            
            if (
== 0)
            {
                
iR 255;
                
                if (!
random_num(01))
                {
                    
iG 0;
                    
iB 64 random_num(14);
                }
                else
                {
                    
iG 64 random_num(14);
                    
iB 0;
                }
            }
            else if (
== 1)
            {
                
iG 255;
                
                if (!
random_num(01))
                {
                    
iR 0;
                    
iB 64 random_num(14);
                }
                else
                {
                    
iR 64 random_num(14);
                    
iB 0;
                }
            }
            else if (
== 2)
            {
                
iB 255;
                
                if (!
random_num(01))
                {
                    
iR 0;
                    
iG 64 random_num(14);
                }
                else
                {
                    
iR 64 random_num(14);
                    
iG 0;
                }
            }
            
            if (
iR 255)
                
iR 255
            
            
if (iG 255)
                
iG 255
            
            
if (iB 255)
                
iB 255
        
}
        else
        {
            if (
iR 0)
                
iR random_num(-iR 1255)
            
            if (
iG 0)
                
iG random_num(-iG 1255)
            
            if (
iB 0)
                
iB random_num(-iB 1255)
        }
        
        if (
szTemp2[3][0])
            
iR2 str_to_num(szTemp2[3]);
        else
            
iR2 iR;
        
        if (
szTemp2[4][0])
            
iG2 str_to_num(szTemp2[4]);
        else
            
iG2 iG;
        
        if (
szTemp2[5][0])
            
iB2 str_to_num(szTemp2[5]);
        else
            
iB2 iB;
        
        if (
iR2 == -&& iG2 == -&& iB2 == -1)
        {
            
random_num(02)
            
            if (
== 0)
            {
                
iR2 255;
                
                if (!
random_num(01))
                {
                    
iG2 0;
                    
iB2 64 random_num(14);
                }
                else
                {
                    
iG2 64 random_num(14);
                    
iB2 0;
                }
            }
            else if (
== 1)
            {
                
iG2 255;
                
                if (!
random_num(01))
                {
                    
iR2 0;
                    
iB2 64 random_num(14);
                }
                else
                {
                    
iR2 64 random_num(14);
                    
iB2 0;
                }
            }
            else if (
== 2)
            {
                
iB2 255;
                
                if (!
random_num(01))
                {
                    
iR2 0;
                    
iG2 64 random_num(14);
                }
                else
                {
                    
iR2 64 random_num(14);
                    
iG2 0;
                }
            }
            
            if (
iR2 255)
                
iR2 255
            
            
if (iG2 255)
                
iG2 255
            
            
if (iB2 255)
                
iB2 255
        
}
        else
        {
            if (
iR2 0)
                
iR2 random_num(-iR2 1255)
            
            if (
iG2 0)
                
iG2 random_num(-iG2 1255)
            
            if (
iB2 0)
                
iB2 random_num(-iB2 1255)
        }
    }
    
    
//client_print(0, print_chat, "[HUD2] Color alive: %d %d %d. Color dead: %d %d %d.", iR, iG, iB, iR2, iG2, iB2)
    
    
get_pcvar_string(g_iIDPCVarPosszMessagecharsmax(szMessage))
    
    for (
iCount 0iCount 4iCount++)
    {
        if ((
contain(szMessage" ")) == -1)
            break;
        
        
+= 1;
        
format(szMessagecharsmax(szMessage), szMessage[i])
    }
/*    
    client_print(0, print_chat, szMessage)
    client_print(0, print_chat, "Position iCount: %d", iCount)*/
    
    
if (iCount == 4)
    {
        
parse(szMessageszTemp2[0], charsmax(szTemp2[]), szTemp2[1], charsmax(szTemp2[]), szTemp2[2], charsmax(szTemp2[]), szTemp2[3], charsmax(szTemp2[]))
        
        if (
szTemp2[0][0])
            
fPosY str_to_float(szTemp2[0]);
        
        if (
szTemp2[1][0])
            
fPosZ str_to_float(szTemp2[1]);
        
        if (
szTemp2[2][0])
            
fPosY2 str_to_float(szTemp2[2]);
        else
            
fPosY2 fPosY;
        
        if (
szTemp2[3][0])
            
fPosZ2 str_to_float(szTemp2[3]);
        else
            
fPosZ2 fPosZ;
    }
    
    
replace_all(szCVarTextcharsmax(szCVarText), "^^n""^n")
    
    
get_pcvar_string(g_iIDPCVarHostNameszTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$name$"szTemp3)
    
    
get_pcvar_string(g_iIDPCVarNextMapszTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$mapn$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%d"get_playersnum(1))
    
replace_all(szCVarTextcharsmax(szCVarText), "$pnum$"szTemp3)
    
    
get_pcvar_num(g_iIDPCVarMaxPlayersVis);
    
formatex(szTemp3charsmax(szTemp3), "%d"> -g_iMaxPlayers)
    
replace_all(szCVarTextcharsmax(szCVarText), "$pmax$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%04d"floatround(g_iFPSSV fTemp))
    
replace_all(szCVarTextcharsmax(szCVarText), "$fps$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%02d"g_iRound)
    
replace_all(szCVarTextcharsmax(szCVarText), "$round$"szTemp3)
    
    
formatex(szTemp3charsmax(szTemp3), "%02d"get_pcvar_num(g_iIDPCVarMaxRounds))
    
replace_all(szCVarTextcharsmax(szCVarText), "$roundmax$"szTemp3)
    
    
get_timeleft();
    
formatex(szTemp3charsmax(szTemp3), "%02d:%02d"6060)
    
replace_all(szCVarTextcharsmax(szCVarText), "$timel$"szTemp3)
    
    
get_time("%H"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$timeh$"szTemp3)
    
    
get_time("%M"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$timem$"szTemp3)
    
    
get_time("%S"szTemp3charsmax(szTemp3))
    
replace_all(szCVarTextcharsmax(szCVarText), "$times$"szTemp3)
    
    
replace_all(szCVarTextcharsmax(szCVarText), "$map$"g_szMap)
    
    
iCVarType get_pcvar_num(g_iIDPCVarType2);
    
    if (
iCVarType != 1)
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_dhudmessage(iRiGiBfPosYfPosZ00.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    else
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_hudmessage(iRiGiBfPosYfPosZ00.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    
    
iNum;
    
    for (
-= 1>= 0i--)
    {
        
szMessage szCVarText;
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "PLAYED_MAP")
        
replace_all(szMessagecharsmax(szMessage), "$Lmap$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "TIME_LEFT")
        
replace_all(szMessagecharsmax(szMessage), "$Ltimel$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "NEXT_MAP")
        
replace(szTemp3charsmax(szTemp3), ":""")
        
replace_all(szMessagecharsmax(szMessage), "$Lmapn$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"szTemp[i], "PREPARE_FIGHT"999)
        
        
//client_print(szTemp[i], print_chat, szTemp3)
        
        
szTemp2[0][0] = contain(szTemp3"^n");
        
        if (
szTemp2[0][0] != -1)
        {
            
szTemp2[0][1] = contain(szTemp3"999");
            
replace(szTemp3charsmax(szTemp3), "999""")
            
            if (
szTemp2[0][1] > szTemp2[0][0])
                
format(szTemp3charsmax(szTemp3), "%s"szTemp3[szTemp2[0][0] + 1])
            else
                
szTemp3[szTemp2[0][0]] = EOS;
            
            
trim(szTemp3)
            
//add(szTemp3, charsmax(szTemp3), ":")
            
replace_all(szMessagecharsmax(szMessage), "$Lround$"szTemp3)
            
//client_print(szTemp[i], print_chat, "^"%s^"", szTemp3)
        
}
        else
            
replace_all(szMessagecharsmax(szMessage), "$Lround$""Round")
        
        if (
iCVarType != 1)
            
show_dhudmessage(szTemp[i], szMessage)
        else
            
show_hudmessage(szTemp[i], szMessage)
    }
    
    if (
iCVarType != 1)
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_dhudmessage(iR2iG2iB2fPosY2fPosZ200.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    else
    {
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        
set_hudmessage(iR2iG2iB2fPosY2fPosZ200.0fTemp + ((fTemp >= 0.2) ? 0.1 0.075), 0.00.0)
    }
    
    
iNum2;
    
    for (
-= 1>= 0i--)
    {
        
szMessage szCVarText;
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "PLAYED_MAP")
        
replace_all(szMessagecharsmax(szMessage), "$Lmap$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "TIME_LEFT")
        
replace_all(szMessagecharsmax(szMessage), "$Ltimel$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "NEXT_MAP")
        
replace(szTemp3charsmax(szTemp3), ":""")
        
replace_all(szMessagecharsmax(szMessage), "$Lmapn$"szTemp3)
        
        
formatex(szTemp3charsmax(szTemp3), "%L"iIDsPlayersDead[i], "PREPARE_FIGHT"999)
        
        
//client_print(iIDsPlayersDead[i], print_chat, szTemp3)
        
        
szTemp2[0][0] = contain(szTemp3"^n");
        
        if (
szTemp2[0][0] != -1)
        {
            
szTemp2[0][1] = contain(szTemp3"999");
            
replace(szTemp3charsmax(szTemp3), "999""")
            
            if (
szTemp2[0][1] > szTemp2[0][0])
                
format(szTemp3charsmax(szTemp3), "%s"szTemp3[szTemp2[0][0] + 1])
            else
                
szTemp3[szTemp2[0][0]] = EOS;
            
            
trim(szTemp3)
            
//add(szTemp3, charsmax(szTemp3), ":")
            
replace_all(szMessagecharsmax(szMessage), "$Lround$"szTemp3)
            
//client_print(szTemp[i], print_chat, "^"%s^"", szTemp3)
        
}
        else
            
replace_all(szMessagecharsmax(szMessage), "$Lround$""Round")
        
        if (
iCVarType != 1)
            
show_dhudmessage(iIDsPlayersDead[i], szMessage)
        else
            
show_hudmessage(iIDsPlayersDead[i], szMessage)
    }
    
    
GoToFPSReset:
    
    
g_iFPSSV 0;
    
g_iFPSCl "";




bitsums.inc
Attached Thumbnails
Click image for larger version

Name:	Captură de ecran 2024-04-21 163154.png
Views:	20
Size:	58.3 KB
ID:	204148  
Attached Files
File Type: inc dhudmessage.inc (3.3 KB, 19 views)
File Type: sma Get Plugin or Get Source (D7HUDInfo.sma - 33 views - 23.6 KB)
__________________

Last edited by georgik57; 04-21-2024 at 11:57. Reason: Added missing bitsums.inc
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-21-2024 , 11:52   Re: D7 HUD Info
Reply With Quote #2

Something is missing -> fatal error 100: cannot read from file: "bitsums"
WATCH_D0GS UNITED is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-21-2024 , 11:58   Re: D7 HUD Info
Reply With Quote #3

Quote:
Originally Posted by WATCH_D0GS UNITED View Post
Something is missing -> fatal error 100: cannot read from file: "bitsums"
Woops. Edited. Also here: bitsums.inc. Ty.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-21-2024 , 12:14   Re: D7 HUD Info
Reply With Quote #4

We tough it was like:

PHP Code:
public bitsum_del(&cell,bit) {
        
cell &= ~(1<<bit)

__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-21-2024 , 12:21   Re: D7 HUD Info
Reply With Quote #5

Works either way i guess. I've always used this version and had no problems.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-21-2024 , 12:44   Re: D7 HUD Info
Reply With Quote #6

Yeah it is working fine here.



When the FPS goes below certain value it disappears.
Why this occurs?
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-21-2024 , 12:54   Re: D7 HUD Info
Reply With Quote #7

It measures client fps to avoid overflowing when he can't process enough information.
If it goes under 40, the messages are not sent.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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:21.


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