Raised This Month: $ Target: $400
 0% 

HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-26-2022 , 13:17   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #1

It didn't work, it doesn't recognize
MeliMeli is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-26-2022 , 13:56   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #2

Show your code.

Quote:
Originally Posted by Supremache View Post
I have a method but I haven't tested it, if it works I will show it for you
The simplest method (even though far from simple) I can think of is creating a forward that is called before displaying the text, and the option to change the text directly in said forward.
__________________

Last edited by OciXCrom; 04-26-2022 at 13:57.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-27-2022 , 15:48   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #3

// Spectating someone else?
if (player !=ID_SHOWHUD)
{
new player_name[32]
get_user_name(player, player_name, charsmax(player_name))

// Show name, health, class, and money
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(player))
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L $ %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name , ID_SHOWHUD, "MONEY1", cs_get_user_money(player))
}
else
{
new szXPCommas[ 16 ], szNextXPCommas[ 16 ], szAPCommas[ 16 ];
AddCommas( crxranks_get_user_xp( id ), szXPCommas, charsmax( szXPCommas ) );
AddCommas( crxranks_get_user_next_xp(id), szNextXPCommas, charsmax( szNextXPCommas ) );
AddCommas( g_ammopacks[id], szAPCommas, charsmax( szAPCommas ) );

// Show health, class
set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "=ZP 5.0=-^nHP: %d - Armor: %d - %L %s - %L %d^nLevel: %d/%d: %s | XP: %d/% d", get_user_health(ID_SHOWHUD), get_user_armor(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD), crxranks_get_user_level(id), crxranks_get_max_levels(id), rankname, szAPCommas )
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "HP: %d - %L %s - %s^nFPS: %d", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, g_iUserFPS[player])
}
}


Errors:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "AddCommas" online 243
Error: Number of arguments does not match definition online 243
Error: Number of arguments does not match definition online 243
Error: Too many error messages on one line on line 243

Compilation aborted.
4 Errors.
Could not locate output file C:\Users\Desktop\zp50_hud_info.amx (compile failed).

If you just tell me what I have to do so "do it and good luck." I'll never make it, a helping hand is always good sometimes. I've been trying since yesterday to do this.
MeliMeli is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-27-2022 , 19:14   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #4

Quote:
The simplest method (even though far from simple) I can think of is creating a forward that is called before displaying the text, and the option to change the text directly in said forward.
I was using another idea using forward, but your way is good too.

@MeliMeli, Forgot this stock, put it at the end of the file
PHP Code:
// Credits to Bugsy
AddCommasiNum szOutput[] , iLen )
{
    new 
szTmp15 ] , iOutputPos iNumPos iNumLen;
    
    if ( 
iNum )
    {
        
szOutputiOutputPos++ ] = '-';
        
iNum absiNum );
    }
    
    
iNumLen num_to_striNum szTmp charsmaxszTmp ) );

    if ( 
iNumLen <= )
    {
        
iOutputPos += copyszOutputiOutputPos ] , iLen szTmp );
    }
    else
    {
        while ( ( 
iNumPos iNumLen ) && ( iOutputPos iLen ) ) 
        {
            
szOutputiOutputPos++ ] = szTmpiNumPos++ ];
        
            if( ( 
iNumLen iNumPos ) && !( ( iNumLen iNumPos ) % ) ) 
                
szOutputiOutputPos++ ] = ',';
        }
        
        
szOutputiOutputPos ] = EOS;
    }
    
    return 
iOutputPos;

Also you don't need to use that stock, Take examples:

PHP Code:
public CrxRanksid // Function Title
{
    
// With value native use %d or %i field
    // With String native use %s field
    // With Float native use %.2f or floatround
    
    // For example:
    // These value natives so you have to use %i or %d field
    // crxranks_get_user_xp(id)
    // crxranks_get_user_next_xp(id)
    // crxranks_get_user_level(id)
    // crxranks_get_max_levels(id)
    
    // How to use: 
    
client_printidprint_chat"XP: %i - NextXP: %i | Lv: %i - MaxLv: %i"crxranks_get_user_xp(id), crxranks_get_user_next_xp(id), crxranks_get_user_level(id), crxranks_get_max_levels(id) )
    
    
// This is string native "crxranks_get_user_rank(id, const buffer[], isize )" for using it you need to create a string variable for exmaple:
    
    
new szRank32 // 32 = Put max chars number of ranks
    // As you can see it has 3 required arguments
    // 1th is user id
    // 2th is string variable
    // 3th is the size of string variable
    
crxranks_get_user_rank(idszRankcharsmaxszRank ) )  // This is string variable so should use %s feild
    
client_printidprint_chat"XP: %i - NextXP: %i | Lv: %i - MaxLv: %i | Rank: %s"crxranks_get_user_xp(id), crxranks_get_user_next_xp(id), crxranks_get_user_level(id), crxranks_get_max_levels(id), szRank )

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-28-2022 , 16:00   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #5

Im test now
MeliMeli is offline
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-28-2022 , 22:15   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #6

// Spectating someone else?
if (player != ID_SHOWHUD)
{
new player_name[32]
get_user_name(player, player_name, charsmax(player_name))

// Show name, health, class, and money
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(player))
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L $ %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "MONEY1", cs_get_user_money(player))
}
else
{


new szXPCommas[ 16 ], szNextXPCommas[ 16 ], szAPCommas[ 16 ];
AddCommas( crxranks_get_user_xp(player), szXPCommas, charsmax( szXPCommas ) );
AddCommas( crxranks_get_user_next_xp(player), szNextXPCommas, charsmax( szNextXPCommas ) );

// Show health, class
set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "-=ZP 5.0=-^nHP: %d - Armor: %d - %L %s - %L %d^nLevel: %d/%d: | XP: %s/%s", get_user_health(ID_SHOWHUD), get_user_armor(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD),
crxranks_get_user_level(player), crxranks_get_max_levels(player), szXPCommas, szNextXPCommas )
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "HP: %d - %L %s - %s^nFPS: %d", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, g_iUserFPS[player])
}
}

// Credits to Bugsy
AddCommas( iNum , szOutput[] , iLen )
{
new szTmp[ 15 ] , iOutputPos , iNumPos , iNumLen;

if ( iNum < 0 )
{
szOutput[ iOutputPos++ ] = '-';
iNum = abs( iNum );
}

iNumLen = num_to_str( iNum , szTmp , charsmax( szTmp ) );

if ( iNumLen <= 3 )
{
iOutputPos += copy( szOutput[ iOutputPos ] , iLen , szTmp );
}
else
{
while ( ( iNumPos < iNumLen ) && ( iOutputPos < iLen ) )
{
szOutput[ iOutputPos++ ] = szTmp[ iNumPos++ ];

if( ( iNumLen - iNumPos ) && !( ( iNumLen - iNumPos ) % 3 ) )
szOutput[ iOutputPos++ ] = ',';
}

szOutput[ iOutputPos ] = EOS;
}

return iOutputPos;
}

Error: Number of arguments does not match definition on line 253 (Line of =ZP 5.0=)
MeliMeli is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-29-2022 , 15:04   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #7

How are we supposed to know which line is 253?
Also, please put codes in [code] tags.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-29-2022 , 20:39   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #8

I just said up there that line 253 is where it says "ZP 5.0"

@OciXCrom

" ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "-=ZP 5.0=-^nHP: %d - Armor: %d - %L %s - %L %d^nLevel: %d/%d: | XP: %s/%s", get_user_health(ID_SHOWHUD), get_user_armor(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD),
crxranks_get_user_level(player), crxranks_get_max_levels(player), szXPCommas, szNextXPCommas ) "


This line
I don't know how to do that, sorry.

Last edited by MeliMeli; 04-29-2022 at 20:57.
MeliMeli is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-29-2022 , 22:38   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #9

Quote:
Originally Posted by MeliMeli View Post
I just said up there that line 253 is where it says "ZP 5.0"

@OciXCrom

" ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "-=ZP 5.0=-^nHP: %d - Armor: %d - %L %s - %L %d^nLevel: %d/%d: | XP: %s/%s", get_user_health(ID_SHOWHUD), get_user_armor(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD),
crxranks_get_user_level(player), crxranks_get_max_levels(player), szXPCommas, szNextXPCommas ) What is this ? "


This line
I don't know how to do that, sorry.
Anyway, replace this function titled 'ShowHUD':
Code:
public ShowHUD(taskid)
{
	new player = ID_SHOWHUD
	
	// Player dead?
	if (!is_user_alive(player))
	{
		// Get spectating target
		player = pev(player, PEV_SPEC_TARGET)
		
		// Target not alive
		if (!is_user_alive(player))
			return;
	}
	
	// Format classname
	static class_name[32], transkey[64]
	new red, green, blue
	
	if (zp_core_is_zombie(player)) // zombies
	{
		red = HUD_STATS_ZOMBIE_R
		green = HUD_STATS_ZOMBIE_G
		blue = HUD_STATS_ZOMBIE_B
		
		// Nemesis Class loaded?
		if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(player))
			formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_NEMESIS")
		else
		{
			zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_name, charsmax(class_name))
			
			// ML support for class name
			formatex(transkey, charsmax(transkey), "ZOMBIENAME %s", class_name)
			if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
		}
	}
	else // humans
	{
		red = HUD_STATS_HUMAN_R
		green = HUD_STATS_HUMAN_G
		blue = HUD_STATS_HUMAN_B
		
		// Survivor Class loaded?
		if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_survivor_get(player))
			formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")
		else
		{
			zp_class_human_get_name(zp_class_human_get_current(player), class_name, charsmax(class_name))
			
			// ML support for class name
			formatex(transkey, charsmax(transkey), "HUMANNAME %s", class_name)
			if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
		}
	}
	

	new szRank[ 32 ], szHudData[ 256 ];
	// Spectating someone else?
	if (player != ID_SHOWHUD)
	{
		new player_name[32]
		get_user_name(player, player_name, charsmax(player_name))
		
		// Show name, health, class, and money
		set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
		
		if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
			formatex( szHudData, charsmax( szHudData ), "%L: %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(player) )
		else
			formatex( szHudData, charsmax( szHudData ), "%L: %s^nHP: %d - %L %s - %L $ %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "MONEY1", cs_get_user_money(player) )
	}
	else
	{
		player = ID_SHOWHUD
		// Show health, class
		set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
		
		if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
			formatex( szHudData, charsmax( szHudData ), "HP: %d - %L %s - %L %d", get_user_health(player), player, "CLASS_CLASS", class_name, player, "AMMO_PACKS1", zp_ammopacks_get(player) )
		else
			formatex( szHudData, charsmax( szHudData ), "HP: %d - %L %s", get_user_health(player), player, "CLASS_CLASS", class_name )
		
	}
	crxranks_get_user_rank( player, szRank, charsmax( szRank ) )
	ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%s^nXP: %i - NextXP: %i | Lv: %i - MaxLv: %i | Rank: %s", szHudData, crxranks_get_user_xp(player), crxranks_get_user_next_xp(player), crxranks_get_user_level(player), crxranks_get_max_levels(), szRank );
}
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 04-30-2022 at 22:25.
Supremache is offline
MeliMeli
Senior Member
Join Date: Apr 2022
Location: Brazil
Old 04-30-2022 , 15:32   Re: HUD Level/XP in Main HUD (ZP 5.0) (OciXCrom)
Reply With Quote #10

keeps giving error. Are you sure this is it?

Error: Number of arguments does not match definition online 237
Error: Invalid expression, assumed zero online 237

Line 237:

ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%s^nXP: %i - NextXP: %i | Lv: %i - MaxLv: %i | Rank: %s", szHudData, crxranks_get_user_xp(player), crxranks_get_user_next_xp(player), crxranks_get_user_level( jogador), crxranks_get_max_levels(jogador), szRank );
MeliMeli 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 21:20.


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